Android Developer 101
Android Developer 101

Reputation: 11

Junit output using the-missing-android-xml-junit-test-runner

I am having trouble setting up http://code.google.com/p/the-missing-android-xml-junit-test-runner/ within Jenkins.

I can get the tests to run and pass in eclipse. When I pull them into jenkins and build via ant I get the following problem:

 [echo] Running tests ...
 [exec] INSTRUMENTATION_RESULT: shortMsg=java.lang.ClassNotFoundException
 [exec] INSTRUMENTATION_RESULT: longMsg=java.lang.ClassNotFoundException: pl.polidea.instrumentation.PolideaInstrumentationTestRunner in loader dalvik.system.PathClassLoader[/system/framework/android.test.runner.jar:/data/app/mj.geo.golf.application.test-1.apk:/data/app/mj.geo.golf.application-1.apk]
 [exec] INSTRUMENTATION_CODE: 0

The manifest looks like:

<?xml version="1.0" encoding="utf-8"?>    
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="mj.geo.golf.application.test"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk android:minSdkVersion="8" />

<instrumentation
    android:name="pl.polidea.instrumentation.PolideaInstrumentationTestRunner"
    android:targetPackage="mj.geo.golf.application"
    android:label="Tests for pl.polidea.somepackage" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <uses-library android:name="android.test.runner" />
</application></manifest>

I have looked around at other related posts and made sure that eclipse exports the the-missing-android-xml-junit-test-runner-release-1.3_2.jar and it appears in the workspace.

I am pretty new to android and java so any thoughts would be useful

Upvotes: 1

Views: 1483

Answers (1)

Xiao
Xiao

Reputation: 12695

You should read the Wiki more carefully.

The test runner should be added to the test project. Either as a .jar file (added in libs directory) or as external library (standard android external library approach). You can download the .jar file from here.

So the easiest way is to create a folder named libs just under the root of the project (the same level as src folder) and put the *the-missing-android-xml-junit-test-runner-release-1.3_2.jar* in it and then 'Add it to Build Path'.

Upvotes: 1

Related Questions