An instrumentation test is an integration test?

Asked

Viewed 301 times

5

I saw some videos where they explain how to test the call of an activity by another activity.

I took the following test and, after a reflection, I wasn’t sure if the test I ran was for integration, instrumentation or functional testing.

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();
    }
}

It can be considered Integration Test simply by interacting with more than 1 Activity?

  • 1
  • 1

    I believe it is not duplicate. AP wants to identify a type of test from a code snippet.

  • I appreciate already the attempt to help, but as I mentioned above I saw some explanations and I do not even understand what kind of test I implemented...I analyzed what you suggested and my doubt remains @Bruno Costa

  • Seriously Nokas? What the class name Instrumentation.ActivityMonitor, that you’re using, tells you?

  • I understand what you want to tell me @ramaral, but all the information I’ve read is confusing enough. I show in the comment below the confusion that I find myself in this moment

  • Android integration tests - Android Studio separates the different testing groups for Android platform applications. And this separation can be done as follows: Unit Tests: run on the JVM (Java Virtual Machine), do not access the real Android API and therefore do not require an Instrumentation Tests emulator: access the real Android API and, therefore, they need an emulator to be available

  • according to what it says in this text, then integration tests are considered instrumentation tests?

Show 2 more comments

1 answer

2


Integration tests are intended to verify that the result of the interaction between the different parts/components of the application is as expected.

The instrumental tests aim to simulate user interaction, via UI, with the application.
They check whether, at a given action in the UI, the application responds as expected.
In doing so, they test the integration of the UI with the rest of the application and are therefore integration tests.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.