I work in an existing project I want to run one feature cucumber on multiple browser in parallel. So for that I have the feature, steps definition and I create a class runner to test JUnit it works but the using testng I have a problem because in this project they use a method that return one browser like this :
public static WebDriver get() {
WebDriver webDriver = null;
String browserToUse = null;
String browserToUse = System.getProperty("browser");
if (browserToUse == null) {
browserToUse = Constantes.browser;
}
if (browserToUse == null) {
LOGGER.warn("Aucun navigateur a ete renseigne, on prend la valeur par defaut : " + DEFAULT_DRIVER);
browserToUse = DEFAULT_DRIVER;
}
Constantes.browser = browserToUse;
webDriver = get(browserToUse);
return webDriver;
}
and default browser is :
private static final String DEFAULT_DRIVER = "webdriver.chrome.driver";
This method is in relation with all the other classes when I change it all the project doesn't work.
My problem here that I want to return 3 drivers in the same time to be able to run in parllel my test. I tryied with an array or list but it will sequential, with if condition it will return the first browser and the same when I delared 3 times the browser. Any solution or suggestions please ?
My Runner class is :
@RunWith(Cucumber.class)
@CucumberOptions(
features={"D:\\project\\src\\test\\resources\\features\\profile\\Test1.feature"},
glue={"com.soprahr.foryou.automation.steps"}
)
public class TestRunnertest {
}
with JUnit I give him 2 feature then i will be a sequential test but i want it to be a parallel test.