Skip to content

Write your first scenario

Simon Sai edited this page Sep 26, 2024 · 17 revisions

Before you can write a scenario, make sure you finish the Configuration

Create feature files

  • Create a directory to store the feature files.
  • You can use subdirectories to organize and group the files together.
  • You can clone from an existing feature file.
  • Do not create feature files directly in the features folder. image

Using common steps

  • You can write scenarios with predefined common steps, but these are not closely aligned with business language. Therefore, it's not recommended unless you're a developer, and the scenarios won't be reviewed by a BA or PO. image
  • Make sure to assign tags to your feature. If you want to run the feature you're working on, add the tag @wip and use the terminal to execute it:

    mvn test -P wip

  • You can add the step I wait 7 seconds to slow it down, allowing you to observe how it works.
  • Your terminal will look like this after a successful run: image
  • You can get the test report in target folder: image image
  • Don't forget to remove the wait step and the @wip tag once you're done with the scenario.

Using POM

  • Compared to common steps, steps within the Page Object Model (POM) are easier to maintain.
  • Here's how you can build a scenario using POM.
  1. Write your steps in business language: image