Has anyone used Robotium or Calculon for testing Android apps? Are they useful? Any recommendations on which is better?
Robotium is an open-source test framework for writing automatic gray box testing cases for Android applications. With the support of Robotium, test case developers can write function, system and acceptance test scenarios, spanning multiple Android activities.
Robotium Test cases can be executed on Android Emulator as well as the Real device, we don't need to write any specific configuration code to run Robotium test cases on the Real device. Robotium Can be easily written in the Maven project also, and it can be run through continuous integration tools.
Test an App with RobotiumStep 1 − Create a test Project in the Android Studio named as “RobotiumTest”. Choose all the default options until you reach to the main page. Step 2 − Copy the Robotium jar file into the Lib folder of the project. Step 3 − Add the dependency in build.
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:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With