Robotium test cannot find activity class

0
0

I have been using robotium to test my android application. I found it very useful tool so far. Recently we have done a refactoring that would use only one activity in the entire application, each page will be replaced by a fragment.

However, After we start using that activity to run the unit tests, the test complains NoClassDefound error — it couldn’t find the activity class. I don’t see anywhere I have change the configuration whatsoever.

Can anybody give a clue what might be wrong , where to check and so on ?

[INFO]     java.lang.RuntimeException: Exception during suite construction
at android
.test.suitebuilder.TestSuiteBuilder$FailedToCreateTests.testSuiteConstructionFailed(T estSuiteBuilder.java:239)
at java
.lang.reflect.Method.invokeNative(Native Method)
at android
.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
at android
.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
at android
.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:529)
....
at dalvik
.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: com.xxx.wallet.HaloActivity
at com
.xxx.wallet.HaloActivityTest.<init>(HaloActivityTest.java:12)
... 18 more

The app apk is loaded, AndroidManifest.xml should be ok too.

  • You must to post comments
0
0

Make sureafter refactoring:

The AndroidManifest.xml of the test project is still accurate:

<instrumentation android:targetPackage="package.of.the.app.under.test">

The Test class is still accurate:

public class YourTest extends ActivityInstrumentationTestCase2<SplashScreenActivity> {
protected static final String TARGET_PACKAGE_ID = "package.of.the.app.under.test";
protected Solo solo;
public Test() {
super(TARGET_PACKAGE_ID, StartingActivityOfYourAppUnderTest.class);
}
//..
}

All libraries of the app under test can only (!) be found in libs/yourlibrary.jar and are referenced in Project->Properties->Java Build Path->Libraries

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website