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:
parent
bc6f3d5cd9
commit
d813f1ec17
@ -1,16 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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>
|
|
||||||
|
|
||||||
<target name="javadoc" description="Generate Javadocs">
|
<target name="javadoc" description="Generate Javadocs">
|
||||||
<javadoc sourcepath="${source.dir}"
|
<javadoc sourcepath="${source.dir}"
|
||||||
|
1
test/.gitignore
vendored
1
test/.gitignore
vendored
@ -9,3 +9,4 @@
|
|||||||
/*.iml
|
/*.iml
|
||||||
out
|
out
|
||||||
/.settings/
|
/.settings/
|
||||||
|
junit-report.xml
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
the package of org.fdroid.fdroid. To run the tests use the command:
|
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"
|
"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:targetPackage="org.fdroid.fdroid"
|
||||||
android:label="Tests for org.fdroid.fdroid" />
|
android:label="Tests for org.fdroid.fdroid" />
|
||||||
</manifest>
|
</manifest>
|
||||||
|
@ -16,3 +16,4 @@
|
|||||||
# The password will be asked during the build when you use the 'release' target.
|
# The password will be asked during the build when you use the 'release' target.
|
||||||
|
|
||||||
tested.project.dir=..
|
tested.project.dir=..
|
||||||
|
test.runner=com.zutubi.android.junitreport.JUnitReportTestRunner
|
||||||
|
19
test/custom_rules.xml
Normal file
19
test/custom_rules.xml
Normal 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>
|
5
test/libs/android-junit-report-1.5.8.README
Normal file
5
test/libs/android-junit-report-1.5.8.README
Normal 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
|
BIN
test/libs/android-junit-report-1.5.8.jar
Normal file
BIN
test/libs/android-junit-report-1.5.8.jar
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user