简体   繁体   English

与Robotium进行junit测试时出现AssertionFailedError

[英]AssertionFailedError on junit test with Robotium

I keep getting the following exception on every test and I can't figure out why. 在每次测试中,我都会不断收到以下异常,但我不知道为什么。 Hoping someone has some insight. 希望有人有见识。

 ----- 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)

----- end exception ----- -----结束例外-----

You have write the correct name of the Activity you want to go back to. 您已输入要返回的活动的正确名称。 I think the name of your activity is MainActivity and not mainActivity. 我认为您的活动名称是MainActivity,而不是mainActivity。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM