I am working on setting up a distributed testing environment and am running in to an interesting issue. When running tests in parallel the tests seem to get routed to the correct nodes and execute to a point however the hub seems to be sending the browser close and session close commands for all tests being run in in parallel to a single node instead of one to each node that is running as should occur.
Some Background:
I have developed a testing framework to test one of our organizations applications using C#, the C# selenium language bindings, NUnit, and Selenium Grid. My tests are rather simple right now (I simply open up a browser and navigate to Google) to verify the functionality of my Selenium Grid.
The issue I am running in to only occurs when I run tests in parallel. When executing my tests in a single file fashion they appear to get sent to the hub and then are relegated to the proper nodes and run successfully.
I am achieving parallel execution of my tests by applying the [Parallelize] attribute at the [TestFixture] level of my classes.
My environment is currently one Windows 2012 R2 server running Selenium Server 3.0.1 in hub mode, the same server running Selenium Server 3.0.1 in Node mode, and one MacBook Air running Selenium Server 3.0.1 in node mode.
The configuration for my Windows node is as follows:
{
"capabilities":
[
{
"browserName": "firefox",
"maxInstances": 5,
"seleniumProtocol": "WebDriver"
},
{
"browserName": "chrome",
"maxInstances": 5,
"seleniumProtocol": "WebDriver"
},
{
"browserName": "internet explorer",
"maxInstances": 1,
"seleniumProtocol": "WebDriver"
}
],
"maxSession": 5,
"port": 5555,
"register": true,
"registerCycle": 5000,
"hub": "REDACTED",
"nodeStatusCheckTimeout": 5000,
"nodePolling": 5000,
"role": "node",
"unregisterIfStillDownAfter": 60000,
"downPollingLimit": 2,
"debug": false,
"servlets" : [],
"withoutServlets": [],
"custom": {}
}
My Windows hub configuration is as follows:
{
"port": 4444,
"newSessionWaitTimeout": -1,
"servlets" : [],
"withoutServlets": [],
"custom": {},
"capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
"throwOnCapabilityNotPresent": true,
"cleanUpCycle": 5000,
"role": "hub",
"debug": false,
"browserTimeout": 0,
"timeout": 1800
}
An example of my tests being run are as follows:
namespace BSPTests
{
[TestFixture]
[Parallelizable]
public class ParallelTestsTwo
{
[Test]
public void TestMethod2()
{
Driver.Initialize("safari", "MAC", "HUB_URL_HERE");
Debug.GoTo("http://www.google.com");
Driver.Close();
}
}
}
My Driver.Close() code is as follows: (Driver is a method that wraps my current instance of the RemoteWebDriver)
public static void Close()
{
// Close the currently open browser and dispose of the currently open instance
Instance.Close();
Instance.Dispose();
}
Does anyone have any advice as to how to make my grid function properly?