Home Ask Login Register

Developers Planet

Your answer is one click away!

user5599934 February 2016

Espresso Instrumentation Tests - how to uninstall or delete the app after the test

I setup Espresso instrumentation framework to run my Android Functional Automation tests. For every test, I want to login to the app and delete the app after I finish the test.

So, I setup something like below:

public class FirstSampleTest extends BaseTest {

private final BaseTest baseTest;

// private final ElementUtils elementUtils;

public FirstSampleTest() throws InterruptedException {
    this.baseTest = new BaseTest();

public void initiate() throws InterruptedException {
    //I have setup login method here to login to the app after it installs

public ActivityTestRule<SplashScreenActivity> splashScreenActivityActivityTestRule = new ActivityTestRule(SplashScreenActivity.class);

public void testTheHomeScreen() throws InterruptedException {
   //Some tests go here. 

public void teardown() throws InterruptedException {
    //I want to uninstall the app or delete it from the emulator once the test is run 



user5599934 February 2016

Uninstalling the app from the Instrumentation tests is not possible. However, once all the tests are run, the app is uninstalled automatically.

Post Status

Asked in February 2016
Viewed 3,388 times
Voted 12
Answered 1 times


Leave an answer

Quote of the day: live life