Why does Espresso leave the application after completing the test? How to stop it from this

In Android Studio, in the androidTest folder, I have this test case:

@RunWith(AndroidJUnit4.class) @LargeTest public class LoginActivityTest { @Rule public ActivityTestRule<LoginActivity> activityTestRule = new ActivityTestRule<>(LoginActivity.class); @Test public void teamsListIsSortedAlphabetically() { onView(withId(R.id.etEmail)).perform(click(), replaceText(" asd@asd.vf ") ); onView(withId(R.id.etPassword)).perform(click(), replaceText("asdasd") ); onView(withId(R.id.bLoginSubmit)).perform(click()); } } 

The application launches LoginActivity, logs in, the next action is displayed for 1-2 seconds, and then it leaves the action, leaving me on the launch screen. How to make Espresso stay on this screen?

+7
source share
1 answer

Sorry, but this is not possible.

Please read this Google link: Automating UI Tests

Espresso, Robotium, Calabash, and other UI test environments were created for short interaction testing events. It imitates the behavior of a specific user - run the application, do some tricks and (if successful) close the application.

Of course, Espresso allows you to create your own idle resources and then register them in the app.

The easiest way to put a test to sleep at a specific time is to use the Thread.sleep(time_in_miliseconds) method, but, as I said, this contradicts the idea of โ€‹โ€‹automatic testing.

+10
source

All Articles