Do I have to run Android Application every time I want to run Android Tests?

Say that I have a simple class

public class GoogleCalendarService implements CalendarService {

    @Override

    public boolean login() {

        return false;

    }

}


and a test for it

public class CalendarServiceTest extends TestCase {

    public void testLogin() throws Exception {

        CalendarService service = new GoogleCalendarService();

        assertTrue("Login failed", service.login());

    }

}


When I run the application first to deploy it to the emulator and then run tests via Android Test configuration, the test fails as expected. However if I change the method to


    public boolean login() {
        return true;
    }


and run the test again, it still fails, because the updated version of the application wasn't deployed to the emulator. I have to manually run Android Application and then run the tests. So basically every time I change something in the app and I want to test it, I have to run the Android Application first to deploy it.

I didn't find any option that would make the app deploy automatically when I run my tests. Am I missing something?

I'm currently using IdeaX 98.402.

Please sign in to leave a comment.