
Mobile application testing has evolved rapidly, especially as teams adopt agile and DevOps practices. While open-source frameworks like Appium and Cucumber remain popular for mobile automation, setting them up and maintaining them can become complex as applications and test suites grow.
Appium enables cross-platform mobile automation, while Cucumber introduces a behavior-driven development (BDD) approach that allows teams to write test scenarios in plain English. Together, they form a powerful—but often resource-intensive—testing stack.
As teams look to balance flexibility with speed and scalability, platforms like Tricentis Testim Mobile complement traditional frameworks by reducing test maintenance overhead and enabling faster validation of real user flows across devices. In this article, we’ll explore Appium and Cucumber, how they work together, and how to create a simple mobile automation project using both.
Appium is a completely open-source mobile app automation framework that you can use to test all types of mobile applications written using Kotlin, Java, Objective-C, Swift, React Native and Flutter.
What is Appium?
Appium is a completely open-source mobile app automation framework that you can use to test all types of mobile applications written using Kotlin, Java, Objective-C, Swift, React Native and Flutter.
Test cases in Appium can be written in languages like Java, Python, JavaScript, and PHP. After executing the tests, the app will run automatically on the connected device and show the user interactions as per the test cases.
What is Cucumber?
Cucumber is a tool that uses the BDD (behavioral-driven development) approach to write test cases. The test cases are written like English statements in a language called Gherkin.
We use Given, When, and Then in it, as shown in the screenshot below, which is taken from the official site.

What is the BDD framework?
The behavioral-driven development framework enables software testers to write test cases in plain English. It’s liked by testers, managers, and other stakeholders who have a problem understanding complicated programming languages.
Cucumber is one of the top frameworks to implement BDD. It uses a language called Gherkin, in which we can write test cases.
Is Cucumber used for automation testing?
Cucumber can be used for automation testing with the help of other frameworks.
Selenium is the top framework for automation testing in web apps. Furthermore, it works very well with Cucumber.
We can write test cases in Cucumber using Gherkin for automated testing. Then, these test cases will be run on the browser as if a real user is interacting.
Cucumber also can be used for mobile testing but, again, it needs to be used with a mobile automation framework like Appium.
Can Cucumber be used for mobile testing?
Cucumber also can be used for mobile testing but, again, it needs to be used with a mobile automation framework like Appium.
So, can you use Cucumber with Appium? Yes, we can use Cucumber with Appium. We’re going to learn to do that in this post.
Requirement for test cases with Cucumber
To start, we need to have JDK 8 installed on our system. The steps for the same can be found in our earlier post here.
Aside from this, we also need the Appium server to be installed on our system.
Additionally, we need Android Studio if we’re opening our app through an emulator. So, download Android Studio from this official link. Open the exe(Windows)/dmg(Mac) file and follow the instructions to install Android Studio.
Alternatively, you can choose to connect to a real Android device.
Project setup in IDE
We’ll write our test cases in Java. So, we need any Java-based IDE (integrated development environment) like Eclipse or IntelliJ.
In this post, we’ll use Eclipse to write our test cases. Open Eclipse, and then click on File > New > Other.

Then, write maven in the Wizards search box. After that, select “Maven Project” and click on the “Next” button.

Make sure that the first checkbox for “Create a simple project” is selected. After that, click on the “Next” button.

Now, give the Group ID and Artifact ID, which should be the same. Also, give a nice description.

Now, our project will be opened. Here, we’ll update our pom.xml file to add the dependencies for the project.
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.14.0</version>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.3.0</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-core</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<version>1.2.5</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>gherkin</artifactId>
<version>2.12.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
<version>3.141.59</version>
</dependency>
</dependencies>
Cucumber code in feature file
We’ll write the Cucumber code in a file ending with the .feature extension. This is needed because Cucumber uses the language of Gherkin.
We’ll first create a new folder called features inside src/main/resources.

Next, create a file called calcScenario.feature inside the features folder.
missing image
In this post, we’ll test the built-in calculator app on a connected Android phone.
Now, in the calcScenario.feature file, we have to give a feature. It’s Adding two numbers in the Calculator in our case.
Next, the scenario will define the test. Here, the Given, When, and Then functions define the different features in the test.
Generally, there will be more scenarios, and they will be written by testers.

Writing test cases with Java
Now, the steps in the feature file need to be converted into real test cases. Most of the time, this step is done by the developer.
We’ll write test cases in Java. So, right-click on src/test/java, and then click on “New.” After that, select “Class” to create a new class.

In the next pop-up, give the test file a name. We’ve named it CucumburCalcTest.

In the CucumburCalcTest.java, we’ve imported the required packages first.
package testcucumberappium;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
import io.appium.java_client.AppiumDriver;

Next, in CucumburCalcTest.java, we imported our Appium driver first. Then, in the @Given method called user_open_calculator_app(), we have to give the desired capabilities for Appium.
Notice that it’s the same Given statement from the calcScenario.feature file. Here, we’ve given the device name—it’s UDID—and also the app name.
Now, we’ve given the URL for the Appium server. Let’s connect to the Appium driver by passing the URL and capabilities.
Before going to the next method, we need to find the IDs of some of the calculator app.
Next, in the @When method called user_adds_two_numbers(), we’ll first find the 5, 3, +, and = buttons by their IDs before assigning them to respective variables. Again, the same When statement comes from the calcScenario.feature file.
Finally, we’ll do the @Then method called user_closed_calculator_app(); here, we’re just quitting the test.
This is the Then statement from the calcScenario.feature file.

Automation testing
To start our automated testing, make sure that our Android device is connected to our Mac system. Run the command adb devices, which will show our connected device.

We also need to install the package of maven on our Mac through the brew command. This is required for the Java project. So, give the command below from a Mac terminal.
brew install maven

Now, from the project folder, give the command below. This will install all the packages in our project from the pom.xml file.
mvn clean install

Make sure to start the Appium server. We can do this from the installed GUI server application. After opening it, click on the startServer button.

This will start a locally running Appium server on port 4723.

Now, back in the project, right-click on the CucumburCalcTest.java file. Then, click on Run As > Maven test.

It’ll show the test cases succeeded in the console.

In our connected Android device, 5 will be pressed first, followed by +, then 3, and finally =. This will be done automatically. And it seems as if the user is typing it.

Conclusion
In this article, we explored how Appium and Cucumber work together to enable behavior-driven mobile automation testing. You learned how to set up a Java project, write Gherkin-based test scenarios, implement step definitions, and run automated tests on a real Android device.
While this approach is powerful, it also introduces significant setup effort, ongoing maintenance, and coding requirements—especially as test coverage expands.
For teams looking to move faster with less overhead, Tricentis Testim Mobile offers a modern alternative. By allowing teams to test mobile applications using AI-powered automation—with both coded and no-code options—Tricentis Testim Mobile reduces complexity while improving test stability and scalability.
If you want to validate mobile user flows without managing extensive frameworks or writing large volumes of test code, Tricentis Testim Mobile provides a streamlined path from development to confident release.
