najm
najm

Reputation: 894

Changing the instrumentation class in an Android Studio run configuration

I have somewhat of a complex test setup for my Android project and it requires different test runners. I have setup my Gradle file so that it switches the test runner according to a project property. That way I can control the test runner when running tests via a Gradle script.

However, I'd love to do the same with an Android Studio run configuration. But the Instrumentation Class field seems to be grayed out and AS won't let me change it. See here.

Upvotes: 3

Views: 763

Answers (1)

michalbrz
michalbrz

Reputation: 3504

I had the same problem and solved it by setting up testInstrumentationRunner in build.gradle, e.g.

android {
   defaultConfig {
       ...
       testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Of course it might work or not depending on your Gradle setup - you wrote you're doing some complex things, but this might be a place to start.

Upvotes: 1

Related Questions