Automatically run tests before creating an application in Android Studio

I wrote two test cases of LoginTest and SignUpTest using JUnit and the SessionUnitTestSuite test suite. Every time I want to create and run my application, I need to run a test package (by selecting Test Suite and then clicking "Run") before and, if the test passes, start my application (by selecting the application module and then click "Run") .

Is there a way to automatically run tests before running my application module and cancel my application installation if the tests fail?

+5
source share
1 answer

Go to Run/Debug Configurations and select your application configuration. At the bottom of the right panel under Before launch: click the + button and select Run another configuration . There, select a configuration to run the tests.

enter image description here

+12
source

Source: https://habr.com/ru/post/1234474/


All Articles