2013-04-30 4 views
0

Google 설명서에 설명 된대로 JUnit3 및 UiAutomatorTestCase 클래스를 사용하여 Android 앱의 GUI를 테스트하고 싶습니다.간단한 Android GUI 테스트에서 TestClass를 찾을 수 없습니다.

Eclipse에서 새로운 Android 테스트 프로젝트를 만들고 정말 간단한 테스트 클래스를 추가했습니다.이 클래스는 홈 버튼을 누르고 메뉴를 열어야합니다.

import com.android.uiautomator.core.UiObject; 
import com.android.uiautomator.core.UiObjectNotFoundException; 
import com.android.uiautomator.core.UiSelector; 
import com.android.uiautomator.testrunner.UiAutomatorTestCase; 

import junit.framework.TestCase; 

public class SomeTest extends UiAutomatorTestCase { 

    public void testDemo() throws UiObjectNotFoundException { 

      // Simulate a short press on the HOME button. 
      getUiDevice().pressHome(); 

      // We’re now in the home screen. Next, we want to simulate 
      // a user bringing up the All Apps screen. 
      // If you use the uiautomatorviewer tool to capture a snapshot 
      // of the Home screen, notice that the All Apps button’s 
      // content-description property has the value “Apps”. We can 
      // use this property to create a UiSelector to find the button. 
      UiObject allAppsButton = new UiObject(new UiSelector() 
      .description("Apps")); 

      // Simulate a click to bring up the All Apps screen. 
      allAppsButton.clickAndWaitForNewWindow(); 
    } 

} 

지금까지는 그렇게 좋았습니다. 내가 에뮬레이터에서이 테스트를 실행할 때 지금, 그것은 다음과 같은 오류로 실행 :

04-30 08:38:31.900: E/Trace(1839): error opening trace file: No such file or directory (2) 
04-30 08:38:31.996: E/AndroidRuntime(1839): FATAL EXCEPTION: main 
04-30 08:38:31.996: E/AndroidRuntime(1839): java.lang.RuntimeException: Exception thrown in onCreate() of ComponentInfo{com.some.wit.android.test/android.test.InstrumentationTestRunner}: java.lang.RuntimeException: Could not find test class. Class: com.some.wit.android.test.SomeTest 
04-30 08:38:31.996: E/AndroidRuntime(1839):  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4385) 
04-30 08:38:31.996: E/AndroidRuntime(1839):  at android.app.ActivityThread.access$1300(ActivityThread.java:141) 
04-30 08:38:31.996: E/AndroidRuntime(1839):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294) 
04-30 08:38:31.996: E/AndroidRuntime(1839):  at android.os.Handler.dispatchMessage(Handler.java:99) 
04-30 08:38:31.996: E/AndroidRuntime(1839):  at android.os.Looper.loop(Looper.java:137) 
04-30 08:38:31.996: E/AndroidRuntime(1839):  at android.app.ActivityThread.main(ActivityThread.java:5041) 
04-30 08:38:31.996: E/AndroidRuntime(1839):  at java.lang.reflect.Method.invokeNative(Native Method) 
04-30 08:38:31.996: E/AndroidRuntime(1839):  at java.lang.reflect.Method.invoke(Method.java:511) 
04-30 08:38:31.996: E/AndroidRuntime(1839):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
04-30 08:38:31.996: E/AndroidRuntime(1839):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 
04-30 08:38:31.996: E/AndroidRuntime(1839):  at dalvik.system.NativeStart.main(Native Method) 
04-30 08:38:31.996: E/AndroidRuntime(1839): Caused by: java.lang.RuntimeException: Could not find test class. Class: com.some.wit.android.test.SomeTest 
04-30 08:38:31.996: E/AndroidRuntime(1839):  at android.test.AndroidTestRunner.runFailed(AndroidTestRunner.java:254) 
04-30 08:38:31.996: E/AndroidRuntime(1839):  at android.test.AndroidTestRunner.loadTestClass(AndroidTestRunner.java:88) 
04-30 08:38:31.996: E/AndroidRuntime(1839):  at android.test.AndroidTestRunner.setTestClassName(AndroidTestRunner.java:49) 
04-30 08:38:31.996: E/AndroidRuntime(1839):  at android.test.suitebuilder.TestSuiteBuilder.addTestClassByName(TestSuiteBuilder.java:80) 
04-30 08:38:31.996: E/AndroidRuntime(1839):  at android.test.InstrumentationTestRunner.parseTestClass(InstrumentationTestRunner.java:444) 
04-30 08:38:31.996: E/AndroidRuntime(1839):  at android.test.InstrumentationTestRunner.parseTestClasses(InstrumentationTestRunner.java:425) 
04-30 08:38:31.996: E/AndroidRuntime(1839):  at android.test.InstrumentationTestRunner.onCreate(InstrumentationTestRunner.java:370) 
04-30 08:38:31.996: E/AndroidRuntime(1839):  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4382) 
04-30 08:38:31.996: E/AndroidRuntime(1839):  ... 10 more 

JUnit3 및 UIAutomator이 프로젝트에 추가됩니다. 내 실수는 여기 보지 못하니?

답변

2

Manifest.xml에 파일 이름 넣기

+0

입니다. Mirco

관련 문제