diff --git a/docs/html/images/training/testartifactcombined.png b/docs/html/images/training/testartifactcombined.png new file mode 100644 index 0000000000000..a3b5e81c37bec Binary files /dev/null and b/docs/html/images/training/testartifactcombined.png differ diff --git a/docs/html/images/training/testartifactseparate.png b/docs/html/images/training/testartifactseparate.png new file mode 100644 index 0000000000000..b12b70c44dc9f Binary files /dev/null and b/docs/html/images/training/testartifactseparate.png differ diff --git a/docs/html/training/testing/start/index.jd b/docs/html/training/testing/start/index.jd index bc871942565f1..707ba9d8f65a1 100644 --- a/docs/html/training/testing/start/index.jd +++ b/docs/html/training/testing/start/index.jd @@ -249,6 +249,7 @@ dependencies { } +

To use JUnit 4 test classes, make sure to specify {@code @@ -265,9 +266,39 @@ android { } -

- Build and Run Your Tests -

+

Work With Test Artifacts

+

Android Studio has two types of test artifacts: Android Instrumentation Tests +and Unit Tests. Previously, you could work with just one test artifact at a +time. Now, both test artifacts are enabled. +The advantage of enabling both test artifacts is that any changes you make to +the underlying code affect +them both. For example, if you rename a class that both test artifacts access, +both will know about the class name refactoring.

+ +

The figure shows what your project looks like with both test +artifacts enabled. Notice the shading of both test artifacts.

+ + + + + +

Build and Run Your Tests

+

Android Studio provides all the tools you need to build, run, and analyze @@ -293,13 +324,17 @@ android {

    +
  1. In the Project window, right click on the project and synchronize your project.
  2. -
  3. Open the Build Variants window by clicking the left-hand tab, - then change the test artifact to Unit Tests. -
  4. +
  5. In the Project window, navigate to your unit test class or method, then right-click it and select Run
  6. +

@@ -330,10 +366,13 @@ android { To run your instrumented tests:

-
    -
  1. Open the Build Variants window by clicking the left-hand tab, - then set the test artifact to Android Instrumentation Tests. -
  2. +
+

The Android Plugin @@ -402,6 +441,7 @@ android { +

Configure a test matrix and run a test