[英]Unit tests not running after updated to 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.我一直在 Android Studio Bumblebee 做项目,该项目包含几个包,其中一些有使用 Junit 和 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
但是在更新到 Android Studio Chipmunk 之后,在我排除任何 package 或任何 class 文件并再次运行之后,没有任何测试用例运行并显示此消息
Test events were not received未收到测试事件
I also tried adding the classes that I need coverage, still the same issue.我也尝试添加我需要覆盖的类,仍然是同样的问题。
Add in your module build.gradle testImplementation project(":name-of-your-module")
.添加你的模块 build.gradle
testImplementation project(":name-of-your-module")
。
It's a workaround!这是一种解决方法!
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.
截至今天,我更新到最后一个 AS - Chipmunk Patch2,AGP 到 7.2.2 和 Gradle 到 7.3.3,问题已修复,没有任何其他更改 r 解决方法。 Seems that the bug has been fixed.
好像bug已经修复了。
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.testDebugUnitTest --tests "com.example.*"
其中 com.example 是您在所有模块中通用的命名空间,将.*
留在最后,这是秘诀。 It should all work just fine now...or maybe not depending on any tests failing;)它现在应该一切正常......或者可能不取决于任何失败的测试;)
if you use Kotlin, check your "build.gradle" file and add apply "kotlin-android" plugin.如果您使用 Kotlin,请检查您的“build.gradle”文件并添加应用“kotlin-android”插件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.