TestNG 类分组测试
Posted dwdw
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了TestNG 类分组测试相关的知识,希望对你有一定的参考价值。
package com.course.testng.groups; import org.testng.annotations.Test; @Test(groups = "stu") public class GroupsOneClass1 public void student1() System.out.println("Class中的student1运行.................."); public void student2() System.out.println("Class中的student2运行..................");
package com.course.testng.groups; import org.testng.annotations.Test; @Test(groups = "stu") public class GroupsOneClass2 public void student1() System.out.println("Class2中的student1运行.................."); public void student2() System.out.println("Class2中的student2运行..................");
package com.course.testng.groups; import org.testng.annotations.Test; @Test(groups = "teah") public class GroupsOneClass3 public void teacher1() System.out.println("Class3中的teacher1运行.................."); public void teacher2() System.out.println("Class3中的teacher2运行..................");
<?xml version="1.0" encoding="utf-8" ?> <suite name = "test"> <test name = "RunAll"> <classes> <class name = "com.course.testng.groups.GroupsOneClass1"/> <class name = "com.course.testng.groups.GroupsOneClass2"/> <class name = "com.course.testng.groups.GroupsOneClass3"/> </classes> </test> <test name = "RunStu"> <groups> <run> <include name = "stu"/> </run> </groups> <classes> <class name = "com.course.testng.groups.GroupsOneClass1"/> <class name = "com.course.testng.groups.GroupsOneClass2"/> <class name = "com.course.testng.groups.GroupsOneClass3"/> </classes> </test> </suite>
以上是关于TestNG 类分组测试的主要内容,如果未能解决你的问题,请参考以下文章
Java盲点攻克「TestNG专题」摒弃JUnit单元测试,带你学会使用TestNG测试框架(下篇)