inst/examples/duplicate_step/tests/acceptance/setup-steps.R

given("I have {int} and {int}", function(a, b, context) {
  context$a <- a
  context$b <- b
})

when("I add them", function(context) {
  context$result <- context$a + context$b
})

when("I add them", function(context) {
  context$result <- context$a + context$b
})

then("the result is {int}", function(expected, context) {
  expect_equal(context$result, expected)
})

Try the cucumber package in your browser

Any scripts or data that you put into this service are public.

cucumber documentation built on Oct. 5, 2026, 9:07 a.m.