You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TFS/VSTS – Task – PLEASE SPECIFY THE NAME OF THE TASK
Command line – PLEASE SPECIFY THE FULL COMMAND LINE
<SpecFlow> Section in app.config
<specFlow>
<unitTestProvider name="MsTest" />
<plugins>
<add name="AutomationFramework" type="Runtime"></add>
</plugins>
<stepAssemblies>
<stepAssembly assembly="AutomationFramework.SpecFlowPlugin" />
</stepAssemblies>
<!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config -->
</specFlow>
Repro Project
using TechTalk.SpecFlow.Plugins;
using BoDi;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using AutomationFramework.SpecFlowPlugin;
[assembly: RuntimePlugin(typeof(Plugin))]
namespace AutomationFramework.SpecFlowPlugin
{
public class Plugin : IRuntimePlugin
{
public void Initialize(RuntimePluginEvents runtimePluginEvents, RuntimePluginParameters runtimePluginParameters)
{
runtimePluginEvents.CustomizeScenarioDependencies += CustomizeScenarioDependencies;
}
private void CustomizeScenarioDependencies(object sender, CustomizeScenarioDependenciesEventArgs e)
{
e.ObjectContainer.RegisterFactoryAs(WebDriverFactory);
}
public static IWebDriver WebDriverFactory(IObjectContainer container)
{
return new ChromeDriver();
}
}
}
[Binding]
public class WebDriverTestSteps
{
public WebDriverTestSteps(IWebDriver webDriver)
{
}
[Given(@"I will use the browser")]
public void GivenIWillUseTheBrowser()
{
}
}
Issue Description
When registering a dependency using a RegisterFactoryAs, it appears that the dependency is not disposed of properly during the test cleanup.
Note: This is a contrived example: What I really want to do is to be able to select the appropriate IWebDriver instance based on information obtained from IObjectContainer, so usage of RegisterInstanceAs is not appropriate.
Note: I have seen the example:
[Binding]
public class WebDriverSupport
{
private readonly IObjectContainer objectContainer;
public WebDriverSupport(IObjectContainer objectContainer)
{
this.objectContainer = objectContainer;
}
[BeforeScenario]
public void InitializeWebDriver()
{
var webDriver = new FirefoxDriver();
objectContainer.RegisterInstanceAs<IWebDriver>(webDriver);
}
}
However because of #936, I cannot use the TestContext within a BeforeScenario hook
Steps to Reproduce
The text was updated successfully, but these errors were encountered:
SpecFlow Version:
Used Test Runner
Version number:
Visual Studio Version
Are the latest Visual Studio updates installed?
.NET Framework:
Test Execution Method:
<SpecFlow> Section in app.config
Repro Project
Issue Description
When registering a dependency using a RegisterFactoryAs, it appears that the dependency is not disposed of properly during the test cleanup.
Note: This is a contrived example: What I really want to do is to be able to select the appropriate IWebDriver instance based on information obtained from IObjectContainer, so usage of RegisterInstanceAs is not appropriate.
Note: I have seen the example:
However because of #936, I cannot use the TestContext within a BeforeScenario hook
Steps to Reproduce
The text was updated successfully, but these errors were encountered: