Robotium is an Android test automation framework that has full support for native and hybrid applications.
Now that Android Studio is the de facto IDE for Android development, I'm interested to try this with Android Studio. However, I couldn't find a way to set it up.
How to setup and use Robotium to test with Android Studio?
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.
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.
Robotium Test cases can be executed in the Android emulator as well as the Android real device.
Robotium is an extension of the Android test framework and was created to make it easy to write user interface tests for Android applications. Robotium tests inherit from ActivityInstrumentationTestCase2 and allows you to define test cases across Android activities.
Guide:
Add the following line to the dependencies section of the inner build.gradle file (this file is located at the same level as src folder), change version name if required:
androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.2.1'
If for some reason you don't want to let gradle download dependencies for you then you can add them manually: Place robotium.jar into the libs folder. Right click it and select Add as library...
In the src folder create another folder androidTest
Select Create Test. Select the proper superclass for Robotium:
android.test.ActivityInstrumentationTestCase2
How to run the test:
console: in the terminal enter the following command:
./gradlew connectedAndroidTest
The HTML-reports will be generated at "YourApp/YourApp/build/outputs/reports/androidTests/ connected/index.html"
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