Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8967423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:14:22+00:00 2026-06-15T17:14:22+00:00

I’m trying to setup JUnit to test my activities for an android project. The

  • 0

I’m trying to setup JUnit to test my activities for an android project.

The Android Project runs ok on both an AVD and a device (there are still a few bugs left, which is why I want to add a few unit tests)

I followed the steps from these websites (they are more or less the same, but I still checked all of them just to make sure I did everything correctly)
http://mobile.tutsplus.com/tutorials/android/android-sdk-junit-testing/
http://developer.android.com/tools/testing/testing_eclipse.html

I created a test project using the same workspace as my project, and created my first test case. When I tried to run the test, I got the following:

[2012-12-09 19:42:56 – AssassinTest] Android Launch!
[2012-12-09 19:42:56 – AssassinTest] adb is running normally.
[2012-12-09 19:42:56 – AssassinTest] Performing android.test.InstrumentationTestRunner JUnit launch
[2012-12-09 19:42:56 – AssassinTest] Automatic Target Mode: Preferred AVD ‘Google_Level10′ is available on emulator ’emulator-5554′
[2012-12-09 19:42:56 – AssassinTest] Uploading AssassinTest.apk onto device ’emulator-5554′
[2012-12-09 19:42:57 – AssassinTest] Installing AssassinTest.apk…
[2012-12-09 19:42:59 – AssassinTest] Success!
[2012-12-09 19:42:59 – AssassinTest] Project dependency found, installing: Assassin
[2012-12-09 19:43:01 – Assassin] Application already deployed. No need to reinstall.
[2012-12-09 19:43:01 – AssassinTest] Launching instrumentation android.test.InstrumentationTestRunner on device emulator-5554
[2012-12-09 19:43:01 – AssassinTest] Collecting test information
[2012-12-09 19:43:04 – AssassinTest] Test run failed: Instrumentation run failed due to ‘java.lang.ClassNotFoundException’

And here is what I get from LogCat:

12-09 19:43:02.929: E/dalvikvm(1255): Unable to resolve Ludes/assassi/test/InGameActivityTest; annotation class 19
12-09 19:43:02.929: D/AndroidRuntime(1255): Shutting down VM
12-09 19:43:02.929: W/dalvikvm(1255): threadid=1: thread exiting with uncaught exception (group=0x40015560)
12-09 19:43:02.961: E/AndroidRuntime(1255): FATAL EXCEPTION: main
12-09 19:43:02.961: E/AndroidRuntime(1255): java.lang.NoClassDefFoundError: org.junit.Test
12-09 19:43:02.961: E/AndroidRuntime(1255):     at java.lang.reflect.Method.getDeclaredAnnotations(Native Method)
12-09 19:43:02.961: E/AndroidRuntime(1255):     at java.lang.reflect.Method.getDeclaredAnnotations(Method.java:262)
12-09 19:43:02.961: E/AndroidRuntime(1255):     at java.lang.reflect.AccessibleObject.getAnnotations(AccessibleObject.java:188)
12-09 19:43:02.961: E/AndroidRuntime(1255):     at java.lang.reflect.AccessibleObject.getAnnotation(AccessibleObject.java:196)
12-09 19:43:02.961: E/AndroidRuntime(1255):     at android.test.suitebuilder.TestMethod.getAnnotation(TestMethod.java:60)
12-09 19:43:02.961: E/AndroidRuntime(1255):     at android.test.suitebuilder.annotation.HasMethodAnnotation.apply(HasMethodAnnotation.java:39)
12-09 19:43:02.961: E/AndroidRuntime(1255):     at android.test.suitebuilder.annotation.HasMethodAnnotation.apply(HasMethodAnnotation.java:30)
12-09 19:43:02.961: E/AndroidRuntime(1255):     at com.android.internal.util.Predicates$OrPredicate.apply(Predicates.java:106)
12-09 19:43:02.961: E/AndroidRuntime(1255):     at android.test.suitebuilder.annotation.HasAnnotation.apply(HasAnnotation.java:42)
12-09 19:43:02.961: E/AndroidRuntime(1255):     at android.test.suitebuilder.annotation.HasAnnotation.apply(HasAnnotation.java:31)
12-09 19:43:02.961: E/AndroidRuntime(1255):     at com.android.internal.util.Predicates$NotPredicate.apply(Predicates.java:122)
12-09 19:43:02.961: E/AndroidRuntime(1255):     at android.test.suitebuilder.TestSuiteBuilder.satisfiesAllPredicates(TestSuiteBuilder.java:254)
12-09 19:43:02.961: E/AndroidRuntime(1255):     at android.test.suitebuilder.TestSuiteBuilder.build(TestSuiteBuilder.java:184)
12-09 19:43:02.961: E/AndroidRuntime(1255):     at android.test.InstrumentationTestRunner.onCreate(InstrumentationTestRunner.java:373)
12-09 19:43:02.961: E/AndroidRuntime(1255):     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3246)
12-09 19:43:02.961: E/AndroidRuntime(1255):     at android.app.ActivityThread.access$2200(ActivityThread.java:117)
12-09 19:43:02.961: E/AndroidRuntime(1255):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:969)
12-09 19:43:02.961: E/AndroidRuntime(1255):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-09 19:43:02.961: E/AndroidRuntime(1255):     at android.os.Looper.loop(Looper.java:130)
12-09 19:43:02.961: E/AndroidRuntime(1255):     at android.app.ActivityThread.main(ActivityThread.java:3683)
12-09 19:43:02.961: E/AndroidRuntime(1255):     at java.lang.reflect.Method.invokeNative(Native Method)
12-09 19:43:02.961: E/AndroidRuntime(1255):     at java.lang.reflect.Method.invoke(Method.java:507)
12-09 19:43:02.961: E/AndroidRuntime(1255):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
12-09 19:43:02.961: E/AndroidRuntime(1255):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
12-09 19:43:02.961: E/AndroidRuntime(1255):     at dalvik.system.NativeStart.main(Native Method)
12-09 19:43:02.961: E/AndroidRuntime(1255): Caused by: java.lang.ClassNotFoundException: org.junit.Test in loader dalvik.system.PathClassLoader[/system/framework/com.google.android.maps.jar:/system/framework/android.test.runner.jar:/data/app/udes.assassin.test-1.apk:/data/app/udes.assassin-2.apk]
12-09 19:43:02.961: E/AndroidRuntime(1255):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
12-09 19:43:02.961: E/AndroidRuntime(1255):     at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
12-09 19:43:02.961: E/AndroidRuntime(1255):     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
12-09 19:43:02.961: E/AndroidRuntime(1255):     ... 25 more

While searching on a few forums, I read that this might be caused by a bad manifest file, but I don’t see what is wrong with mine

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="udes.assassin.test"
android:versionCode="1"
android:versionName="1.0" >

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

<instrumentation
    android:name="android.test.InstrumentationTestRunner"
    android:targetPackage="udes.assassin" />

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

And finally, this is the code in my only JUnit class (so far)

package udes.assassin.test;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import udes.assassin.InGameActivity;
import android.test.ActivityInstrumentationTestCase2;

public class InGameActivityTest 
        extends ActivityInstrumentationTestCase2<InGameActivity> {

    public InGameActivityTest() {
        super("udes.assassin", InGameActivity.class);
    }

    public InGameActivityTest(Class<InGameActivity> activityClass) {
        super(activityClass);
    }

    @Before
    protected void setUp() throws Exception {
        super.setUp();
    }

    @Test
    public void testSetItemPosition() {
        fail("Not yet implemented");
    }
}

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:14:24+00:00Added an answer on June 15, 2026 at 5:14 pm

    It is probably because JUnit is not in your classpath. Go to Project -> Properties -> Java Build Path -> Order and Export and check if the JUnit box is unchecked.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to select an H1 element which is the second-child in its group
I know there's a lot of other questions out there that deal with this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.