Merge branch 'master' into 'master'

run JUnit tests

It turns out that Jenkins was running the JUnit tests all along, but it just never reported on them.  This adds a jar to the test project that makes JUnit reports that Jenkins can parse, and the report on the results.  So now if the JUnit tests fail, people will be emailed just like build failures.

Also, I added a quick `ant javadoc` target to the main project in case anyone likes that kind of thing.
This commit is contained in:
Peter Serwylo 2014-04-11 21:56:39 +00:00
commit 60f2be678a
7 changed files with 34 additions and 11 deletions

View File

@ -1,15 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="custom_rules" default="fetch-test-report">
<project name="custom_rules">
<target name="fetch-test-report">
<echo>Downloading XML test report…</echo>
<mkdir dir="junitreports"/>
<exec executable="${adb}" failonerror="true">
<arg line="${adb.device.arg}"/>
<arg value="pull" />
<arg value="/data/data/${tested.manifest.package}/files/junit-report.xml" />
<arg value="junitreports/junit-report.xml" />
</exec>
<target name="javadoc" description="Generate Javadocs">
<javadoc sourcepath="${source.dir}"
destdir="${out.dir}/javadoc"
packagenames="org.fdroid.*"
windowtitle="${ant.project.name}"
doctitle="${ant.project.name}" />
</target>
</project>

1
test/.gitignore vendored
View File

@ -9,3 +9,4 @@
/*.iml
out
/.settings/
junit-report.xml

View File

@ -15,7 +15,7 @@
the package of org.fdroid.fdroid. To run the tests use the command:
"adb shell am instrument -w org.fdroid.fdroid.tests/android.test.InstrumentationTestRunner"
-->
<instrumentation android:name="android.test.InstrumentationTestRunner"
<instrumentation android:name="com.zutubi.android.junitreport.JUnitReportTestRunner"
android:targetPackage="org.fdroid.fdroid"
android:label="Tests for org.fdroid.fdroid" />
</manifest>

View File

@ -16,3 +16,4 @@
# The password will be asked during the build when you use the 'release' target.
tested.project.dir=..
test.runner=com.zutubi.android.junitreport.JUnitReportTestRunner

19
test/custom_rules.xml Normal file
View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="test_custom_rules" default="fetch-test-report">
<target name="fetch-test-report">
<xpath
expression="/manifest/@package"
input="${tested.project.dir}/AndroidManifest.xml"
output="tested.package" />
<echo>Downloading XML test report (/data/data/${tested.package}/files/junit-report.xml)…</echo>
<mkdir dir="junitreports"/>
<exec executable="${adb}" failonerror="true">
<arg line="${adb.device.arg}"/>
<arg value="pull" />
<arg value="/data/data/${tested.package}/files/junit-report.xml" />
<arg value="junit-report.xml" />
</exec>
</target>
</project>

View File

@ -0,0 +1,5 @@
Needed for Jenkins to get JUnit reports.
* https://github.com/jsankey/android-junit-report
* https://github.com/downloads/jsankey/android-junit-report/android-junit-report-1.5.8.jar

Binary file not shown.