微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

即使在 Android Studio 上使用错误断言值,单元测试也总是通过?

如何解决即使在 Android Studio 上使用错误断言值,单元测试也总是通过?

即使在 Android Studio 上使用错误的断言值,单元测试也始终通过,例如在编写此方法时它通过了

"C:\Program Files\Android\Android Studio\jre\bin\java.exe" -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:C:\Program Files\Android\Android Studio\lib\idea_rt.jar=53441:C:\Program Files\Android\Android Studio\bin" -Dfile.encoding=UTF-8 -classpath C:\Users\Amin\AppData\Local\Temp\classpath152820636.jar com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit4 (package.....).ApiServiceTest,testAssert
    
    Process finished with exit code 0

enter image description here

我不知道为什么会发生这种情况,我检查了我的测试配置是否有问题,但我认为没有问题

enter image description here

这里是运行测试的完整构建打印

> Configure project :app
WARNING: API 'BaseVariant.getApplicationIdTextResource' is obsolete and has been replaced with 'VariantProperties.applicationId'.
It will be removed in version 5.0 of the Android Gradle plugin.
For more information,see TBD.
To determine what is calling BaseVariant.getApplicationIdTextResource,use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
app: 'annotationProcessor' dependencies won't be recognized as kapt annotation processors. Please change the configuration name to 'kapt' for these artifacts: 'com.github.bumptech.glide:compiler:
4.12.0'.

BUILD SUCCESSFUL in 5s
90 actionable tasks: 90 up-to-date

在终端中使用 gradle/app:test 我得到了这个

vari = 15
vari_name = f"{vari=}".split("=")[0]
print(vari_name)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。