Showing posts with label Junit. Show all posts
Showing posts with label Junit. Show all posts

2020-11-12

Android Studio: “No tests were found” Error, Trying to Run Android Instrumented Tests (androidTest)

 

In Android Studio I was getting to “No tests were found” error when trying to run Android Instrumented Tests (androidTest).
In another Android project of mine I had no such problems.
None of the suggestions from stack overflow helped.

In my case, I had the following statement the testOptions block in build.gradle(:app) in my problematic Android project.
testOptions {
    . . .
    execution 'ANDROIDX_TEST_ORCHESTRATOR'
}

Removing / commenting out execution 'ANDROIDX_TEST_ORCHESTRATOR' resolved my problem.

I hope this helps!

2020-09-26

Android Studio Complaining About Imports in "androidTest"

 If you are trying to build an androidTest with Android Studio and it can not find the classes being imported. (For example Android Studio can not find AndroidJUnit4, InstrumentationRegistry, etc.)


Like this, for example:

Change your Build Variant to debug.

This build variant "Release" causes the error from above.

This build variant "debug" solved the problem for me:


Android Studio: "androidTest" Raising "java.lang.ClassNotFoundException: Didn't find class"

 

If you are trying to run an androidTest with Android Studio and get the following error:

java.lang.NoClassDefFoundError: Failed resolution of: L....
. . .
Caused by: java.lang.ClassNotFoundException: Didn't find class "..." on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file ...
. . .

Check your build.gradle (:app) File, if you have "minifyEnabled true" enabled in your debug build type

buildTypes {
    debug {
        . . .
        minifyEnabled true
        . . .

Try commenting it out.

I hope it helps.