saurav
saurav

Reputation: 5946

Could not find test class exception when running Android Junit

i am trying to run my test class as Android Junit Test through Eclipse and then its giving could not find test class excpetion.

I have properly mentioned the intrumentation target package to my productive code package.

Below is the android manifest

<?xml version="1.0" encoding="utf-8"?>

<uses-sdk android:minSdkVersion="15" />

<instrumentation
    android:name="android.test.InstrumentationTestRunner"
    android:targetPackage="com.abc.android" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <uses-library android:name="android.test.runner" />
</application>

I have also checked by build path, its properly including the target classes such that the class file could be found.

Not able to find what is the problem.

Thanks and Regards, Saurav

Upvotes: 1

Views: 1078

Answers (2)

saurav
saurav

Reputation: 5946

I removed my project and got the latest version from my source code repo.

Then i ran my tests it did work.

But would like to know why the problem was there.

Where does Android junit test picks it classes when running from Eclipse ?...i presume its bin/classes which is in the build path...can not figure out on what is the problem

Upvotes: 1

Raquibul Bari
Raquibul Bari

Reputation: 53

Did you check if you are setting up properly? See this link http://developer.android.com/tools/testing/activity_test.html

Also you can think of using Robotium for testing. https://code.google.com/p/robotium/

Upvotes: 0

Related Questions