【问题标题】:How to write a test case method using Robotium in Android如何在 Android 中使用 Robotium 编写测试用例方法
【发布时间】:2011-06-14 10:02:29
【问题描述】:

我正在为我的应用程序中的一项活动编写测试用例类。

该 Activity 类包含 android market 中应用程序的许可证检查,并显示启动屏幕 3 秒。在这里,我想测试该活动是否显示初始屏幕并使用 Android 中的 Robotium 工具检查许可证。

所以请告诉我该怎么做。

【问题讨论】:

    标签: android junit4 robotium


    【解决方案1】:

    要测试你的启动画面是否显示,你可以试试这个,如果你在你的设置方法中设置了robotium,并把它命名为solo:

    public void testSplash() {
      assertNotNull(solo.getCurrentActivity().findViewById( "the id of the splash" ));
    }
    
    public void testLicense() {
      String licence = "my licence";
      assertEquals(licence, (MyActivity) solo.getCurrentActivity().getLicence());
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-09-21
      • 2014-02-19
      • 1970-01-01
      • 2023-03-08
      • 1970-01-01
      • 1970-01-01
      • 2023-02-17
      • 1970-01-01
      相关资源
      最近更新 更多