DEV Community

Cover image for Adding Cucumber to an Appium framework without rewriting your tests
Mayvin Ramasawmy
Mayvin Ramasawmy

Posted on

Adding Cucumber to an Appium framework without rewriting your tests

Your Appium suite is green. Then a product manager asks what it covers, and your only answer is a list of Java method names like loginShouldSucceed. The code knows what it tests. Nobody outside the code does.

BDD with Cucumber fixes that by splitting what a test verifies from how it runs. The Gherkin spec is the readable layer; your existing screen objects and assertions stay exactly where they are. No refactor.

This guide covers the integration end to end on a Java 21 + Spring + Appium framework:

  • 🥒 Writing Given-When-Then specs that map to real test behavior
  • 📦 Importing cucumber-bom so cucumber-java, cucumber-spring, and cucumber-junit-platform-engine versions stay aligned
  • 🌱 The CucumberSpringConfiguration class that wires Cucumber's lifecycle into Spring's context
  • 🔌 Why that bridge is what makes @Autowired work inside step definitions
  • 🧱 Translating Gherkin steps into screen object method calls

One detail that trips people up: CucumberSpringConfiguration holds no test logic. It's a declarative pointer — a single annotated class telling Cucumber which Spring context to load. Skip it and your step
definitions get a null driver, because Spring never injects anything.

The full walkthrough, with the Maven setup and the step-definition wiring, is in the article.

👉 Read the full guide here: https://www.mobile-automation.io/bdd-cucumber-appium-framework/

Top comments (0)