简体   繁体   中英

How can I run in browserstack cucumber java features in parallel?

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();
    }
}

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM