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. Power management in Android

I couldn't find some stuff about power measurement/management in
Android/G1. I wonder if Android application can access power related
values like current battery drain rate, or Android kernel supports
ACPI. Is there any reference or document for those things?

Thanks.

--~--~---------~--~----~------------~-------~--~----~

2. Moving screen

Hi developers ...........


       I want to create a moving background in my application. Can
anyone help me. Thanks in advance. please help me.
--~--~---------~--~----~------------~-------~--~----~

3. Multiple alarms - Intent aims at the same service but different values - Not possible?

4. Porting android to omap 3530evm

5. A question about opencore file open

6. Android Market place stats

7. Multiple alarms - Intent aims at the same service but different values - Not possible?