2

I am following guide from this official site: https://developer.android.com/training/testing/espresso/setup.html#running-tests

To create a test configuration in Android Studio, complete the following steps:

  1. Open Run > Edit Configurations.
  2. Add a new Android Tests configuration.
  3. Choose a module.
  4. Add a specific instrumentation runner:
  5. android.support.test.runner.AndroidJUnitRunner
  6. Run the newly created configuration.

now, 1. is OK, but where in 2. is "Android Tests" configuration?? I can add "Android Instrumented Tests", but then where can I add "android.support.test.runner.AndroidJUnitRunner" in 5.?

2
  • 1
    android docs are really bad. I hardly ever use them. Commented Jan 16, 2020 at 12:59
  • @epic You're right but what's the alternative? Commented Aug 25, 2024 at 12:44

1 Answer 1

1

For 2, see below. This is not necessary for AS2.3 and above. If your Instrumentation tests inside androidTest folder, just right-click on the test name and select Run.

enter image description here

For 5, You need to add this in your gradle script as below.

android {
     compileSdkVersion  .........
     buildToolsVersion  .........

     defaultConfig {
       minSdkVersion .....
       targetSdkVersion .....
       testApplicationId = 'your.package.name.test'
       testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"   
     }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.