mercredi 27 septembre 2017

What kind of test is this? Android

I have seen some videos where it explains how to test the call of an ativity by another ativity. I did the following test and after some reflection I was not sure if this test I performed is integration, instrumentation or functional test. Someone can help me?

public class OneActivityTest {

    private OneActivity mActivity = null;

    @Rule
    public ActivityTestRule<OneActivity> mActivityTestRule = new ActivityTestRule<>(OneActivity.class);

    Instrumentation.ActivityMonitor monitor = getInstrumentation().addMonitor(TwoActivity.class.getName(), null, false);

    @Before
    public void setUp() {
        mActivity = mActivityTestRule.getActivity();
    }

    @Test
    public void checkYes() {

        Assert.assertNotNull(mActivity.findViewById(R.id.checkbox_sim));

        onView(withId(R.id.checkbox_sim)).perform(click());

        Assert.assertNotNull(mActivity.findViewById(R.id.save));

        onView(withId(R.id.save)).perform(click());

        Activity secondActivity = getInstrumentation().waitForMonitorWithTimeout(monitor, 5000);

        Assert.assertNotNull(secondActivity);

        secondActivity.finish();
    }
}

Aucun commentaire:

Enregistrer un commentaire