mosil / robotium

Automatically exported from code.google.com/p/robotium
0 stars 0 forks source link

Robotium testing on options menu item click #566

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I want to write a test class where i have to test on click of optionsmenu 
item(I have 3 items in options menu). so onclicking the options menu item I m 
showing the list view with the data which I am retrieving from the sd card.

the application should crash if run time exception occurs.

Kindly help me with some code snippet/example.

Here is my code but and suggest me if any changes required.

    private Solo solo;

    @SuppressWarnings("deprecation")
    public Mytest() {
        super("com.ge.contentmanagement.ui", ContentManagementActivity.class);
    }

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        solo = new Solo(getInstrumentation(), getActivity());
    }

    public void TestOptionsmenuItemclick() {
        solo.sendKey(Solo.MENU);
        solo.sendKey(KeyEvent.KEYCODE_MENU);
        solo.clickOnMenuItem("Review");
        solo.assertCurrentActivity("hai", getName());

    }

    @Override
    public void tearDown() throws Exception {
        solo.finishOpenedActivities();
    }

         }

Help is always appreciated! 

Thanks

Original issue reported on code.google.com by raghav4a...@gmail.com on 16 Dec 2013 at 12:57

GoogleCodeExporter commented 9 years ago
Please keep this issue tracker for defects. 

Original comment by renasr...@gmail.com on 17 Dec 2013 at 8:01