fastjson和android单元测试JUnit 4 test runner(AndroidJUnitRunner)不兼容

xmq68pz9  于 2021-11-27  发布在  Java
关注(0)|答案(5)|浏览(275)

Android Studio默认会在defaultConfig中添加testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
但是dependencies中依赖compile 'com.alibaba:fastjson:latest.release',然后运行gradlew createDebugCoverageReport时,会报
No tests found.[EVA-AL00 - 6.0] FAILED
No tests found. This usually means that your test classes are not in the form that your test runner expects (e.g. don't inherit from TestCase or lack @test annotations).

li9yvcax

li9yvcax1#

刚测试最近的两个版本 compile 'com.alibaba:fastjson:1.2.36'和compile 'com.alibaba:fastjson:1.2.37'有这个问题,但是之前的版本就没有,麻烦看下。

uemypmqf

uemypmqf2#

看不出什么问题哦

bn31dyow

bn31dyow3#

Android Studio默认会在defaultConfig中添加AndroidJUnitRunner来支持单元测试

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

但是如果在dependencies中添加依赖

compile 'com.alibaba:fastjson:latest.release',

然后运行gradlew createDebugCoverageReport时,会报

No tests found.[EVA-AL00 - 6.0] FAILED
No tests found. This usually means that your test classes are not in the form that your test runner expects (e.g. don't inherit from TestCase or lack @test annotations).

简单点说就是 fastjson 1.2.36~37和AndroidJUnitRunner不兼容,但35以及之前的版本没有这个问题。

wlzqhblo

wlzqhblo5#

@wenshao 遇到了和@rickenwang 同样的问题。48、62版本都有问题。这么多第三方包,都没事,只有加了fastjson,就报错:
No tests found。
建议你们自己写个简单的Demo,引用fastjson,写个仪器测试(Instrumented Tests),复现一下问题。
必现bug。

相关问题