Cucumber Scenarios - Cucumber

What is Cucumber Scenarios?

Scenario is one of the center Gherkin systems. each scenario begins with the keyword “scenario:” (or localized one) and is accompanied by way of an elective scenario title. every feature will have one or more scenarios and each scenario consists of one or extra steps. a completely easy instance of scenario may be −

Scenario − confirm help capability.

Given person navigates to face book.

While the consumer clicks on help, then the help web page opens.

Consider a case, in which we need to execute a take a look at situation greater than once. think, we want to ensure that the login capability is operating for all sorts of subscription holders. That requires execution of login capability scenario a couple of instances. copy paste the equal steps as a way to just re-execute the code, does now not seem to be a smart concept. For this, Gherkin presents one extra shape, that is scenario define.

Scenario define is just like scenario structure; the only difference is the provision of more than one inputs. As you could see inside the following example, the check case remains the same and non-repeatable. At the lowest we've furnished a couple of enter values for the variables “Username” and “Password”. at the same time as jogging the actual test, Cucumber will update the variable with enter values provided and it's going to execute the take a look at. as soon as bypass-1 has been done, the take a look at will rerun for second iteration with another input value. Such variable or placeholders can be represented with ”<>” whilst citing with gherkin statements.

Example

Scenario Outline − Login functionality for a social networking site. The given user navigates to Face book.

When the user logs in using the Username as "<username>" and the Password as "<password>", then login should be successful.

There are some suggestions and hints to neatly outline the Cucumber scenarios.

  • Each step need to be really described, in order that it does now not create any confusion for the reader.
  • Do not repeat the check state of affairs, if needed use situation define to put into effect repetition.
  • Develop a check step in a way that, it could be used within multiple eventualities and situation outlines.
  • As a long way as viable, hold each step absolutely independent. for instance: “Given the person is logged in”. this could be divided into two steps
  • Given the user enters the user name.
  • Clicks on login.

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Cucumber Topics