开发者

How to write a test case method using Robotium in Android

I am writing a test case class for one of the activity in my application.

That Activity class contains license checking for the application in android market and also displays the splash screen for 3 seconds. Here I would like to test that activity is displaying the splash screen and checking the l开发者_如何学Goicense using Robotium instrumentation in Android.

So please tell me how to do this.


To test that your splash screen is shown, you can try this, if you have set up robotium in your setup method, and named it 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());
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜