by I Gede Nurhadi, Tester Architect at Mitrais

Appium logo

As one of the most popular automation-testing tools on the market nowadays, Appium has been used and implemented as the test framework in many organizations. So what part does Appium actually take in Automation testing?

“Appium provides full access to back-end APIs and DBs, allowing for test automation across all mobile applications, in any language, in any test framework. You can choose your favourites dev tools and more programing languages for writing your tests using the Selenium WebDriver API and specific libraries.”

Automation testing scenarios such as testing multiple devices at once or parallel tests can be handled easily by Appium as well.  

Another tool that works perfectly with Appium for parallel automation is testNG.

“TestNG is a testing framework which has powerful functionalities and is easy to use, inspired by JUnit and NUnit.

Both Appium and testNG are open source tools for automation testing and have a lot of community support. For that reason, these tools are generating a lot of interest and becoming increasingly popular.

Why parallel test?

The main rationale behind parallel automation testing is device compatibility. There are many devices with various versions and specifications that need to be tested in a given test period. Implementing parallel automation testing also give much more time effectiveness.

Here is a comparison between sequential and parallel testing:

Sequential
 Device 1 Test 1 Test 2        
 Device 2     Test 1  Test 2    
 Device 3         Test 1 Test 2
  <--Test period-->

 

Parallel
 Device 1 Test 1 Test 2        
 Device 2   Test 1 Test 2      
 Device 3     Test 1 Test 2    
  <--Test period-->    

 

What needed?

Here are the things that need to be prepared in order to conduct parallel automation testing :

  • 2 Appium servers with different server details, i.e. server port, capabilities, bootstrap and solenoid port.
  • Test script (java) and XML test suite to be run in Eclipse IDE
  • 2 virtual devices (Lollipop and Marshmallow) as our test target.
  • Sample android APK for testing (we’ll use e-Commerce application from APKpure.com)

This is simple schema for the parallel test,

schema for parallel test

Let us start!

First, on the Eclipse IDE we need to run the test scripts by running “testNG suite”, below is the XML test suite sample:

XML test suite sample

For the test scenario, we will run the common test scenarios for testing e-commerce apps (e.g: search product using certain criteria, then select the product and add it to the cart, then open the cart and remove the product).

It is important to set the device capabilities in the test script. Capabilities are the detailed device information, which wrapped into such variables on the test script so the variable value will be in xml test suite.

Below is sample of set variables:

sample of set variables

 

When we successfully run the xml test suite we will see both Appium servers running and start executing our automation test script on the virtual devices. The result will be displayed in the Eclipse console and can be found in the test report bundle in testNG.

Conclusion

In summary, Appium and testNG work perfectly for parallel automation test. Implementing the parallel automation test will be beneficial for device compatibility testing and will significantly reduce test time.