【发布时间】:2017-02-08 19:11:36
【问题描述】:
我试图从步骤定义中调用一个步骤,但是当我这样做时我得到了一个SpecFlowException。
看下面的例子:
[Binding]
public class MySteps: Steps
{
[Given("Doing some actions, getting (.*) and (.*)")]
public void DoingSomeActionsGettingValueAndOtherValue(int a, int b)
{
Given($"I pass first integer {a} and second integer {b}");
}
[Given(@"I pass first integer (.*) and second integer (.*)")]
public void ThenIPassFirstIntegerValueAndSecondIntegerValue(int a, int b)
{
AreEqual(a, b);
}
}
例外情况如下:
-> error: Container of the steps class has not been initialized!
TechTalk.SpecFlow.SpecFlowException: Container of the steps class has not been initialized!
at TechTalk.SpecFlow.Steps.AssertInitialized()
at TechTalk.SpecFlow.Steps.get_TestRunner()
at TechTalk.SpecFlow.Steps.Given(String step)
谁能解释我为什么会收到这个特定的错误以及如何解决它?我在文档方面找不到太多帮助。
【问题讨论】: