Appium tests using cucumber

Some important points

  1. Cucumber is a very popular BDD framework
  2. We can write tests in Gherkin syntax
  3. We can use any Unit testing framework (junit, nunit etc) with Cucumber.
  4. You need to install cucumber for Java and gherkin plugins in IntelliJ IDEA

Before we dive into the example, let me tell you that you will need to add below dependency in the POM file. Note that version of this dependency and JDK ( should be compatible. If you use incompatible versions, you would get into trouble.


Below feature file shows how we can write scenarios.

Feature: Calculator

Scenario: addition
  Given I click on battery setting
  Then battery settings should be displayed

Below code shows how to write the step definitions. If you are running the feature file using plugin, make sure that glue setting is set to the path of step definition class path.

package org.softpost.stepdefs;
import framework.DriverUtil;
import io.cucumber.java8.En;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.softpost.pages.Home;
import org.springframework.util.Assert;

public class MyStepdefs implements En {

    WebDriver driver = DriverUtil.getDriver();
    public MyStepdefs() {
        Given("^I click on battery setting$", () -> {
            Home home = new Home(driver);

        Given("^battery settings should be displayed$", () -> {

Web development and Automation testing

solutions delivered!!