I seem to be having an issue when attempting to run tests in parallel using TestNG alongside Selenium Grid 2.
Although the right number of browsers are opened to match the amount of tests that I'm running , all instructions for all tests are being fired to the same browser window. For example, each test will open a page and attempt to log in. Four browser windows will open, but one browser window will navigate to the login page four times and then type the username in 4 times, whilst the rest of the browser windows remain inactive.
Here's how I'm starting grid:
java -jar selenium-server-standalone-28.0.jar -role hub
java -jar selenium-server-standalone-28.0.jar -webdriver.chrome.driver="*location*/chromedriver_mac" -role node
This is how the suite xml is set up:
<suite name="testng" verbose="1" parallel="classes">
<test name="chrome">
<packages>
<package name="login"/>
<package name="lists"/>
</packages>
</test>
</suite>
And here's an example of how the tests are laid out:
public class login_logout extends TestBase {
@Test
public void login(){
//initiates login page object and call super user login
LoginPage login = LoginPage.navigateTo(driver, base_url)
LoggedInPage loggedIn = login.superuserlogin();
}
}
Test Base is laid out as follows:
public class TestBase {
public static WebDriver driver;
public static DesiredCapabilitiess capabilities;
@BeforeClass
public static void setUp(){
base_url = "*login page url*;
capabilities = DesiredCapabilities.chrome();
driver = new RemoteWebDriver(capabilities);
driver.get(base_url);
}
}
It's probably something really obvious that I'm missing but any help would be appreciated.
Thanks in advance.