- Create an Android module from scratch.
- On the last page of the Wizard, choose the Test option.
- Specify the module to run unit tests against in the Tested Module drop-down list.
To have a dedicated run configuration of the type Android Test created, click Yes in the Create Android Run Configuration dialog box that opens.
- When you click Finish on the last page of the new module Wizard, IntelliJ IDEA creates a module with the specified name and a stub test class for your main activity with the default name <main activity class name>Test.
- Complete the stub and populate the test module as necessary.
Specify the tests to run. Do one of the following:
- To run single test, open it in the editor and choose Android Test temporary run configuration. on the context menu. IntelliJ IDEA creates a
- To run all tests in a class or the entire test module, create an Android Test run/debug configuration.
- Save and edit a previously created temporary run configuration.
- Use the dedicated Android run configuration.
- To perform unit tests, choose the desired configuration from the drop-down list on the main toolbar and start the test according to it.
- Monitor the test execution and view test results in the Test Runner tab of the Run tool window.