Writing Robotium tests for native android applications without using Java!!
Robotium is a test framework for Android applications. Amazingly complex tests can be written in Robotium, since it suppports java programming. This however does mean that basic Java programming knowledge is needed for writing robotium tests.
For some of our simpler test scenarios, we found that a simple tool to record the tests as csv which could actually run them using the robotium API would be a great help. This goal resulted in bot-bot , our android automation framework built upon robotium. We can now write robotium test-cases in simple csv files, bot-bot executes these simple files. All commands used by solo ( heart of Robotium ) can be directly written in csv files with the required parameters. bot-bot internally typecasts these parameters to the required types. It however does need the apk to run the tests.
With bot-bot we have also done some data driven tests with lots of ease. We did not need to write Java code for achieving this. bot-bot also generates TestNG and JUnit reports!!
- Click on add note menu item
- Write “Hello World” as title
- Click the menu item “Save”
- Assert the present of text “Hello World” (On successful creation of note,list is populated with title of the note).
The commands to use are :
All commands other than asserttextpresent are standard robotium commands. Save this as newNoteTest.csv and place it under the folder Notepad under test-cases directory.
Change default.properties to the following:
Run this test using the command “ant runner” from bot-bot root directory.
Bot-bot will run this csv file as a test and will create jnuit and TestNg reports.
For complex scenarios, we do need to use Robotium, where we have a programming language at your disposal. However, for the simpler cases, we can write simple and effective use cases with minimal effort using Bot-bot.
For getting started on bot-bot you can visit Getting Started Doc .
You can clone this example from https://github.com/moizjv/bot-bot/tree/robotium