本文共 966 字,大约阅读时间需要 3 分钟。
在这部分介绍5.3~5.5
3 组的分组(
Groups of groups)
分组能包含其他分组,这样组称为元组(MetaGroup)。比如像定义个分组"all"包含"checkintest"和functest,而functest组包含windows组合linux组。而checkintest指包含windows。如下展示了这样场景的定义方法
如:当代码有修改而我们又没有时间维护测试代码时,运行的时候就可以把这部分代码排除掉。
解决这个问题的一个办法就是创建一个组"broken",让这些方法属于这个组。如我们想排除之前写的testMethod2()方法:
@Test(groups = {"checkintest", "broken"} ) public void testMethod2() { }
@Test(groups = { "checkin-test" })public class All { @Test(groups = { "func-test" ) public void method1() { ... } public void method2() { ... }}
在这个类中,method2()是分组checkin-test的一部分,而method1()即属于
"checkin-test" 也属于 "func-test".分组。 转载地址:http://rzrub.baihongyu.com/