testng perform multiple suite

We know testng configuration file, an .xml there can be only one suite, then how to get it if you want to set up multiple suite? This time we need to use testng tag <suite-files>.

He said the following about one instance I get, first of all I've got two of the suite, is a UItest.xml, one APITest.xml, the code is as follows:

UITest.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="UI test">
    <test name="baidu search test">
        <classes>
            <class name="testcase.CheckLink"></class>
        </classes>
    </test>
</suite>

APITest.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="APITest">
    <test name="API">
        <classes>
            <class name="APITestcase.CheckWeather"></class>
        </classes>
    </test>
</suite>

At this time I also talk about my detours, my project with a maven, maven use when files are associated testng <suiteXmlFiles>, as shown below:

<! - testNg reads the configuration file -> 
                    <suiteXmlFiles> 
                        <suiteXmlFile> the src / Test / Resources / the testng.xml </ suiteXmlFile> 
                    </ suiteXmlFiles>

     Initially I was thinking about more than just configure a <suiteXmlFile> on it and found not feasible after attempt, the execution log can be seen all the tests have been completed the class, but html test report shows only a test suite As a result, it did not, so give up this configuration, of course this is most likely because maven + testng + reportng some configuration I do not understand the relationship caused by this method in future if I come back feasible update.

    Words Reformed problem, and finally to the code simple, I also use a testng.xml to integrate the APITest.xml and UITest.xml, as shown below:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="systemTest">
    <suite-files>
        <suite-file path="APITest.xml"></suite-file>
        <suite-file path="UITest.xml"></suite-file>
    </suite-files>
</suite>

Then only in association maven testng.xml on it, the final result of execution as shown below:

 

 

 

Guess you like

Origin www.cnblogs.com/helenMemery/p/11089067.html