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?
Possible duplicate of Tests, TDD, Unit Test, QA and similar. What is the difference between concepts on tests?
– Bruno Costa
I believe it is not duplicate. AP wants to identify a type of test from a code snippet.
– vinibrsl
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
– Nokas
Seriously Nokas? What the class name
Instrumentation.ActivityMonitor
, that you’re using, tells you?– ramaral
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
– Nokas
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
– Nokas
according to what it says in this text, then integration tests are considered instrumentation tests?
– Nokas