Skip to main content

Prerequisites

Before running tests, verify that the following are installed and available on your PATH:
RequirementMinimum versionCheck command
Java (JDK)21java -version
Maven3.xmvn -version
Google ChromeLatest stablegoogle-chrome --version or check Help → About
Selenium 4 includes a built-in driver manager that downloads the matching chromedriver binary automatically. You do not need to download or configure chromedriver manually.

Running all smoke tests

The default configuration in TestRunner.java runs all scenarios tagged @smoke:
mvn test
Maven compiles the project, resolves dependencies, and hands control to maven-surefire-plugin, which runs TestRunner via TestNG. ChromeDriver starts, the browser opens, and each scenario executes in sequence.

Running with a custom tag filter

Override the tag filter at runtime using the cucumber.filter.tags system property:
# Run only @regression scenarios
mvn test -Dcucumber.filter.tags="@regression"

# Combine tags with boolean operators
mvn test -Dcucumber.filter.tags="@smoke and @regression"
mvn test -Dcucumber.filter.tags="@smoke or @regression"

# Exclude a tag
mvn test -Dcucumber.filter.tags="not @wip"
cucumber.filter.tags overrides the tags field in @CucumberOptions for that Maven invocation only. The source file is not modified.

Understanding TestRunner

src/test/java/runners/TestRunner.java is the entry point for the test suite:
runners/TestRunner.java
@CucumberOptions(
    features = "classpath:features",       // location of .feature files
    glue     = {"steps", "hooks"},          // packages Cucumber scans for step defs and hooks
    tags     = "@smoke",                    // default tag filter
    plugin   = {
        "pretty",                           // human-readable console output
        "io.qameta.allure.cucumber7jvm.AllureCucumber7Jvm"  // Allure integration
    }
)
public class TestRunner extends AbstractTestNGCucumberTests {
}
OptionValuePurpose
featuresclasspath:featuresPoints to src/test/resources/features/
gluesteps, hooksPackages scanned for @Given/@When/@Then and @Before/@After
tags@smokeDefault tag filter; overridable at runtime
pluginpretty + AllureConsole output format and Allure result generation

Test output

Console (Surefire)

During the run, pretty plugin prints each scenario and step result to the console:
Scenario: Navegar a la página de RIU y abrir el formulario de registro   # features/RegistroRiu.feature:4
  Given que el usuario navega a la pagina principal de RIU               # RiuSteps.navegarARiu()
  When el usuario acepta las cookies                                      # RiuSteps.aceptarCookies()
  And hace clic en el boton de registrarse                                # RiuSteps.clicRegistrarse()
  And completa el formulario de registro sin fechas                       # RiuSteps.completaElFormularioDeRegistro()
  Then se deberia mostrar la validación de campo requerido para fecha     # RiuSteps.verificarFormulario()
A BUILD SUCCESS line at the end means all scenarios passed.

Allure results directory

After each run, raw test data is written to target/allure-results/. This directory is read by the Allure CLI or Maven plugin to generate the HTML report. See Allure reports for the full workflow.

Cross-platform notes

mvn test
mvn test -Dcucumber.filter.tags="@regression"
Run from the project root (the directory that contains pom.xml).

Common issues

Selenium 4 manages drivers automatically, but if you see a version mismatch, make sure you are using Selenium 4.18.1 or newer (set in pom.xml) and that Chrome is up to date.
This usually means the tag filter returned no matching scenarios. Check that at least one scenario in your feature files is tagged with the tag you specified.
Allure requires the AspectJ weaver JAR, which Maven downloads on the first run. If the build fails with a javaagent error, run mvn dependency:resolve first to populate the local repository.

Build docs developers (and LLMs) love