Unit Tests

by Keean Schupke » Thu, 17 Dec 2009 21:13:15 GMT


Sponsored Links
 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.

--



Unit Tests

by Keean Schupke » Fri, 18 Dec 2009 00:28:45 GMT


 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:13pm, Keean Schupke <keean.schu...@googlemail.com>



--


Sponsored Links


Other Threads

1. g 1 accelerometer

Where do I find stuff about the g 1 accelerometer in the API?
--~--~---------~--~----~------------~-------~--~----~

2. Ethernet over USB

I would like to communicate between the G1 and another Linux processor
using TCP/IP over the USB.  Has anyone done this?  I tried plugging in
a USB-Ethernet converter cable with no success.  Any help would be
appreciated!
--~--~---------~--~----~------------~-------~--~----~

3. package isn鈥檛 signed correctl y error on customer install - Market problem??

4. Keep Screen On & Change Orientation

5. Webkit Browser Java Plugin Support

6. Install Failed because of Insufficient storage? I got plenty, what gives?

7. Wifi based location