Skip to content

Instantly share code, notes, and snippets.

@bartekpacia
Created September 18, 2025 08:51
Show Gist options
  • Select an option

  • Save bartekpacia/79e7a61788b8914a46a02c04126aa3fd to your computer and use it in GitHub Desktop.

Select an option

Save bartekpacia/79e7a61788b8914a46a02c04126aa3fd to your computer and use it in GitHub Desktop.
Cucumber demo
package demo;
import io.cucumber.java.ParameterType;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import io.cucumber.java8.En;
public class Steps implements En {
@Given("I am hungry")
public void i_am_hungry() {
}
@Then("I am not hungry")
public void i_am_not_hungry() {
}
@When("I eat a cake")
public void i_eat_a_cake() {
}
@ParameterType("red|green|blue")
public String color(String colorStr) {
return colorStr;
}
@Given("another thing should happen")
public void anotherThingHappens() {
}
}
# language: en
Feature: Cake consumption
Scenario: Eating cake
Given I am hungry
When I eat a cake
Then I am not hungry
Scenario: Eating cake
Given I am hungry
When I eat a cake
Then I am hungry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment