我有以下特性文件
特性:员工_编辑员工特性
检查编辑员工页面
我從給定的語句中生成了以下步驟代碼。
@Employee_EditEmployeeFeature
Scenario Outline: Verify invalid format field error displayed (Email Address)
Given I enter an invalid worker email address <EmailAddress>
When I click on the Employee Edit Save button
Then Check invalid format error displayed for worker Email Address field
Examples:
| EmailAddress |
| invalidaddress |
| invalid address@acme.com |
| invalidaddress@acme |
@Employee_EditEmployeeFeature
Scenario Outline: Verify invalid format field error displayed (Passport Number)
Given I enter invalid worker passport number <PassportNo>
When I click on the Employee Edit Save button
Then Check invalid format error displayed for worker passport field
Examples:
| PassportNo |
| 1234 |
| AS1234567 |
我從給定的語句中生成了以下步驟代碼。
[Given(@"I enter an invalid worker email address invalidaddress")]
public void GivenIEnterAnInvalidWorkerEmailAddressInvalidaddress()
{
ScenarioContext.Current.Pending();
}
[Given(@"I enter invalid worker passport number (.*)")]
public void GivenIEnterInvalidWorkerPassportNumber(int p0)
{
ScenarioContext.Current.Pending();
}
由于电子邮件地址步骤生成不正确,例如没有参数,因此当测试运行时,会出现以下错误: 测试名称:VerifyInvalidFormatFieldErrorDisplayedEmailAddress_Invalidaddress 结果消息: Assert.Inconclusive失败。一个或多个步骤未找到匹配的步骤定义。
using System;
using TechTalk.SpecFlow;
namespace MyNamespace
{
[Binding]
public class StepDefinitions
{
[Given(@"I enter an invalid worker email address invalidaddress")]
public void GivenIEnterAnInvalidWorkerEmailAddressInvalidaddress()
{
ScenarioContext.Current.Pending();
}
我在网上搜索了很多,发现其他人也遇到了这个问题,尝试了一些他们提供的解决方案但没有成功。请问有什么建议吗?因为只有在我能够持续生成正确的Scenario Outline特性步骤代码之前,我才能继续进行。