I have made a simple app that allows you to choose an option from a list of radio buttons and proceed to the next activity using the next button. I'm also using Espresso to test my app. My question is, how do I write test cases such that they are dependent on one another. Example - I want test case B to run only if test case A is successful. If A fails, I don't want B to get executed. Is this possible?
public class QuestionnaireTest {
@Rule
public ActivityTestRule<QuestionnaireActivity> testRule = new ActivityTestRule<>(QuestionnaireActivity.class);
@Test //Test Case A
public void testDeviceDisplayed() {
onView(withId(R.id.btnDevice2)).perform(click());
}
@Test //Test Case B
public void testDeviceChecked(){
onView(withId(R.id.btnDevice2)).check(matches(isChecked()));
}
}
Aucun commentaire:
Enregistrer un commentaire