Local unit tests

If you have created an Android Studio project using the project wizard, then the basic test case for both test types will have been created automatically. The wizard will also include the necessary Gradle dependencies. If you are using a project created any other way, you will need to create a test directory structure and include Gradle dependencies by hand. These steps are outlined as follows:

  1. Inside your module/src directory, create a new folder alongside src/main called src/test.
  2. Inside this test directory, recreate the folder structure inside your main directory, for example:
  1. This directory is where you will place your test classes, and it will now be accessible from the IDE's project ...

Get Mastering Android Studio 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.