[英]Can't call Given, When or Then from inside a SpecFlow step definition
I have a step definition in which I wish to call another step, but it will not compile: 我有一个步骤定义,我希望在其中定义另一个步骤,但无法编译:
[Given(@"I am on the (.*) page")]
public void GivenIAmOnThePage(string url)
{
Given(@"I click the login button"); // cannot find this Given() SpecFlow library method
}
When building I get: 建造时我得到:
The name 'Given' does not exist in the current context
I have this using statement and VS does not suggest any others to complete the code: 我有这个using语句,VS不建议任何其他人来完成代码:
using TechTalk.SpecFlow;
I was missing the inheritance of the TechTalk.SpecFlow.Steps
class... 我错过了TechTalk.SpecFlow.Steps
类的继承...
public class PageNavigation : Steps
{
...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.