Note that there are some explanatory texts on larger screens.

plurals
  1. POAre there problems with ActivityInstrumentationTestCase2 in Android 2.1?
    text
    copied!<p>After I have set up all the unit test cases for my android application I now also want to do functional testing. But I encouter one problem. As I am developping for the HTC Legend I can, by now, only use android platforms up to 2.1. But in some way it seems that the <strong>ActivityInstrumentationTestCase2</strong> won't work. </p> <pre><code>public SupplierSelectoinTest() { super("com.sap.catalogue.activities", SupplierSelection.class); } </code></pre> <p>This simple piece of code gives me the following error, when I try to run the test:</p> <pre><code>java.lang.RuntimeException: Unable to resolve activity for: Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=com.sap.catalogue.activities/com.sap.catalogue.activities.SupplierSelection } at android.app.Instrumentation.startActivitySync(Instrumentation.java:371) at android.test.InstrumentationTestCase.launchActivityWithIntent(InstrumentationTestCase.java:120) at android.test.InstrumentationTestCase.launchActivity(InstrumentationTestCase.java:98) at android.test.ActivityInstrumentationTestCase2.getActivity(ActivityInstrumentationTestCase2.java:87) at com.sap.catalogue.test.acceptance.SupplierSelectoinTest.setUp(SupplierSelectoinTest.java:27) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154) at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:430) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447) </code></pre> <p>I read through all tutorials and all I get out of it is, that it should work but it doesn't. Anyway, when I switch to android 2.2 (which is no solution for now) and I use the new constructor, where I only need to hand in the activity class and not the pkg string the emulator will run the tests without complaining.</p> <p>But there has to be a way to get this running in android 2.1!</p> <p><strong>In addition</strong> These are my two Manifest.xml files. The first one, is the one of the application itself. The other one is the one of the test project.</p> <p><strong>Application Manifest.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.sap.catalogue" android:versionCode="1" android:versionName="1.0"&gt; &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt; &lt;activity android:name=".Catalogue" android:label="@string/app_name"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name=".activities.CategoryBrowser"&gt;&lt;/activity&gt; &lt;activity android:name=".activities.ProductDetails"&gt;&lt;/activity&gt; &lt;activity android:name=".activities.ProductSearch"&gt;&lt;/activity&gt; &lt;activity android:name=".activities.ProductView"&gt;&lt;/activity&gt; &lt;activity android:name=".activities.SupplierSelection"&gt;&lt;/activity&gt; &lt;/application&gt; &lt;uses-sdk android:minSdkVersion="7" /&gt; &lt;uses-permission android:name="android.permission.INTERNET"&gt;&lt;/uses-permission&gt; &lt;/manifest&gt; </code></pre> <p><strong>Test Manifest.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.sap.catalogue.test" android:versionCode="1" android:versionName="1.0"&gt; &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt; &lt;uses-library android:name="android.test.runner" /&gt; &lt;/application&gt; &lt;uses-sdk android:minSdkVersion="7" /&gt; &lt;instrumentation android:targetPackage="com.sap.catalogue" android:name="android.test.InstrumentationTestRunner" /&gt; &lt;/manifest&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload