gpt4 book ai didi

java - 使用 Robotium 进行 junit 测试时出现 AssertionFailedError

转载 作者:行者123 更新时间:2023-12-01 14:59:39 25 4
gpt4 key购买 nike

我在每次测试中都不断遇到以下异常,但我不明白为什么。希望有人能提供一些见解。

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

-----结束异常-----

最佳答案

您已输入要返回的 Activity 的正确名称。我认为您的 Activity 的名称是 MainActivity 而不是 mainActivity。

关于java - 使用 Robotium 进行 junit 测试时出现 AssertionFailedError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13856547/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com