android - 找不到类 : Empty test suite when running unit tests in Android Studio

标签 android unit-testing

我的 Android 应用有一个测试套件,所有单元测试都运行良好。但是,每当我对我的一个单元测试类(例如,ModelUnitTests)进行一次更改时,在尝试再次运行该类时,我都会收到此消息

Process finished with exit code 1
Class not found: "xxx.xxxxxx.xxx.ModelUnitTests"Empty test suite.

如果我执行 gradle clean 然后再次运行类测试,它运行良好(但需要 4 分钟才能完成......),但是新的更改会再次破坏它。

关于如何解决这个问题的任何建议?我不确定我应该发布哪个测试配置。我正在使用单元测试 Artifact ,我的测试位于 module/src/test/package文件夹

最佳答案

我遇到了类似的问题,这是因为我首先创建了一个具有相同类名的单元测试。当我创建仪表化单元测试时,我得到了错误。

为了解决这个问题,我去了运行图标左侧的编辑配置。然后在 Unit Test 下方,是 'conflicting' 类,我删除了。单击应用/确定。然后我右键单击类名,单击运行,瞧,它可以工作了。

关于android - 找不到类 : Empty test suite when running unit tests in Android Studio,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38056901/

相关文章:

c# - async/await 单元测试代码覆盖率

unit-testing - 有没有办法通过 NumberFormat 比较格式化值?

android - 使用 Kotlin 在 JUnit 中进行 API 调用

android - Android 是否有任何可用于使用 KeyPad 给出导航顺序的属性或方法

android - 将 TextView 放在 ImageView 的中央?

asp.net-mvc - ASP.NET MVC 中单元测试的 "Size"

android - OkHttp 切断长响应

android Gridview 移动一列

angular - typescript + jasmine.createSpy()

javascript - 为什么这些 Jest 不会重置?