|
InstrumentationTestRunner
IntroductionThe class com.neenbedankt.android.test.InstrumentationTestRunner extends android.test.InstrumentationTestRunner to output a junit report style xml report that is compatible with Hudson, so that the results and trends can be displayed. Usage
<manifest ..> <instrumentation android:targetPackage="com.neenbedankt.enginewatch" android:name="com.neenbedankt.android.test.InstrumentationTestRunner" /> </manifest> Running the testsJust run your test like you used to, but make sure you use com.neenbedankt.android.test.InstrumentationTestRunner. From an Android ant build you can set the property test.runner to this class. After the tests have run, the file TEST-all.xml will be created in the files directory of your application on your device or emulator. For example, if the application under test is "com.myapp.superapp" the TEST-all.xml will be under "/data/data/com.myapp.superapp/files/TEST-all.xml". You can then pull this file off the device and put it somewhere your next build step or Hudson can find it. |
When you want to pull the file from a device you could use the following ant markup:
<macrodef name="pull-from-device"> <attribute name="remote" /> <attribute name="locale" /> <sequential> <exec executable="${adb}" failonerror="true"> <arg line="${adb.device.arg}" /> <arg value="pull" /> <arg value="@{remote}" /> <arg value="@{locale}" /> </exec> </sequential> </macrodef>how to make a .html report?Needing xsl to transfer the TEST-all.xml?
FYI; in the latest SDK "test-runner" is set to "android.test.InstrumentationTestRunner", regardless of the manifest. This results in the following error:
[echo] Running tests ... [exec] INSTRUMENTATION_STATUS: id=ActivityManagerService [exec] INSTRUMENTATION_STATUS: Error=Unable to find instrumentation info for: ComponentInfo{no.giantleap.sveinungkb.test/android.test.InstrumentationTestRunner} [exec] INSTRUMENTATION_STATUS_CODE: -1 [exec] android.util.AndroidException: INSTRUMENTATION_FAILED: no.giantleap.sveinungkb.test/android.test.InstrumentationTestRunnerEasily fixed by adding this line to build.properties of the test project.
I have this error:
14-May-2012 10:48:58 exec? INSTRUMENTATION_RESULT: shortMsg=libcore.io.ErrnoException? 14-May-2012 10:48:58 exec? INSTRUMENTATION_RESULT: longMsg=libcore.io.ErrnoException?: open failed: EACCES (Permission denied) 14-May-2012 10:48:58 exec? INSTRUMENTATION_CODE: 0I am running Junit test on emulator on Bamboo server. The emulator runs on a port like a process.
the error appears when I try to move the logs from the emulator into a test results.xml with the command: pull /data/data/org.pbs.selenium/files/TEST-all.xml /home/agent/bamboo-agent-home/xml-data/build-dir/MW-MWSEL-JOB1/SeleniumActivityAppTest?/bin/test-results.xml
INSTRUMENTATION_RESULT: shortMsg=libcore.io.ErrnoException? INSTRUMENTATION_RESULT: longMsg=libcore.io.ErrnoException?: open failed: EACCES (Permission denied) INSTRUMENTATION_CODE: 0