Saturday, 23 January 2016

Selenium TestNG Parallel Testing


We can launch the N number of browser at a time, then we can run our test in each and every browser at a same time.

we need to configure xml file alone

<Suite name="Suite" parallel="tests" thread-count="3">

<test name="test1">
    <classes>
        <class name="driverFiles.TestNGExecution"></class>
        <methods>
            <include name="TC_01"> </include>
        </methods>
           
    </classes>
   
</test>

<test name="test1">
    <classes>
        <class name="driverFiles.TestNGExecution"></class>
        <methods>
            <include name="TC_01"> </include>
        </methods>
           
    </classes>
   
</test>

<test name="test1">
    <classes>
        <class name="driverFiles.TestNGExecution"></class>
        <methods>
            <include name="TC_01"> </include>
        </methods>
           
    </classes>
   
</test>

</Suite>




From above XML file

1) parallel="tests"  = this we mentioned as create instanace as every test and run browser.

2) thread-count="2"  = its launch the two browser and run two test first. Then third test will execute. If we mention thread-count="3", then its open three browser and run all three tests.

3) We need to create seperate tests.

4) It will take some time from first browser launch time to second browser launch time. if our test steps low means we unable to see the all browser lauch. So its better to have the more lines of code to see the different browser launch at a same time.

No comments:

Post a Comment