Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to run all (unit and instrumented) tests with one click in Android Studio

I am developing an Android app in Android Studio. I have unit tests and instrumented tests.

I want to run them all to see if I broke something.

Right now my workflow is:

  • go to Project view
    • navigate to ${app}/src/androidTest/java/
    • right-click that node and select Run 'All Tests'
    • select my device
    • run instrumented tests

then

  • go to Project view
    • navigate to ${app}/src/androidTest/java/${package}
    • right-click that node and select Run 'Tests in ${package}'
    • run unit tests

What I am really looking for is a big green button that runs all of the tests and reports back the result of OK/FAILED for both unit and instrumented tests together. How can I do that?

like image 307
mnagel Avatar asked Oct 18 '16 09:10

mnagel


People also ask

How run all test cases in Android?

Run all tests in a single classRight click on a test class name in the editor (or a filename in the project explorer) to run all tests in a single class. The default keyboard shortcut for this is Ctrl+Shift+F10 on Linux. I suggest you map it to something easier to remember like Ctrl+Alt+R.

How do you run all tests?

To run all the tests in a solution, choose the Run All icon (or press Ctrl + R, V). To run all the tests in a default group, choose the Run icon and then choose the group on the menu.


1 Answers

You cannot start both tests at the same time...

But you can create two big green buttons.

  1. Go to your project files and right click on ../app/src/androidTest/java make all instrumented tests

  2. Then right click on ../app/src/test/java make all unit tests

  3. Enjoy! =)

like this

like image 87
Andrew Grow Avatar answered Oct 11 '22 13:10

Andrew Grow