- java.lang.NoClassDefFoundError: com.jayway.android.robotium.solo.Solo
- at com.example.RobotiumTest.TestMsm.setUp(TestMsm.java:41)
- at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:190)
- at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:175)
- at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
- at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1584)
- <?xml version="1.0" encoding="utf-8"?>
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.RobotiumTest"
- android:versionCode="1"
- android:versionName="1.0">
- <uses-sdk android:minSdkVersion="10" />
- <instrumentation android:targetPackage="com.android.mms" android:name="android.test.InstrumentationTestRunner" />
- <application android:icon="@drawable/ic_launcher" android:label="@string/app_name">
- <uses-library android:name="android.test.runner" />
- </application>
- </manifest>
- package com.example.RobotiumTest;
- import android.test.ActivityInstrumentationTestCase2;
- import com.jayway.android.robotium.solo.Solo;
- public class TestMsm extends ActivityInstrumentationTestCase2{
- private Solo solo;
- private static final String TARGET_PACKAGE_ID = "com.android.mms";
- private static final String LAUNCHER_ACTIVITY_FULL_CLASSNAME="com.android.mms.ui.ConversationList";
- private static Class<?> launcherActivityClass;
- static{
- try{
- launcherActivityClass= Class.forName(LAUNCHER_ACTIVITY_FULL_CLASSNAME);
- }catch(ClassNotFoundException e){
- throw new RuntimeException(e);
- }
- }
- public TestMsm() throws ClassNotFoundException{
- super(TARGET_PACKAGE_ID,launcherActivityClass);
- }
- public void setUp()throws Exception {
- solo=new Solo(getInstrumentation(), getActivity());
- }
- public void tearDown()throws Exception{
- try{
- solo.finalize();
- }catch(Throwable e){
- e.printStackTrace();
- }
- getActivity().finish();
- super.tearDown();
- }
- public void testSendSMS(){
- try{
- solo.clickOnScreen(50,770 );
- solo.enterText(0, "10010");
- solo.enterText(1, "test");
- solo.clickOnScreen(430,770 );
- solo.sleep(2000);
- solo.goBack();
- solo.waitForDialogToClose(1000);
- }catch(Exception e){
- System.out.println("Exception captured!");
- e.printStackTrace();
- }
- }
- }
参考:http://code.google.com/p/robotium/