Has anyone used Robotium or Calculon for testing Android apps? Are they useful? Any recommendations on which is better?
+3
A:
I'd go with Robotium since Calculon is still in very early stages. Here's a comment from Calculon's author:
Well, currently it’s just a bunch of source files which I pulled out of another project...Note that this library is still a very early prototype. Its API will probably change. Source
I've played with Robotium today, it definitely makes writing functional tests fun. To give you an idea, here are a few method highlights from the API:
- clickOnButton, clickOnText
- enterText
- getCurrentButtons, getCurrentEditTexts, getCurrentImageViews, getCurrentSpinners, getCurrentTextViews
- pressMenuItem, pressSpinnerItem
- searchText, searchEditText, searchButton
Here is a code sample from the Getting Started Guide:
public void testTextIsSaved() throws Exception {
solo.clickOnText("Other");
solo.clickOnButton("Edit");
assertTrue(solo.searchText("Edit Window"));
solo.enterText(1, "Some text for testing purposes")
solo.clickOnButton("Save");
assertTrue(solo.searchText("Changes have been made successfully"));
solo.clickOnButton("Ok");
assertTrue(solo.searchText("Some text for testing purposes"));}
Definitely give it a try if you're going to write ActivityInstrumentationTestCase2 classes. Check out the Getting Started guide for instructions.
Sarp Centel
2010-02-21 17:05:40