I quickly threw in a TestSuite that would run all Tests 'below' the current package...
package org.anddev.andengine.test;
import junit.framework.Test;
import junit.framework.TestSuite;
import android.test.suitebuilder.TestSuiteBuilder;
public class AllTests extends TestSuite {
public static Test suite() {
return new TestSuiteBuilder(AllTests.class).includeAllPackagesUnderHere().build();
}
}... and a dummy TestCase ...package org.anddev.andengine.test.bla;
import junit.framework.Assert;
import android.test.AndroidTestCase;
public class SomeTest extends AndroidTestCase {
public void testSomething() throws Throwable {
Assert.assertTrue(1 + 1 == 2);
}
public void testSomethingElse() throws Throwable {
Assert.assertTrue(1 + 1 == 3);
}
}Either running the Android test project right from Eclipse or from the command-line resulted in:
E:\sdk\android\tools>adb shell am instrument -w org.anddev.andengine.test/android.test.InstrumentationTestRunner
INSTRUMENTATION_RESULT: shortMsg=Unable to instantiate instrumentation ComponentInfo{org.anddev.andengine.test/android.test.InstrumentationTestRunner}: java.lang.ClassNotFoundException: android.test.InstrumentationTestRunner in loader dalvik.system.PathClassLoader@4001b4f8
INSTRUMENTATION_RESULT: longMsg=java.lang.RuntimeException: Unable to instantiate instrumentation ComponentInfo{org.anddev.andengine.test/android.test.InstrumentationTestRunner}: java.lang.ClassNotFoundException: android.test.InstrumentationTestRunner in loader dalvik.system.PathClassLoader@4001b4f8
INSTRUMENTATION_CODE: 0
So what was the problem and how did I fix this?
Due to the fact that the project I wanted to test was a kind of libary, which had no need for an application or activity tag or similar i had deleted it from the AndroidManifest.xml, like this:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.anddev.andengine" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="4" /> </manifest>... so the only thing I had to change was an empty <application> tag to the AndroidManifest.xml !
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.anddev.andengine" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="4" /> <application /> </manifest>
Hope this helps =)
Best Regards,
Nicolas




