Robotium运行报错解析-创新互联

初学robotium

创新互联主营阜宁网站建设的网络公司,主营网站建设方案,App定制开发,阜宁h5微信小程序开发搭建,阜宁网站营销推广欢迎阜宁等地区企业咨询

运行后,遇到问题如下:

junit.framework.AssertionFailedError: No tests found in com.example.zoe.test.ZoeTest

at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)

at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)

at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)

at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1741)

1.将用例方法名前面添加test ,例如 li()改为 testLi()

java.lang.NoClassDefFoundError: com.robotium.solo.Solo

at com.example.zoe.test.ZoeTest.setUp(ZoeTest.java:24)

at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)

at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)

at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)

at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1741)

2 .在properties 选择order 和export 里面将Robotium.jar包置顶 就解决了

java.lang.NullPointerException

at android.test.InstrumentationTestCase.launchActivityWithIntent(InstrumentationTestCase.java:117)

at android.test.InstrumentationTestCase.launchActivity(InstrumentationTestCase.java:97)

at android.test.ActivityInstrumentationTestCase2.getActivity(ActivityInstrumentationTestCase2.java:104)

at com.example.zoe.test.ZoeTest.setUp(ZoeTest.java:24)

at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)

at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)

at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)

at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1741)

1.没有找到要测试activity 的对应主包名

junit.framework.AssertionFailedError: 没有找到完成 expected: but was:

at com.example.zoe.test.ZoeTest.testButton(ZoeTest.java:32)

at java.lang.reflect.Method.invokeNative(Native Method)

at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)

at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)

at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)

at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)

at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)

at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)

at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1741)

1.断言格式错误。

junit.framework.AssertionFailedError: The specified Activity is null!

at com.robotium.solo.Asserter.assertCurrentActivity(Asserter.java:60)

at com.robotium.solo.Solo.assertCurrentActivity(Solo.java:989)

at com.example.zoe.test.ZoeTest.testButton(ZoeTest.java:34)

at java.lang.reflect.Method.invokeNative(Native Method)

at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)

at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)

at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)

at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)

at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)

at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)

at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1741)

solo.assertCurrentActivity("expect test activity","Zoe" );  未使用正确

          "message","应用名称"

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


新闻名称:Robotium运行报错解析-创新互联
地址分享:http://ybzwz.com/article/cdossd.html