Android Robotium: how to return to my activity under testing after clicking / starting another action

I have a problem with my Robotium trials. On one of my actions A, I press a button. Clicking on this button launches another action B. So, in my robotium test, I have something like this:

Button myBtn = (Button) solo.getView(R.id.myBtn);

therefore, after this action, the emulator automatically starts activity B. Now the problem is that I have no way to return to the test operation (A) in the code.

Could you tell me how to avoid getting into jail in action B when you click on the button that launches it? In other words, is it possible to return to the work being tested?

FYI : I need to return to the activity being tested, because there are other testing methods awaiting dismissal.

thanks in advance,

+3
source share
2 answers

Please try methods such as

solo.clickOnView(R.id.myBtn)

to press the button you can also try

solo.clickOnButton()

To return to action, you can use

solo.goBack();

or

solo.goBackToActivity("ActivityName");
+3
source

Once you invoke any activity outside your application, it is impossible to return to your application using it solo.<any API>, because it solois closely related to the UID of your application and does not work in other applications (with a different UID).

In principle, it solocan only work with actions that belong to the application for which it was created.

+2
source

All Articles