Run all unit tests in Android Studio

Kevin ABRIOUX picture Kevin ABRIOUX · Dec 13, 2016 · Viewed 28.4k times · Source

I have this project in Android Studio :

enter image description here

I wish to run all unit tests in all project with one click.

How i can do it ?

Answer

lustig picture lustig · May 17, 2019

Not sure what version of Android Studio this was added in, but I'm using Android Studio 3.4.

Android Studio Version 3.4

In the Project Explorer Window, select the Project View.

Project View Select

Right click on your root project and select "Create 'All Tests'..."

Create 'All Tests'

...this window will appear (these defaults need to be changed)

Default edit config window

Change the following options:

  • Search for tests:

    • In whole project
  • JRE:

    • Most recent version of Android API __ Platform that you have available in this menu (for me, Android API 28 Platform
  • Click Apply

Edited Test configuration

  • Select "All Tests" from the drop down menu

enter image description here

  • View output from all your tests

enter image description here