如何在Android中使用Robotium编写测试用例方法



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

该活动类包含android市场中应用程序的许可证检查,还显示3秒的启动屏幕。在这里,我想测试一下在Android中使用Robotium工具显示启动屏幕和检查许可证的活动。

所以请告诉我怎么做。

要测试你的启动屏幕是否显示,如果你在设置方法中设置了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());
}

最新更新