如何将 Nunit 3 testcontext 添加到 Specflow 场景
How to add Nunit 3 testcontext to Specflow scenario
我想在我的 specflow ScenarioContext 中实现 Nunit testcontext 选项。我尝试在 RandomName.Feature.cs 文件的 ScenarioSetup 方法
中手动添加这一行
testRunner.ScenarioContext.ScenarioContainer.RegisterInstanceAs<NUnit.Framework.TestContext>(TestContext);
testRunner.ScenarioContext.Add("TestContext", TestContext);
但是当前上下文中不存在名称测试上下文。请提供有关如何在 specflow 中使用 Nunit 测试上下文的任何指示
TestContext.CurrentContext 是必需的
testRunner.ScenarioContext.ScenarioContainer
.RegisterInstanceAs<NUnit.Framework.TestContext>(TestContext.CurrentContext);
我想在我的 specflow ScenarioContext 中实现 Nunit testcontext 选项。我尝试在 RandomName.Feature.cs 文件的 ScenarioSetup 方法
中手动添加这一行testRunner.ScenarioContext.ScenarioContainer.RegisterInstanceAs<NUnit.Framework.TestContext>(TestContext);
testRunner.ScenarioContext.Add("TestContext", TestContext);
但是当前上下文中不存在名称测试上下文。请提供有关如何在 specflow 中使用 Nunit 测试上下文的任何指示
TestContext.CurrentContext 是必需的
testRunner.ScenarioContext.ScenarioContainer
.RegisterInstanceAs<NUnit.Framework.TestContext>(TestContext.CurrentContext);