Sunday, April 14, 2013

Calabash Android - Testing start of an activity

Normally the first test you might write in calabash is to test the start of an activity.
For example consider that your app has a button(with text "Test"), and is configured to call 'launchTestActivity' onClick.

Android code to start the activity :

public void launchTestActivity(View view) {
startActivity(new Intent(this, TestActivity.class));
}
view raw gistfile1.java hosted with ❤ by GitHub

Now to test this, you need to write the below Calabash feature :

Feature: Main page
Scenario: Verify that TestActivty is opened on Test click
Given I press "Test"
Then I wait for the "TestActivity" screen to appear

2 comments:

  1. Is it possible to start a Service this way?

    ReplyDelete
  2. Is it possible to start a Service this way?

    ReplyDelete