Before a mobile app or software is released, due diligence must be done to ascertain the performance through varying parameters. Test case developers are required to develop the different function and acceptance scenarios. This is usually attained by using different mobile testing frameworks designed for either mobile testing— Android or iOS. Discover Robotium, one of the frameworks designed for testing and how it can be used.
Robotium is an Android test automation framework developed for testing native and hybrid android applications. It is a tool that provides test case developers with an API to write functional system and user acceptance test cases. It allows testing to be executed in real time with the Android device or via an Android emulator.
Robotium is a recommended tool for testing because it is easier to write test cases with minimal code and thus makes testing consume less time. Additionally, it handles many Android activities automatically with improved test case readability. The test cases are comprehensive and robust because of the run-time binding to the GUI component.
- Creating a test specification
- Develop a test program
- Executing the test case and collecting the results
Before you can use Robotium, it is important to have some prerequisites.
Include java libraries to the PATH and set JAVA_HOME to the root of the java installation directory in your environment.
Robotium is installed on your system as a JAR file which must only be placed in the class path of the test project.
- Open Eclipse, which should house the Android application to be tested
- Right-click on the Android project, select Android Tools and select the new Test project
- Name the test project accordingly and select Next.
- Select the application under test as the target and click finish.
- The Test project will be created in the eclipse workspace
- Download your Robotium Jar.
- Right-click on the Test project in the workspace, click on Build path and select configure build path.
- Move to the libraries tab and select Add External Jars and now add the jar file to the libraries
Connect the Android device to your PC or use an emulator if you do not have the device. In your IDE, right-click Run As and select Android J Unit Test. After the test is completed, you get the test results.