简体   繁体   English

无法从SpecFlow步骤定义内部调用Given,When或Then

[英]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.

相关问题 从SpecFlow中的场景获取当前的步骤定义 - Get current Step definition from of a Scenario in SpecFlow 如何生成列表<T>在 SpecFlow 场景的步骤定义中? - How do I generate a List<T> in the step definition of a SpecFlow Scenario? Specflow 步骤定义 - 涉及页面对象时跨功能共享 - Specflow Step Definition - sharing across features when page objects involved Specflow没有生成正确的步骤定义 - Specflow not generating proper step definition 在步骤定义中从SpecFlow功能文件获取路径 - Get the path from a SpecFlow feature file in a Step Definition 使用步进参数转换时,如何从SpecFlow步进方法中删除多余的参数? - How can I remove superfluous parameters from SpecFlow step method when using step argument transformation? 如何更有效地重用 Given Specflow 步骤 - How can I reuse the Given Specflow step more efficiently 如何适应 specflow 步骤定义以使用一种方法从 specflow 特征文件中接受不同数量的参数 - How to accommodate specflow step definition to accept deferent number of parameters from specflow feature file with one method 从步骤定义的Specflow调用步骤抛出TechTalk.SpecFlow.SpecFlowException:步骤类的容器尚未初始化 - Specflow calling step from step definition throws TechTalk.SpecFlow.SpecFlowException: Container of the steps class has not been initialized 具有通配符属性的Specflow步骤定义映射 - Specflow step definition mapping with wildcard attribute
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM