mercredi 25 novembre 2015

Setting up selenium webdriver for parallel execution

I am trying to execute a large suite of selenium tests via xUnit console runner in parallel.

These have executed and I see 3 chrome windows open, however the first send key commands simply executes 3 times to one window, resulting in test failure.

I have registered my driver in an objectcontainer before each scenario as below:

[Binding]
public class WebDriverSupport
{
    private readonly IObjectContainer _objectContainer;

    public WebDriverSupport(IObjectContainer objectContainer)
    {
        _objectContainer = objectContainer;
    }

    [BeforeScenario]
    public void InitializeWebDriver()
    {
        var driver = GetWebDriverFromAppConfig();                       
        _objectContainer.RegisterInstanceAs<IWebDriver>(driver);
    }

And then call the driver in my specflow step defintions as:

_driver =   (IWebDriver)ScenarioContext.Current.GetBindingInstance(typeof(IWebDriver));
            ScenarioContext.Current.Add("Driver", _driver);

However this has made no difference and it seems as if my tests are trying to execute all commands to one driver.

Can anyone advise where I have gone wrong ?

Aucun commentaire:

Enregistrer un commentaire