What could be the scariest words for an application developer? ‘This application is pathetic,’ ‘This app has too many bugs and it’s not worth its name,’ or ‘It is a scam as this application doesn’t even function properly,’ etc. would turn out to be a nightmare for an android application developer.
So, what happens eventually? When an application is published on Google Play, it should be free of bugs and apparent technical glitches. A series of testing processes needs to be carried out before the application is broadcasted for use. To safeguard the testing effort, a testing tool for Android App called Selendroid comes into the picture.
Selendroid is an automated test framework for multiple mobile application including native and hybrid android application as well as for mobile web.
Selendroid & why it matters:
One of the best frameworks for testing Android apps, Selendroid is an open source automation framework that helps enable the user interface of the Android native, hybrid and mobile web app. It is based on the instrumentation framework of the Android and the tests are simply written using the Selenium 2 client API. To use Selendroid, you should have the knowledge base of using Selenium. The automation framework is thus, used on real devices and emulators and is integrated as a node into the Selenium Grid for scaling and parallel testing.
1. It is open source: Selendroid is an open-source test-mobile automation tool that has a built-in element inspector that enables quick script development. Although it only supports Java Language for scripting, the built-in inspector tool checks the user interface element of the application during the test and in turn, helps in developing varied test cases for the developer. One of the essential features of the tool is that you are not required to modify the application during the test as you are only required to install the binary file into your computer. The only requirement to be considered is that both, the test app as well as the mobile app must be signed in with the same key during installation.
2. Supports all Android Versions: The most functional feature of Selendroid is that the testing tool can be easily used on multiple devices or simulators which acts as the biggest advantage to the developers. This enables the developer to test the application with various Android devices simultaneously to check its compatibility. From API 10 to API 19, Selendroid supports all the new ANDROID API versions, and so, the testing tool immediately recognises the new device automatically while testing without the need to restart or stop the test in the middle. It gives an easier option to change the hardware devices (plug and unplug) during the test.
3. Easy to Implement: To automate the testing tool, you needn’t modify the application under test. You simply need to install the binary file (APK) on the computer. As mentioned above, the Selendroid has the Selendroid Inspector which is already embedded inside the testing server which helps to inspect the current status of the application’s UI. It automatically displays the source php of a web view and also records the click actions making it easy to be implemented. Selendroid supports advanced UI API in which human user actions such as swipe, touch, drag and drop etc. on an application can be simulated easily for more comprehensive testing and implementation.
4. Effective while Executing Native Applications as well as Cloud-Based Applications: Since it is an open source, Selendroid supports Selenium language script and is compatible with other webdriver languages including Java, C#, Perl etc. While executing native apps and cloud-based apps, it verifies object recognition using the object properties and thus, makes it easier for the tester to implement the testing tool to achieve the desired output.
5. Works on Emulators and Real Devices: Since it is not an easy task to validate each and every application that is being produced as it is a time-consuming effort and also, the Android applications, mobile versions etc. are not constant; the tester may find it difficult to define the scope of the entire test. Hence, to conquer this dependency on the device, emulators are being created that provide real-time like environment to test the application and their versions. This testing is automated to ensure faster outcome using a scripting language. This feature is highly advantageous wherein the compatibility of the testing app can be determined in various emulators and Android devices simultaneously.
Setting up & testing using Selendroid
The Selendroid tools work effectively on Windows, Linux as well as Mac OS. To set up the Selendroid testing tool for your application, following steps need to be implemented:
1. The foremost requirement is to create the environment for the testing tool and for that, you need to first download and install JAVA SDK (minimum 1.6) software, the latest version of Android SDK, plug in at least one real Android Device or AVD into the computer along with Eclipse Software, Selendroid Standalone with dependencies, Selendroid Client and Selenium Client. Now you need to setup the Android Home and Java Home on your computer and the appropriate environment is created.
2. The next step is to download and launch the Selendroid Test App and Selendroid Standalone jar and give the run command on your computer. This is done with the help of the following command:
java -jar selendroid-standalone-0.11.0-with-dependencies.jar -app selendroid-test-app-0.11.0.apk
Once, you hit the run command; the Selendroid server will start on your system. This will identify the Android target version, any emulator running and any hardware Android device attached to the computer.
The default port number of the server is 4444, which will start automatically, once you hit the run command on your computer for the testing tool to start functioning. You also can change the port number by adding a parameter to the command.
3. The 3rd step is to create a Java Project, build Selendroid Standalone Libraries, Selenium Jars and JUnit libraries in the build path of your computer. You need to create a package under the Java Project and write the required code in the class created under the package. Once it is done, all you need to do is run the class with testing run configuration.
With the help of four components, i.e. WebDriver client, Selendroid Server, Android Driver App and Selendroid-stand-alone, you can use the automated testing tool on any real device or emulators to test android native app, the hybrid app as well as the web application. It is considered to be a potent tool in today’s era which is guided by e-commerce, mobile networking and online commerce.