mardi 2 février 2021

Parallel execution for Classes not working TestNG.xml file

Im stack in running parallel execution. Need help & use-full thought.

My Driver class:

    @Parameters({"environment","browser"})
@BeforeClass(alwaysRun = true)
public void startUp(String environment, String browser) {
    switch (browser) {
        case "firefox":
            System.setProperty("webdriver.gecko.driver", "/usr/local/bin/geckodriver");
            driver = new FirefoxDriver();
            break;
        case "chrome":
            System.setProperty("webdriver.chrome.driver", "/usr/local/bin/chromedirver";
            driver = new ChromeDriver();
            break;
        default:
            driver = new FirefoxDriver();
    }
    switch (environment) {
        case "fb":
            driver.get("https://facebook.com");
            break;
        case "yahoo":
            driver.get("https://yahoo.com");
            break;
        case "google":
            driver.get("https://google.com");
            break;
    }

Xml File:

<?xml version="1.0" encoding="UTF-8" ?>
<test name="fbe chrome" >
    <parameter name="browser" value="chrome"/>
    <parameter name="environment" value="google"/>
    <classes><class name="framework.google.googlepage"></class></classes>
</test>

<test name="faceboo firefox">
    <parameter name="browser" value="firefox"/>
    <parameter name="environment" value="google"/>
    <classes><class name="framework.google.googlepage"></class></classes>
</test>

Im using page object model, and Extedning Driver Factory to Test Class When i use parallel= "classes" thread-count="2" its run 1 after another class and in different browser. [Not together/sametime]

When i use parallel="tests" Thread-count= "2"

Both browser open same time, 1browser stop working and another browser does double click, doubl sendkeys. work only 1browse with both browser sets of data.

I want to run test parallely with different browser same time,. Need help. not working those code of mine.

Thank you every one.

Aucun commentaire:

Enregistrer un commentaire