Skip to main content

Random values

DrevOps\BehatSteps\Steps\Web\RandomTrait - Source, Example, Helpers

Replace random-value tokens in step arguments and table cells.

  • Resolve [?<name>:<type>[,<args>]] tokens to generated values.
  • Return 1 value per token for the whole scenario.

Built-in types are string, name, machine_name, int, email and uuid. The default is string with length 10, so [?title], [?title:string] and [?title:string,10] share 1 value.

Operates on Gherkin text alone: no Mink session and no backend, so the trait works in any suite.

Skip processing with tag: @behat-steps-skip:RandomTrait.

Options​

OptionTypeDefaultTagDescription
random.enabledbooleanTRUE@behat-steps-skip:RandomTraitReplace [?name:type] tokens in step arguments and table cells. Turn it off to pass a token through to a step untouched.