My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
InstrumentationTestRunner  

Featured
Updated May 31, 2010 by botte...@gmail.com

Introduction

The 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

  1. Drop InstrumentationTestRunner.java in your test project, or drop the jar file in your project.
  2. Change the AndroidManifest.xml of your test project to use com.neenbedankt.android.test.InstrumentationTestRunner like this:
  3. <manifest ..>
    <instrumentation android:targetPackage="com.neenbedankt.enginewatch" android:name="com.neenbedankt.android.test.InstrumentationTestRunner" />
    </manifest>

Running the tests

Just 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.

Comment by moritzp...@gmail.com, Jan 8, 2011

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>
Comment by carrot11...@gmail.com, Jun 8, 2011

how to make a .html report?Needing xsl to transfer the TEST-all.xml?

Comment by sveinung...@gmail.com, Sep 5, 2011

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.InstrumentationTestRunner

Easily fixed by adding this line to build.properties of the test project.

# build.properties
test.runner=com.neenbedankt.android.test.InstrumentationTestRunner
Comment by biancapi...@gmail.com, May 14, 2012

I have this error:

echo? Running tests ...
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: 0

I 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

Comment by biancapi...@gmail.com, May 14, 2012

INSTRUMENTATION_RESULT: shortMsg=libcore.io.ErrnoException? INSTRUMENTATION_RESULT: longMsg=libcore.io.ErrnoException?: open failed: EACCES (Permission denied) INSTRUMENTATION_CODE: 0


Sign in to add a comment
Powered by Google Project Hosting