Wednesday, 6 August 2014

Automated testing of mobile applications with Robotium Solo

One of the most popular tool for automated testing of mobile applications under OS Android is Robotium Solo. 

To create automated test scripts using Robotium Solo, first the following libraries and tools need to be downloaded and installed: 
- Eclipse – integrated development environment for creating the test project;
- ADT (Android Development Tools);
- SDK (Software Development Kit);
- JDK (Java Development Kit);
- robotium-solo-x.x.jar library for work with Robotium Solo (link);
- re-sign.jar (link).

The next step is customizing the system: 
  • create the system environment variable ANDROID_HOME, indicating the path to sdk (e.g., d:\adt-bundle-windows-x86_64-version\sdk);
  • create the user environment variable JAVA_HOME, indicating the path to jdk (e.g., c:\Progra~1\Java\jdk1.7.version);
  • add paths to the following folders to the PATH variable: \sdk\tools, \sdk\tools\lib, \Java\jdk1.7.0_25\bin, \sdk\platform-tools, and also the following values: %ANDROID_HOME%/tools; %ANDROID_HOME%/platform-tools.

Getting started:
1) run SDK Manager.exe file, create a new virtual mobile device and run it; check that the device has really started (run command adb devices in the console); if the device isn’t displayed in the list or there is a caption offline, you can try to restart the device;
2) change sign of the application, for which you are going to create automated tests, with the help of the prior downloaded library re-sign.jar;
3) install the application (run the following command in the console: adb install path_to.apk);
4) create the project in Eclipse (you should select the same Android version as the device runs);
5) create a new class in the project;
6) add the library robotium-solo-x.x.jar  to the project;
7) change the manifest file AndroidManifest.xml: package = "name of the package where class for testing is located", android:targetPackage = "application package name” (it is displayed in re-sign.jar);
8) in Target tab in Run Configurations specify the device to run test;
9) type the testing class code (the example can be found
here), then run as Android JUnit Test and analyze the results.

Our QA team has great experience in automated testing of mobile applications performed on both real devices and emulators.

If you have questions or amendment, please leave comments below!

No comments :

Powered by Blogger.