右键单击我的功能文件,我应该可以选择生成步骤定义。它不在上下文菜单中。 我进行了搜索,它说要安装 nunit 的specrun。 我尝试从管理 NuGet 包安装 SpecRun.Nunit。
我收到错误:
Severity Code Description Project File Line Suppression State
Error Unable to load the service index for source
http://packagesource.
An error occurred while sending the request.
The remote name could not be resolved: 'packagesource' 0
我已安装 Visual Studio Enterprise 2017。 我已经安装了 Selenium-webdriver、Specflow
请问这个问题如何解决,谢谢。
您需要从菜单项“工具”->“扩展和更新...”安装specflow nuget包以及Visual Studio集成包
这是我必须做的事情,才能使该选项出现在 VS2019 的上下文菜单中。
现在这是窍门:
像这样:
using System;
using TechTalk.SpecFlow;
namespace SpecflowFirst
{
[Binding]
public class SpecFlowFeature1Steps
{
}
}
像这样:
using System;
using TechTalk.SpecFlow;
namespace SpecflowFirst
{
[Binding]
public class SpecFlowFeature1Steps
{
[Given(@"I navigated to the github login page")]
public void GivenINavigatedToTheGithubLoginPage()
{
ScenarioContext.Current.Pending();
}
}
}
这会触发编译错误。如果您指出“ScenarioContext”中的错误并执行“显示潜在修复”,修复之一就是安装“Sprecflow 扩展”。这样,您就可以安装剩余的集成,该集成现在将在上下文菜单中显示该选项。
这解决了我的问题,现在我可以在上下文菜单中看到“生成步骤定义”