run JUnit tests using android-junit-report to get XML output

Jenkins needs some kind of report from the JUnit tests in order to tell
whether the tests succeeded or not.  android-junit-report is a library to do
exactly that.  With this setup, Jenkins should now successfully understand the
status of the JUnit tests, where before it just ran them and ignored the
results
This commit is contained in:
Hans-Christoph Steiner 2014-04-10 13:05:59 -04:00
parent bc6f3d5cd9
commit d813f1ec17
7 changed files with 28 additions and 13 deletions

View File

@ -1,16 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="custom_rules" default="fetch-test-report">
<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>
<project name="custom_rules">
<target name="javadoc" description="Generate Javadocs">
<javadoc sourcepath="${source.dir}"

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.