Writing test

Getting started with writing the Behat tests requires grasping a few basic concepts, such as the following:

  • Gherkin language: This is a whitespace, business-readable, domain-specific language created for behavior descriptions, with the ability to be used for a project’s documentation and automated test at once through its Given-When-Then concept. 
  • Features: This is a list of one or more scenarios saved under the *.feature file. By default, the Behat features are to be stored and found in the features/ directory relative to our project.
  • Scenarios: These are the core Gherkin structures, consisting of one or more steps.
  • Steps: These are also known as Givens, Whens, and Thens. Indistinguishable to Behat, they should be distinguishable to ...

Get Mastering PHP 7 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.