JAVA单元测试框架-9-testng.xml管理依赖

在testng.xml里配置依赖管理,先写个测试用例

 @Test(description="测试分组" ,groups= {"operation"})
    public void TestGroupAdd() {
        System.out.print(String.valueOf(11+12));
    }
    @Test(description="测试分组" ,groups= {"operation","Animal"})
    public void TestGroupAnimal() {
        System.out.printf("animal 动物");
    }
    @Test(description="测试分组" ,groups= {"Animal"})
    public void TestGroupCat() {
        System.out.printf("cat 喵喵");
    }
    @Test(description="测试分组" ,groups= {"laguage"})
    public void TestGroupLaguage() {
        System.out.printf("chinese 汉语");
    }

testng.xml配置 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="All Test Suite">
    <test verbose="2" preserve-order="true" name="D:/IdeaProject/interfaceRestAssured">
        <groups>
            <define name="groups" >
                <include name="operation"></include>
                <include name="Animal"></include>
                <include name="laguage"></include>
            </define>
            <dependencies>
                <group name="Animal" depends-on="laguage"></group>
            </dependencies>
        </groups>
        <classes>
           <class name="TestNg.TestGroup"></class>
        </classes>
    </test>
  <!--  <listeners>
        <listener class-name="report.ExtentReport"></listener>
    </listeners>-->
  <!-- 这是reportNG的监听类-->
    <listeners>
         <listener class-name="org.uncommons.reportng.HTMLReporter"></listener>
         <listener class-name="org.uncommons.reportng.JUnitXMLReporter"></listener>
     </listeners>
</suite>

运行结果:

JAVA单元测试框架-9-testng.xml管理依赖

上一篇:Python项目打包


下一篇:JS之JSON.parse和JSON.stringify