SpecFlow新手
如果我设置我的Given,When和Then场景并且不传递参数,那么一切正常:
鉴于登录WebQA
[Given(@"Login to WebQA")]
public void LoginToWebQA()
{
Run Code Online (Sandbox Code Playgroud)
Web上的所有读数都表明我所要做的就是更改属性以包含正则表达式,并将参数添加到方法中,如下所示:
[Given(@"Login to '(.*)'")]
public void LoginTo(string url)
{enter code here
Run Code Online (Sandbox Code Playgroud)
但是当我这样做,重新编译并运行测试时,我收到以下错误:
No matching step definition found for one or more steps.
Run Code Online (Sandbox Code Playgroud)
[Binding] public class StepDefinitions {[Given(@"Login to WebQA")] public void GivenLoginToWebQA()
提前致谢
乔
尝试没有单引号:
[Given(@"Login to (.*)")]
public void LoginTo(string url)
{enter code here
Run Code Online (Sandbox Code Playgroud)
这是我使用的随机代码示例:
鉴于某某
什么时候这样
那么结果描述应该是[测试描述]
[Binding]
public class AssertionSteps
{
[Then(@"result description should be (.*)")]
public void ThenResultDescriptionShouldBe(string hitDescription)
{
//here I also clean up the param value to remove []
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4756 次 |
| 最近记录: |