Parallel = tests, classes,methods in testing.xml of testNG

How to understand parameter "parallel" when setting up it in testing.xml file;


Structure of test suites

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Suite1" parallel="classes" thread-count="4">
<test name="search">
        <classes>
            <class name="com.testcase.Search8"></class>
            <class name="com.testcase.Search9"></class>
        </classes> 
    </test>
    <test name="search2">
        <classes>
            <class name="com.testcase.Search10"></class>
            <class name="com.testcase.Search11"></class>
        </classes> 
    </test>
</suite>
      
parallel = "tests":
<test> search and search2 run in parallel, all the items under the test  ( search8, search9 ) run in order.


parallel = "classes":
<classes> all the <class> under <classes> run in parallel, but <classes> and <classes> run in order.  Search8 and Search9 run in parallel, after running completed. the Search10 and Search11 will run in parallel.


parallel = "methods":
<class> will run in order, all the methods under class will run in parallel.


Conclusion comes out:
if the parallel equals to a small scope. ( parallel = "methods"). then all the big scope (class,test,suite) will run in order, and methods will run in parallel.

(parallel = "classes"), then all the big scope (test,suite) will run in order, the class under classes will run in parallel.

(parallel = "tests"), then all the big scope( suite..)  will run in order, the test will run in parallel.


So if we want to run some scope in parallel, we must make sure the scope running in parallel will be separated from others. This is say, there is no any dependency for any small scope you want to run. Or else, you will get error when you run them in parallel.



猜你喜欢

转载自bzwang.iteye.com/blog/2304062
今日推荐