Creating Scenarios with different Steps

When we specify a business requirement, we need to specify the pre-conditions, user actions, and expected output. Let's first understand what each of these mean:

  • Pre-condition: This sets the Application Under Test (AUT) in a state where the test case can be executed, or establishing the application context.
  • User action: This refers to the action that a user performs that is in line with the Scenario objective.
  • Expected output: This refers to the application's response after the user action.

So let's have this specification written in Cucumber in this recipe.

How to do it…

In this recipe, we are going to update the Feature file we created in the previous recipe by using the keywords Given, When and Then

Feature: ...

Get Cucumber Cookbook 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.