Found the problem, in the AndroidManifest:

<uses-library name="android.test.runner"/>

should be:

<uses-library android:name="android.test.runner"/>


Cheers,
Keean.


On Dec 17, 1:13 pm, Keean Schupke <[email protected]>
wrote:
> Hi,
>
> I am having problems with the Unit test framework. I have the
> following files in the "tests" directory:
>
> AndroidManifest.xml
>
> <?xml version="1.0" encoding="utf-8"?>
> <manifest xmlns:android="http://schemas.android.com/apk/res/android";
>     package="com.fryit.pkh.tests"
>     >
>
>     <application>
>         <uses-library name="android.test.runner"/>
>     </application>
>
>     <instrumentation
> android:name="android.test.InstrumentationTestRunner"
>         android:targetPackage="com.fryit.pkh"
>         android:label="Unit Tests"
>     />
> </manifest>
>
> src/com/fryit/pkh/AllTests.java:
> ----------------------------------------
>
> package com.fryit.pkh;
>
> 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();
>     }
>
> }
>
> src/com/fryit/pkh/test/SanityTest.java:
> -------------------------------------------------
>
> package com.fryit.pkh.test;
>
> import junit.framework.Assert;
>
> import android.test.AndroidTestCase;
> import android.test.suitebuilder.annotation.SmallTest;
>
> public class SanityTest extends AndroidTestCase {
>     @SmallTest public void testSimpleAssert() throws Exception {
>         assertTrue(true);
>     }
>
> }
>
> After installing both the main app "com.fryit.pkh" and the tests
> "com.fryit.pkh.tests", I try to run the tests, but get the following
> error:
>
> $ adb -e shell am instrument -w com.fryit.pkh.tests/
> android.test.InstrumentationTestRunner
> INSTRUMENTATION_RESULT: shortMsg=Unable to instantiate instrumentation
> ComponentInfo{com.fryit.pkh.tests/
> android.test.InstrumentationTestRunner}:
> java.lang.ClassNotFoundException:
> android.test.InstrumentationTestRunner in loader
> dalvik.system.pathclassloa...@44e7a8b8
> INSTRUMENTATION_RESULT: longMsg=java.lang.RuntimeException: Unable to
> instantiate instrumentation ComponentInfo{com.fryit.pkh.tests/
> android.test.InstrumentationTestRunner}:
> java.lang.ClassNotFoundException:
> android.test.InstrumentationTestRunner in loader
> dalvik.system.pathclassloa...@44e7a8b8
> INSTRUMENTATION_CODE: 0
>
> Where am I going wrong?
>
> Regards,
> Keean.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to