Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Examples for Robotium

I found a tool for Instrumentation Testing called Robotium.It is easy and simple for black box testing of android applications. We can use it as follows:

    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"));

Can any body have more idea about it? Can any one please tell how can we use it for webviews and listviews etc.

like image 553
siri Avatar asked Feb 22 '10 16:02

siri


People also ask

How do you use Robotium?

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.

What is Robotium in Android application?

Robotium is an open source test framework created to make it easy to write powerful and robust automatic UI test cases for mobile Android applications. With the support of Robotium, test case developers can write function, system and acceptance test scenarios, spanning multiple Android activities.

Which type of application is supported by Robotium as of now?

Robotium is similar to Selenium, but for Android. It has support for Android features such as activities, toasts, menus and context menus.

Where can we execute Robotium test cases?

Robotium Test cases can be executed in the Android emulator as well as the Android real device.

What is Robotium and how do I use it?

With the support of Robotium, test case developers can write function, system and acceptance test scenarios, spanning multiple Android activities. Robotium can be used both for testing applications where the source code is available and applications where only the APK file is available.

What is an Android Robotium test?

Robotium tests inherit from ActivityInstrumentationTestCase2 and allows you to define test cases across Android activities. Robotium tests perceive the application under test as black box, i.e., it only interacts with the user interface and not via the internal code of the application.

How to add Robotium library in a project?

You have to add Robotium library file to a libs directory in your project folder in case you want to test with Robotium framework. (You create lib folder in your project folder).

How do I run Robotium tests?

To run a Robotium test use the same approach you use to run Eclipse, right-click the test class and select Run-As Android JUnit Test You can run Robotium tests from the command line, too. 6. Exercise: Write Robotium tests


1 Answers

Please see the QA wiki page for common question and answers on what Robotium supports: http://code.google.com/p/robotium/wiki/QuestionsAndAnswers

Also please go to the Getting Started page: http://code.google.com/p/robotium/wiki/Getting_Started

There you will find an example test project that you download and look at for ideas. You can also download the javadoc from: http://code.google.com/p/robotium/downloads/list to see what functionality there is at the moment.

For tutorials please visit: http://code.google.com/p/robotium/wiki/RobotiumTutorials

Sincerely, Renas

like image 184
Renas Avatar answered Nov 15 '22 15:11

Renas