更新到Android Studio Chipmunk后未运行的单元测试
我一直在Android Studio Bumblebee中从事项目,该项目包含多个软件包,其中一些包含使用Junit和Mockito的测试课程。
因此,在提高代码覆盖范围的时,我在调试配置中排除了带有零单位测试的软件包。但是在更新到Android Studio Chipmunk之后,在我排除任何软件包或任何类文件并再次运行之后,没有运行所有测试用例,并且显示此消息
未收到测试事件
我也尝试添加类别我需要覆盖范围,但仍然存在同样的问题。
I have been working on project in Android Studio Bumblebee, and the project contains several packages , some of them have test classes using Junit and Mockito.
So inorder to increase code coverage, I had excluded the packages with zero unit tests in Debug configurations . But after updating to Android Studio Chipmunk, after I exclude any package or any class file and run again, none of the test cases are run and shows this message
Test events were not received
I also tried adding the classes that I need coverage, still the same issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
作为解决方法,您可以通过gradle任务窗口运行测试:
使用用于运行配置的命令:
As a workaround you may run the tests through the gradle task window:
Use the command that you used for your run configurations:
添加您的模块build.gradle
tistImplementation项目(“:您的模型名称”)
。这是一个解决方法!
Add in your module build.gradle
testImplementation project(":name-of-your-module")
.It's a workaround!
我遇到了同样的问题。截至今天,我更新到last -as -chipmunk patch2,AGP至7.2.2和gradle至7.3.3,问题已解决,而没有任何其他更改r解决方案。似乎该错误已解决。
I was having the same problem. As of today I updated to last AS - Chipmunk Patch2, AGP to 7.2.2 and Gradle to 7.3.3, the problem was fixed, without any other change r workarounds. Seems that the bug has been fixed.
在海豚工作很好。要重现成功执行以下操作:
testDebugunitTest -tests -tests“ com.example。*”
其中com.example是您的在上使用的命名空间common所有模块,在结尾处留下。*
,这是秘密调味料。现在所有的工作都可以正常工作...或者可能不依赖任何测试失败;)
Works in Dolphin just fine. To reproduce success perform the following:
testDebugUnitTest --tests "com.example.*"
Where com.example is your namespace common across all modules, leave the.*
at the end, this is the secret sauce.It should all work just fine now...or maybe not depending on any tests failing ;)
如果使用Kotlin,请检查您的“ build.gradle”文件,然后添加应用“ Kotlin-android”插件。
if you use Kotlin, check your "build.gradle" file and add apply "kotlin-android" plugin.