Since November 16th the latest version of Robotium 3.0 is released. This new version of Robotium provides several new and improved methods to test your Android app. As Renas Reda in the jayway blog says: “Robotium is now faster, lighter and more stable then ever!” I hope that is true because the previous versions of Robotium were really slow in the execution, even on real devices. So let’s see what’s new!
The following two methods are new to wait for views:
waitForView(View view);
waitForView(View view, int timeout, boolean scroll);
waitForText(String text, int minimumNumberOfMatches,
long timeout, boolean scroll, boolean onlyVisible);
The several waitFor()
methods that are available in Robotium are used by default from the methods is...(), search...(), scroll...(), get...(), assert...() and click...()
. Nevertheless, it is really useful to put additional waitFor()
methods to your testcode to check, if the right activity is shown before testing more stuff within the app. Hint: If you don’t know, which is the current activity on your screen, you can use adb logcat
to find out!
The other big change in Robotium 3.0 is that the finalize()
method is now replaced by the method finishOpenedActivities()
. If you use the finalize()
method in your tearDown()
method to close started activities you have to adapt your tearDown()
method to the new method.
Read more about the new version in the release blog post:
In the next week, I will switch my company project also to Robotium 3.0 and will see how the performance is increasing (hopefully). I will check the performance between the version 2.5 and 3.0 and post an update on this entry. Maybe I will also find out the difference between the methods finalize()
and finishOpenedActivities()
.
Mobile First! Keep on testing!
UPDATE:
Today I measured and compared the execution time between Robotium 3.0 and Robotium 2.5. I selected and executed 14 test methods of our company regression test suite that includes Robotium and JUnit methods like:
searchText()
enterText()
waitForActivitiy()
assertCurrentActivity()
clickOnButton()
clickOnImage()
clickOnText()
asserTrue()
assertFalse()
The average execution time of Robotium 3.0 was 444 seconds for all 14 tests (measured in 10 rounds of executions) including the call of the setUp()
and tearDown()
mehtod, Robotium 2.5 took in average 449 seconds.
So with the new Robotium 3.0 version I save unbelievable 4 seconds in execution time, not that big improvement but I think this is a good step in the right direction to improve the execution time of Robotium!
Thanks again to the developer! You are doing a GREAT job for us!