Hi all, in this post, I will explain you a mobile test automation framework which supports both Page Object Model with TestNG and Appium and Cucumber with TestNG and Appium. In this framework, you can use any approach to write your mobile test automation tests and run them in parallel. Before starting this article, I highly suggest you, to start with below appium articles. I will extend Wireless Device Lab architecture and I will add an appium cucumber support in this article.

Cucumber IntelliJ Plugins

In order to add a Appium Cucumber support to our project in IntelliJ IDEA, we need to install “Gherkin” and “Cucumber for JAVA” plugins. You will download and then go to settings -> plugins and then install these plugins.

Cucumber Dependencies

After this step, you need to add below Cucumber Dependencies to your pom.xml.

Cucumber Files and Folders

Then, I created a cucumber package and under this package, I created below packages and files:

  • In features package, we will hold all of our feature files.
  • In steps package, we will write¬†steps of our features. BaseSteps file is a common/base file of all steps files.
  • In tests package, we will have cucumber test classes.

I will explain details of above package and files. ūüėČ

Appium Cucumber TestNG Test Automation Scenario 

Our test scenario is a successful login of isinolsun application.

In feature file, we should write our scenario in Gherkin syntax.

BaseSteps file is the base class of all steps files. In this class, we declared all common variables and functions for all steps files.

We need to write the detailed actions in steps file. In LoginSteps file, I wrote all actions related to our steps.

and now it is time to write our test file. In below test file, we will run all features and generate cucumber reports. If you want, you can also modify this class to run specific cucumber features.

And we should change our TestNG XML file as shown below for parallel execution.

When you run the TestNG.xml file, your mobile tests run in parallel. In this framework, you can both use Page Object Model and Cucumber together with TestNG.

I share this sample project on GitHub: https://github.com/swtestacademy/appium-cucumber-testng-parallel-testing