0

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.

user6618310
  • 39
  • 1
  • 5
  • 14
  • How are you executing the testng runner? Can you add the runner code? You mention that it works in junit do you mean in parallel with 3 different browser or sequentially? – Grasshopper Apr 12 '18 at 14:09
  • I update it and to run it with different browser I changed the instance of the driver every time – user6618310 Apr 13 '18 at 13:27

0 Answers0