Robotium is a “Black-Box” testing tool that simulates and automates user interaction such as clicking, touching, entering text and any other gesture which is possible on a touch device. It is a test structure that was created to ease the writing of powerful and robust automatic black-box test cases for Android applications.  With its support, developers who create test cases can write system, function, and acceptance test scenarios, covering multiple Android activities. It provides full support for Activities, Dialogs and Context Menus. Robotium is an open-source tool, so it can be used by individuals as well as Enterprises.  Execution of tests could either be done on a real device or on the Android simulator (AVD – Android Virtual Device). It is built on the Java and the JUnit test structure. Robotium can be used for testing the applications where the source code is available and also the applications where only the apk is available. Robotium extends the Android test framework so as to make it simpler to write tests. For testing with Robotium, the main class is Solo.

How to create a Robotium Project?

1. Before creating a Robotium Project, the prerequisites are:

     a) Download and Install JAVA.

     b) Download ADT bundle.

2. To create a project, the first step is to Open eclipse which contains your android application that is to be tested.

3. Right-click on the android project – Go to Android Tools and click on the new Test project.

4. Enter the Test project name and click on the Next button.

5. The Application under test is to be selected as the target.

6. After that, click on the Finish button.

7. In the eclipse workspace, a Test project will be created.

8. Next step is to download the Robotium solo jar which provides methods to call the Android user interface.

9. After right-clicking on the Test project in the workspace, go to Build path and click on Configure build path.

10. Move to libraries tab, click on “Add external jars” option.

11. Browse the Robotium jar file which was downloaded, add it to the libraries and click “OK”.

12. After following the above steps, the Robotium Test project is successfully created. Now classes can be created under the project and test cases can be written accordingly.

Benefits of Robotium:

1. The code is short and easy to write.

2. Multiple Android activities can be automatically handled by it.

3. It greatly improves the readability of test cases in comparison to standard instrumentation tests.

4. It provides automatic timing and delays.

5. It automatically follows the current Activity and makes decisions on its own.

6. Views can be easily found using it.

7. Execution of tests is faster and the test cases are more robust due to run-time binding.

Features of Robotium:

1. Robotium allows the users to write powerful test cases quickly with zero or minimal knowledge of the application under test.

2. APIs are offered by Robotium to directly interact with UI controls within the application.

3. Android 1.6 and above versions are supported by Robotium officially.

4. Robotium doesn’t modify the Android platform.

5. Command prompt can be used to execute the Robotium test.

6. Robotium can be added to the project's build automation process and it can be integrated smoothly with Maven or Ant.

7. Robotium can capture screenshots.

Limitations of Robotium:

1. Flash components cannot be handled by Robotium.

2. Only one application at a time can be handled by Robotium.

3. It is not able to interact with the notifications on Status Bar.

4. When run on older devices, it can be a bit slow.

author_image

HarmanJeet Kaur

Harman is an Automation Test Engineer at BugRaptors. She has expertise in Web & Mobile automation testing using Selenium WebDriver and Appium Tool. Professional in writing automating test scripts ,Data Driven Implementation , Keyword frameworks, Debugging, Executing and find issues in scripts.

Comments

Add a comment

BugRaptors is one of the best software testing companies headquartered in India and the US, which is committed to catering to the diverse QA needs of any business. We are one of the fastest-growing QA companies; striving to deliver technology-oriented QA services, worldwide. BugRaptors is a team of 200+ ISTQB-certified testers, along with ISO 9001:2018 and ISO 27001 certifications.

USA Flag

Corporate Office - USA

5858 Horton Street, Suite 101, Emeryville, CA 94608, United States

Phone Icon +1 (510) 371-9104
USA Flag

Test Labs - India

2nd Floor, C-136, Industrial Area, Phase - 8, Mohali -160071, Punjab, India

Phone Icon +91 77173-00289
USA Flag

Corporate Office - India

52, First Floor, Sec-71, Mohali, PB 160071,India

USA Flag

United Kingdom

97 Hackney Rd London E2 8ET

USA Flag

Australia

Suite 4004, 11 Hassal St Parramatta NSW 2150