在 Android 项目中:- 在我的应用程序中有很多图像,我必须验证它们,我如何使用断言

发布于 2024-12-17 22:35:52 字数 207 浏览 4 评论 0原文

在 Robotium 中:- 我正在使用 Solo 类编写自动化脚本。现在我必须验证我的应用程序中的图像。

对于文本,我们可以使用Assert.assertTrue(solo.searchText("rtf"));

对于图像,Robotium Solo中有什么命令吗?班级?

In Robotium :- I am writing automation scripts using Solo class. Now i have to verify the images in my application.

For texts we can use Assert.assertTrue(solo.searchText("rtf"));

For images, is there any command in Robotium Solo Class?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

红墙和绿瓦 2024-12-24 22:35:52

并不真地。大多数建议的测试 ImageViews 的方法(其含义可能有所不同)如下:

  • 在测试代码中,在 ImageView 标记中设置您稍后要检查的内容。例如可绘制资源 ID。
  • 在测试代​​码中,获取您在标记中设置的任何内容,并验证它是否具有预期值。

另外,您可能还想查看此讨论 使用其他方法来目视检查图像。

Not really. Most suggested way to test (its meaning may vary) ImageViews is given by:

  • In code under test, set something in the ImageView tag that you want to check later. E.g. the drawable resource Id.
  • In test code, get whatever you set in the tag, and verify it has the expected value.

Also, you may want to have a look at this discussion on some other method to visually check the image.

带上头具痛哭 2024-12-24 22:35:52

您可以尝试以下操作:

assertTrue(solo.getCurrentActivity().getResources().getDrawable(R.drawable.logo).isVisible());

了解更多:https://stackoverflow.com/a/26114862

You can try this:

assertTrue(solo.getCurrentActivity().getResources().getDrawable(R.drawable.logo).isVisible());

For more: https://stackoverflow.com/a/26114862

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文