|
配置型的依赖测试,让依赖测试不局限于测试代码中,在XML文件中进行灵活的依赖配置。
java code:
public class TestngDependencyOnXML {
@Test(groups = { "ss" })
public void a() {
System.out.println("this is method a, Groups ss");
}
@Test(groups = { "ss" })
public void b() {
System.out.println("this is method b, Groups ss");
}
@Test(groups = { "xx" })
public void c() {
System.out.println("this is method c ,Groups xx");
}
@Test(groups = { "xx" })
public void d() {
System.out.println("this is method d, Groups xx");
}
@Test(groups = { "yy" })
public void e() {
System.out.println("this is method e , Groups yy");
}
}
配置文件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="framework_testng">
<test name="testng-dependOnXML" >
<groups >
<dependencies >
<group name="ss" depends-on="xx yy" />
</dependencies>
</groups>
<classes>
<class name="com.dragon.testng.annotation.TestngDependencyOnXML" />
</classes>
</test>
</suite>
运行结果:
[html] view plain copy
this is method c ,Groups xx
this is method d, Groups xx
this is method e , Groups yy
this is method a, Groups ss
this is method b, Groups ss
===============================================
framework_testng
Total tests run: 5, Failures: 0, Skips: 0
===============================================
|
评分
-
查看全部评分
|