简体   繁体   中英

Selenium - TestNG: Tests are not running in parallel - Using selenium + java + browserstack

I have a maven project with one class. When I run my testng.xml file with 3 parallel browsers, All the 3 browsers open but only the first one runs then after the first finishes the second starts to run.

my xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite - some name"  >
    <test name="some name" thread-count="3" parallel="methods" >
        <classes>
            <class name="fed.testCalss">
            </class>
        </classes>
    </test>
</suite>

My driver:

public class Driver {
    public static WebDriver Instance = null;

    public static void Initialize() throws Exception {
        if (Instance == null) {
            System.out.println("Initializing Driver");
            if (AutomationSystemProperties.BROWSER_LOCATION.equals("LOCAL")) {
                Instance = getDriverInstance();
                setDimensions(Driver.Instance, Integer.parseInt(AutomationSystemProperties.SCREEN_SIZE));
            } else if (AutomationSystemProperties.BROWSER_LOCATION.equals("REMOTE")) {
                Instance = getBrowserStackInstance();
                setDimensions(Driver.Instance, Integer.parseInt(AutomationSystemProperties.SCREEN_SIZE));
            } else if (AutomationSystemProperties.BROWSER_LOCATION.equals("REMOTEPC")) {
                Instance = getRemotePcInstance();
                setDimensions(Driver.Instance, Integer.parseInt(AutomationSystemProperties.SCREEN_SIZE));
            }
        }
        Instance.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
    }...

our test class:

@Severity(SeverityLevel.BLOCKER)
@Description("notification ")
@Test(groups = {"withIE"}, alwaysRun = true, dataProvider = "notifications", 
dataProviderClass = DataForTests.class)
public void test1(String arg1, String arg2) throws Exception {
    ui.openBrandHomePage("page1");
    .
    .
    .
}

all the other tests are like this

I think there might be something wrong with the driver. Please let me know if there is a solution for this. Thank you!

try

<suite name="Suite" parallel="methods" thread-count="3">
<test name="some name">

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