0

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!

AndiCover
  • 1,724
  • 3
  • 17
  • 38
  • Are you trying to run the dataprovider in parallel as well or only the tests methods in parallel? If you need to run the dataprovider in parallel you need to add few more parameters, see this http://makeseleniumeasy.com/2018/11/03/testng-tutorials-59-dataprovider-in-testng-running-dataprovider-method-in-parallel-parallel-dataprovider-method/ – Nael Marwan Feb 26 '20 at 08:38

1 Answers1

0

try

<suite name="Suite" parallel="methods" thread-count="3">
<test name="some name">
  • This answer is on the Low Quality Posts review queue because you didn't describe your answer. That wastes time of people scanning answers because they have to reverse engineer answers to figure out what they do and how they relate to the question. Please edit your answer and include a description of how your answer solves the problem to avoid deletion. – clearlight Feb 26 '20 at 04:21