安卓& Robotium - waitForActivity 在它应该失败的时候不会失败?
solo.clickOnButton("Login");
solo.waitForActivity("activityThatDoesntExist", 20000);
应用程序导航到名为“HomePageActivity”的活动,但即使活动名称不正确,测试也会通过?为什么会通过?
solo.clickOnButton("Login");
solo.waitForActivity("activityThatDoesntExist", 20000);
application navigates to an activity named "HomePageActivity", but the test passes even though the activity name is incorrect? Why does it pass?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当超时时间内未找到 Activity 时,waitForActivity() 返回“false”。
waitForActivity() returns 'false' when the Activity isn't found within the timeout period.
为了确保在预期活动没有出现的情况下测试用例不会通过,我通常添加 assertTrue 方法。例如:
因此,当预期的活动不存在时,您可以捕获 AssertionFailedError 来使您的案例失败。
To make sure the test cases won't pass in case the expected activity doesn't show up, I usually add assertTrue method. like:
So when the expected activity doesn't exist, you can catch AssertionFailedError to fail your case.