Why is the Android test runner reporting “Empty test suite”?

前端 未结 30 2181
有刺的猬
有刺的猬 2020-11-28 07:59

I am banging my head against the wall here trying to figure out why IntelliJ/Android is reporting \"Empty test suite\". I have a small project with two IntelliJ Modules (\"

30条回答
  •  Happy的楠姐
    2020-11-28 08:23

    In my case, I had my instrumented tests in androidTest/java//MyTestingClass, but I had set my current build variant to "preproduction". And there's the point! As specified in Android Studio documentation:

    By default, all tests run against the debug build type.

    The message Class not found. Empty test suite. kept appearing until I did this:

    1. Add this line to my build.gradle:

      android{
          [...]
          testBuildType "preproduction"
      }
      
    2. Synchronised gradle.
    3. Delete my previous test configurations since they don't take this Gradle synchronisation into account.

    Then I executed the tests again and this time they run just perfect!!!

提交回复
热议问题