2012-12-13 115 views
0

我在每次測試中都會收到以下異常,我無法弄清楚原因。希望有人有一些洞察力。AsterionFailedError junit與Robotium測試

----- begin exception ----- 
junit.framework.AssertionFailedError: 
Activity named mainActivity can not be returned to 
at junit.framework.Assert.fail(Assert.java:47) 
at junit.framework.Assert.assertTrue(Assert.java:20) 
at com.jayway.android.robotium.solo.ActivityUtils.goBackToActivity(ActivityUtils.java:185) 
at com.jayway.android.robotium.solo.Solo.goBackToActivity(Solo.java:1864) 
at com.package.test.AppointmentSettingTestBase.tearDown(AppointmentSettingTestBase.java:64) 
at junit.framework.TestCase.runBare(TestCase.java:130) 
at junit.framework.TestResult$1.protect(TestResult.java:106) 
at junit.framework.TestResult.runProtected(TestResult.java:124) 
at junit.framework.TestResult.run(TestResult.java:109) 
at junit.framework.TestCase.run(TestCase.java:118) 
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169) 
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154) 
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:525) 
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1547) 

末----- -----例外

回答

1

你必須寫上你要回到活動的正確名稱。我認爲你的活動的名稱是MainActivity,而不是mainActivity。