如何对一组重复的 specflow 语句进行分组?

How to group set of repeated specflow statements?

我想知道如何在 Specflow 场景中对一组重复语句进行分组。例如。

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

有没有办法将这些语句分组而不是一次又一次地使用它。

是的。您可以创建一个调用其他步骤的步骤。相关文档是 here. There is an example of this in

我已经使用了Background tag这将在每个场景之前执行方法

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