11

I've written two test cases LoginTest and SignUpTest using JUnit and a Test Suite SessionUnitTestSuite. Every time I want to build and run my app, I have to run the test suite (by selecting the Test Suite and then clicking in "Run") before and, if the test passes, run my app (by selecting the app module and then clicking in "Run").

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

regmoraes
  • 5,329
  • 3
  • 24
  • 33

1 Answers1

21

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, choose the configuration for running your tests.

enter image description here

nhaarman
  • 98,571
  • 55
  • 246
  • 278