TestCase class not found by Android Studio

后端 未结 7 1713
刺人心
刺人心 2020-12-03 17:24

I have written a simple test case class and placed it in the default test directory for Android Studio: \"src/androidTest\". I\'ve created an Android Tests build configurati

7条回答
  •  余生分开走
    2020-12-03 18:12

    The package structure under the androidTest/java directory needs to exactly parallel the structure under the main/java directory.

    My problem above was that the package structure under main was com.mydomain.myapp.subpackage and the directory structure under androidTest was com.mydomain.myapp.subpackage.somethingelse.

    Once the package structures matched, the tests were discovered and executed flawlessly.

提交回复
热议问题