Configures Cucumber for BDD scenarios - Cucumber-JVM (Java/Kotlin via JUnit 5), Cucumber-JS (Node), Cucumber-Ruby. Authors `.feature` files in Gherkin, writes step definitions in the host language, runs via the framework's runner, integrates with JUnit XML reporting. Use when the user mentions Cucumber, Gherkin, `.feature` files, or behavior-driven (BDD) tests in Java, Kotlin, JavaScript, or Ruby, as the canonical wrapper for any of the three official implementations.
80
100%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Full step-definition and JUnit XML reporting examples for cucumber-testing (Steps 5 and 7). The Gherkin feature they bind to is in Step 4 of the SKILL.md.
import io.cucumber.java.en.*;
public class CheckoutSteps {
private Cart cart;
private CheckoutPage page;
@Given("a logged-in user with email confirmed")
public void a_logged_in_user() {
TestUser user = TestUsers.loggedInWithEmailConfirmed();
page = new CheckoutPage().loginAs(user);
}
@Given("the cart contains {int} of {string} at ${double}")
public void the_cart_contains(int qty, String sku, double price) {
cart = new Cart();
cart.addItem(new Item(sku, qty, price));
page.setCart(cart);
}
@When("I enter {string} in the promo input")
public void i_enter(String code) {
page.enterPromo(code);
}
@When("I click {string}")
public void i_click(String label) {
page.click(label);
}
@Then("the subtotal updates to ${double}")
public void the_subtotal_updates(double expected) {
assertEquals(expected, page.getSubtotal(), 0.01);
}
}const { Given, When, Then } = require('@cucumber/cucumber');
Given('a logged-in user with email confirmed', function() {
this.user = createLoggedInUser();
this.page = new CheckoutPage(this.user);
});
When('I enter {string} in the promo input', function(code) {
this.page.enterPromo(code);
});
Then('the subtotal updates to ${float}', function(expected) {
assert.equal(this.page.getSubtotal(), expected);
});Cucumber outputs to multiple formats; JUnit XML is the CI-canonical one.
JVM (in cucumber.properties):
cucumber.plugin=pretty,html:target/cucumber-report.html,junit:target/cucumber-report.xmlJS (CLI):
npx cucumber-js features/ \
--format html:reports/cucumber.html \
--format junit:reports/cucumber.xmlThe JUnit XML feeds junit-xml-analysis (in the qa-test-reporting plugin).