0

I am not able to run in parallel feature files (Java -Maven -Intellij) in browserstack in different browsers. I am able to implement parallel testing in my JUnit framework but do not know how to implement in cucumber Java. Could you please help on this?

Currently, I am able to execute tests on browserstack but only for one browser on time. Please see attached

public class JavaSample {
    public static final String USERNAME = "";
    public static final String AUTOMATE_KEY = "";
    public static final String URL = "https://" + USERNAME + ":" + AUTOMATE_KEY + "@hub-cloud.browserstack.com/wd/hub";

    public static void main(String[] args) throws Exception {
        DesiredCapabilities caps = new DesiredCapabilities();
        caps.setCapability("browserName", "iPhone");
        caps.setCapability("device", "iPhone 8 Plus");
        caps.setCapability("realMobile", "true");
        caps.setCapability("os_version", "11");
        caps.setCapability("name", "Bstack-[Java] Sample Test");

        WebDriver driver = new RemoteWebDriver(new URL(URL), caps);
        driver.get("http://www.google.com");
        WebElement element = driver.findElement(By.name("q"));

        element.sendKeys("BrowserStack");
        element.submit();

        System.out.println(driver.getTitle());
        driver.quit();
    }
}
Robert
  • 7,394
  • 40
  • 45
  • 64
Bill
  • 21
  • 1

1 Answers1

0

You can refer to this sample repo https://github.com/mukeshtiwari1987/Cucumber-Java for running Cucumber Java tests on BrowserStack. To implement parallel execution in cucumber, you may use one of the two approaches mentioned below:

1) Use any open source plugin which allows you to run scenarios or features in parallel based on the parallel scheme you specify

2) Create a runner for each feature file in your test suite and run them in parallel (You will need to write additional scripts/methods for handling reporting at your end).

N3M
  • 286
  • 1
  • 3