运行 在具有 Specflow 行的整个 Specflow 场景中?

Run in an entire Specflow scenario with a Specflow line?

我有一个 Specflow 场景,它 运行 通过我们应用程序中的向导创建一个表单,就像用户所做的那样。我们将此称为场景 A。

现在,我需要创建另一个场景,采用创建的表单并填写它 out/submits。我们称此为场景 B。

为了能够运行场景B,我需要场景A先运行。有没有办法在场景 B 中使用 Background 关键字 运行 整个场景 A?或者还有其他方法吗?

您可以从其他步骤中调用步骤,因此您可以创建一个步骤来调用所有步骤,包括后台步骤:

Backgroud:
   Given I have done this

Scenario:
   Given another thing
   And this other thing

然后你可以像这样创建一个步骤

[Binding]
public class MySteps: Steps //<- this is important if you want to reuse steps
{

    Given("I have done eveything")]
    public void GiveIHaveDoneEverything()
    {
        Given("I have done this");
        Given("another thing");
        Given("this other thing");
    }
}