java–Robotium_constructor在NotepadTest方法中不推荐使用super的消息

java–Robotium_constructor在NotepadTest方法中不推荐使用super的消息,第1张

概述我正在尝试为记事本应用程序编写示例测试.在下面的代码中,我收到警告,我无法运行测试.请帮我解决这个问题.警告说“不推荐使用构造函数ActivityInstrumentationTestCase2<NotesList>(String,Class<NotesList>)”并且Eclipse中的执行在testAddNote();处停止.如果您需要任何logcat

我正在尝试为记事本应用程序编写示例测试.在下面的代码中,我收到警告,我无法运行测试.请帮我解决这个问题.警告说“不推荐使用构造函数ActivityInstrumentationTestCase2< NotesList>(String,Class< NotesList>)”并且Eclipse中的执行在testAddNote();处停止.如果您需要任何logcat日志,请恢复.

package com.example.androID.notepad.test;import com.example.androID.notepad.*;import com.jayway.androID.robotium.solo.solo;import androID.test.ActivityInstrumentationTestCase2;import androID.test.suitebuilder.annotation.*;public class NotePadTest extends ActivityInstrumentationTestCase2<NotesList> {    private Solo solo;    public NotePadtest() {        super("com.example.androID.notepad", NotesList.class);    }       @OverrIDe    public voID setUp() throws Exception {        solo = new Solo(getInstrumentation(), getActivity());    }    @Smoke    public voID testAddNote() throws Exception {        solo.clickOnbutton(0);        //Assert that NoteEditor activity is opened        solo.assertCurrentActivity("Expected NoteEditor activity", "NoteEditor");         //In text fIEld 0, add Note 1        solo.enterText(0, "Note 1");        solo.goBack();         //Clicks on menu item        solo.clickOnMenuItem("Add note");        //In text fIEld 0, add Note 2        solo.enterText(0, "Note 2");        //Go back to first activity named "NotesList"        solo.goBackToActivity("NotesList");         boolean expected = true;        boolean actual = solo.searchText("Note 1") && solo.searchText("Note 2");        //Assert that Note 1 & Note 2 are found        assertEquals("Note 1 and/or Note 2 are not found", expected, actual);     }    @OverrIDe    public voID tearDown() throws Exception {        //Robotium will finish all the activitIEs that have been opened        solo.finishOpenedActivitIEs();    }}

这是StackTrace

java.lang.NoClassDefFoundError: com.jayway.androID.robotium.solo.soloat com.example.androID.notepad.test.NotePadTest.setUp(NotePadTest.java:37)at androID.test.AndroIDTestRunner.runTest(AndroIDTestRunner.java:169)at androID.test.AndroIDTestRunner.runTest(AndroIDTestRunner.java:154)at androID.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:537)at androID.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1551)

解决方法:

“NoClassDefFoundError”是由于androID sdk升级到版本17.我们需要在java构建路径中的“order and export”选项卡中检查robotium.但是我仍然可以找到构造函数弃用的warring的解决方案.

总结

以上是内存溢出为你收集整理的java – Robotium_constructor在NotepadTest方法中不推荐使用super的消息全部内容,希望文章能够帮你解决java – Robotium_constructor在NotepadTest方法中不推荐使用super的消息所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1109782.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-29
下一篇2022-05-29

发表评论

登录后才能评论

评论列表(0条)

    保存