Testing activity flow with robotium

0
0

I want to test some flow using robotium

my flow has to go through several activities, and do some assertions in the middle

my problem is, that once the activity changes, the test ends successfully

how do i test going through several activities in 1 test?

i am using robotium 5.0.1

  • You must to post comments
0
0

Its quite simple to achieve. You can fire event and check result using assert API inside one method

public void testAllActivity(){
Solo solo = new Solo(getInstrumentation(), getActivity());
// View1 is a view that is lying in Activity1
solo
.clickOnButton(view1);
// Put a delay so that you testing with assert doesn't fail.
solo
.waitForActivity("Activity2");
solo
.assertCurrentActivity("<Error Message>","Activity2.class");
// View2 is a view that is lying in Activity2
solo
.clickOnButton(view1);
// Put a delay so that you testing with assert doesn't fail.
solo
.waitForActivity("Activity3");
solo
.assertCurrentActivity("<Error Message>","Activity3.class");
}

Thats it and you are done in one go.

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website