【问题标题】:In Android Project :- In my application there are lots of images, i have to verify them, How can i use Assertion在 Android 项目中:- 在我的应用程序中有很多图像,我必须验证它们,我如何使用断言
【发布时间】:2012-01-05 12:03:04
【问题描述】:

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

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

对于图片,Robotium Solo Class中有什么命令吗?

【问题讨论】:

  • 运气好能解决这个问题吗?

标签: android automation robotium


【解决方案1】:

不是真的。 测试的最推荐方法(其含义可能有所不同)ImageViews由以下给出:

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

另外,您可能想看看this discussion 的其他方法来直观地检查图像。

【讨论】:

    【解决方案2】:

    你可以试试这个:

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

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

    【讨论】:

      猜你喜欢
      • 2016-06-18
      • 1970-01-01
      • 2013-09-07
      • 1970-01-01
      • 2018-02-27
      • 1970-01-01
      • 2017-11-05
      • 2020-03-03
      • 1970-01-01
      相关资源
      最近更新 更多