“未找到测试".用于棒棒糖及以上的仪器测试 [英] "No tests found" for instrumentation tests for Lollipop and above

查看:82
本文介绍了“未找到测试".用于棒棒糖及以上的仪器测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基于仪器的(意式浓缩咖啡)测试无法在Lollipop +设备和仿真器上运行.它们可以在任何其他平台上正确运行.我和这个线程中的人有相同的症状- https://groups.google.com/forum/?fromgroups#!topic/adt-dev/QW5SuzQizNk

My instrumentation based (espresso) tests don't run on Lollipop+ devices and emulators. They correctly run on any other platform. I have the same symptoms as the guy in this thread - https://groups.google.com/forum/?fromgroups#!topic/adt-dev/QW5SuzQizNk

  • 我的测试在src/androidTest/java/
  • 我已经设置了testInstrumentationRunner'android.support.test.runner.AndroidJUnitRunner'
  • 测试类为@RunWith(AndroidJUnit4.class)
  • 单个测试使用@Test注释

我可以执行./gradlew connectedCheck,并且在使用KitKat的设备上测试可以很好地运行,但是当我尝试在具有Lollipop的设备上以相同的方式运行相同的测试时,我得到...

I can execute a ./gradlew connectedCheck and the tests run well on a device with KitKat, but when I try to run the same tests the same way on a device with Lollipop I get...

15:02:15.784 [WARN] [org.gradle.api.Task]在XT1095上进行的测试-5.1失败:由于"java.lang.NoClassDefFoundError",仪器运行失败

15:02:15.784 [WARN] [org.gradle.api.Task] Tests on XT1095 - 5.1 failed: Instrumentation run failed due to 'java.lang.NoClassDefFoundError'

15:02:16.011 [WARN] [org.gradle.api.Task] com.android.builder.testing.ConnectedDevice> 未找到测试.[XT1095-5.1]失败

15:02:16.011 [WARN] [org.gradle.api.Task] com.android.builder.testing.ConnectedDevice > No tests found.[XT1095 - 5.1] FAILED

15:02:16.011 [WARN] [org.gradle.api.Task] 未找到测试.这通常意味着您的测试类的格式不符合测试跑步者期望的形式(例如,不要从TestCase继承或缺少@Test批注).

15:02:16.011 [WARN] [org.gradle.api.Task] 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).

推荐答案

最后,它开始工作了.我遵循以下答案: https://groups.google.com/d/msg/adt-dev/QW5SuzQizNk/mWdaEuuCCQAJ 链接到: https://github.com/google/dagger/issues/271

Finally it started working. I followed this answer: https://groups.google.com/d/msg/adt-dev/QW5SuzQizNk/mWdaEuuCCQAJ which links to: https://github.com/google/dagger/issues/271

基本上这是问题所在

我不正确地使用编译'com.google.dagger:dagger-compiler:2.0.2'

代替正确 apt'com.google.dagger:dagger-compiler:2.0.2'

这篇关于“未找到测试".用于棒棒糖及以上的仪器测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆