Anjan Kumar
Anjan Kumar

Reputation: 23

How to group set of repeated specflow statements?

I would like to know , how to group set of repeated statements in Specflow scenarios. for example.

Given I launch xyz login page
And I enter username as ABC and password as ***** and click login
And i click on Benefits tile
And i click on Xyz section

Is there a way to group these statements instead of using this again and again.

Upvotes: 2

Views: 275

Answers (2)

hiram acebo
hiram acebo

Reputation: 119

I have used the Background tag this will execute the methods before each scenario

Background:
Given I launch xyz login page
And I enter username as ABC and password as ***** and click login
And i click on Benefits tile
And i click on Xyz section

Upvotes: 0

Sam Holder
Sam Holder

Reputation: 32936

Yes. you can create a step which calls the other steps. The documentation for this is here. There is an example of this in this answer

Upvotes: 2

Related Questions