Single instrumentation tests can't be started from Android Studio (starting from Chipmunk)

1k views Asked by At

After updating Android Studio to Chipmunk we can't start our UI tests located in differen folder than androidTest from AndroidStudio itself anymore.

We get instead an error message:

Error running "...Test"
Class "..." not found in module 'OurApp:app'

As mentioned above our tests are not located in androidTest folder, but in sharedTestDebug instead. However it wasn't a problem with prior versions of Android Studio until Chipmunk.

We also add this folders in our build.gradle

sourceSets {
    String sharedTestDebugDir = 'src/sharedTestDebug/java'
    String sharedTestDir = 'src/sharedTest/java'
    androidTest {
        java.srcDirs += sharedTestDir
        java.srcDirs += sharedTestDebugDir
    }
}

Another finding: we are only not able to start single tests. if we start running all tests from AS, it works.

update

Also found out that in "Edit configurations" we are not able to select any instrumented test other then from androidTest folder

update2

same behavior in the dolphin and electric eel versions :(

if you want to run a single instrumented tests you need to select module to run the test from. Unfortunately in the selection you can only select the module with corresponding androidTest folder.

update3 It seems to be a known issue :(

https://issuetracker.google.com/issues/228392691

1

There are 1 answers

0
Tima On

I found a workaround to let run single instrumentation tests again

I created a symbol link referencing from the folder where our tests located to androidTestDebug. For that I ran following command from the src-folder:

ln -s sharedTestDebug androidTestDebug

To have it also in git I called

git ls-files -s ./app/src/androidTestDebug

and then

git add ./app/src/androidTestDebug

Maybe someone else will find another solution.