开发者

How to write a test case method using Robotium in Android

开发者 https://www.devze.com 2023-03-13 07:12 出处:网络
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

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

精彩评论

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

关注公众号