testNG groups 分组测试
testNG的分组通过xml文件<groups>标签和@Test(group="组名")来实现分组
xml中关于分组的详细介绍,通过groups 定义一个组,通过<run>标签运行指定的组
<groups>
<!--定义执行组名,在run中使用
@name 必填,组中组的名称
-->
<define name="xxx">
<!--定义包含的测试组,测试方法属于哪个测试组在测试代码注释中定义。
@name 必填,需要包含进组中组的组名
-->
<include name="" />
<include name="" />
</define>
<!--运行组中组的配置-->
<run>
<!--执行指定的组中组,@name必填,与define name一致-->
<include name=""/>
<!--排除指定的组中组,@name必填,与define name一致-->
<exclude name=""/>
</run>
<!--组中组的依赖配置-->
<dependencies>
<!--配置依赖
@name 必填,需要依赖其他组的组名,define中设置
@depends-on 必填,被依赖的组名,define中设置,可以有多个,用空格隔开
-->
<group name="" depends-on=""></group>
<group name="" depends-on=""></group>
</dependencies>
</groups>
例子如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="分组测试">
<test verbose="2" name="baiduSearch">
<groups>
<define name="A">
<!-- f1为A组下的测试方法名 -->
<include name="f1"></include>
<include name="f4"></include>
</define>
<define name="B">
<include name="f2"></include>
</define>
<define name="C">
<include name="f3"></include>
</define>
<run>
<include name="A"></include>
</run>
</groups>
<classes>
<class name="com.selenium.code.TestNGGroupsTest">
</class>
</classes>
</test>
</suite>
Java测试代码如下:
public class TestNGGroupsTest {
@Test(groups="A")
public void f1() { System.out.println("我属于A组");
}
@Test(groups="B")
public void f2() { System.out.println("我属于B组");
}
@Test(groups="C")
public void f3() { System.out.println("我属于C组");
}
@Test(groups="A")
public void f4() { System.out.println("我属于A组");
} }
testNG groups 分组测试的更多相关文章
- TestNg 4.组测试中的方法分组测试
看以下代码: package com.course.testng.groups; import org.testng.annotations.AfterGroups; import org.testn ...
- TestNG(八) 类分组测试
package com.course.testng.groups; import org.testng.annotations.Test; @Test(groups = "stu" ...
- TestNG的组测试和组中组测试
在编写测试的过程中,我们经常遇到只想执行个别或者某一部分/某一类型的测试用例,这时我们可以使用TestNG的分组测试方法 分组测试在配置时,TestNG执行的原则是:只保留最小集合进行执行 看代码: ...
- 学习使用TestNG进行数据驱动测试
转自: https://mp.weixin.qq.com/s/8Bd8LEhiC2pu2VMcyNMGlQ 学习使用TestNG进行数据驱动测试 赵吃饭 51Testing软件测试网 前天 学习使 ...
- testng入门教程12 TestNG执行多线程测试
testng入门教程 TestNG执行多线程测试 testng入门教程 TestNG执行多线程测试 并行(多线程)技术在软件术语里被定义为软件.操作系统或者程序可以并行地执行另外一段程序中多个部分或者 ...
- testng多线程并行执行测试
testng多线程并行执行测试 testng多线程并行执行测试 并行(多线程)技术在软件术语里被定义为软件.操作系统或者程序可以并行地执行另外一段程序中多个部分或者子组件的能力.TestNG允许我们以 ...
- Comparator分组测试
import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.u ...
- testNG之异常测试
@Test(expectedExceptions = ) 在测试的时候,某些用例的输入条件,预期结果是代码抛出异常,那么这个时候就需要testNG的异常测试,先看一段会抛出异常的代码 exceptio ...
- 十、TestNG分组测试
使用 groups 属性 package com.lc.tesgFenZu; import org.testng.annotations.AfterGroups; import org.testng. ...
随机推荐
- 《JavaScript 模式》读书笔记(5)— 对象创建模式2
这一篇,我们主要来学习一下私有属性和方法以及模块模式. 三.私有属性和方法 JavaScript并没有特殊的语法来表示私有.保护.或公共属性和方法,在这一点上与Java或其他语言是不同的.JavaSc ...
- Map m = Collections.synchronizedMap(new HashMap())
Collections.synchronizedMap(new HashMap())让你创建的new HashMap()支持多线程数据的同步.保证多线程访问数据的一致性 来源:http://www.b ...
- # Unity 游戏框架搭建 2019 (十六、十七) localPosition 简化与Transform 重置
在上一篇我们收集了一个 屏幕分辨率检测的一个小工具.今天呢再往下接着探索. 问题 我们今天在接着探索.不管是写 UI 还是写 GamePlay,多多少少都需要操作 Transform. 而在笔者刚接触 ...
- TensorBoard中HISTOGRAMS和DISTRIBUTIONS图形的含义
前言 之前我都是用TensorBoard记录训练过程中的Loss.mAP等标量,很容易就知道TensorBoard里的SCALARS(标量)(其中横纵轴的含义.Smoothing等). 最近在尝试模型 ...
- coding++:java—提取Html文本字符串中的内容
package com.tree.ztree_demo; import java.util.regex.Matcher; import java.util.regex.Pattern; public ...
- el-table分页展示数据
<el-table :data="tableData.slice((currentPage-1)*pageSize,currentPage*pageSize)" :show- ...
- SpringBoot 使用 JSR303 自定义校验注解
JSR303 是 Java EE 6 中的一项子规范,叫做 Bean Validation,官方参考实现是hibernate Validator,有了它,我们可以在实体类的字段上标注不同的注解实现对数 ...
- JMeter中聚合报告的各项参数详解
下面我们来共同学习这些参数的作用: 1.Lable:Label:每个 JMeter 的 element(例如 HTTP Request)都有一个 Name 属性,这里显示的就是 Name 属性的值: ...
- .git/info/refs not valid: is this a git repository?
今天用idea git提交的时候遇到了这个神奇的问题.git/info/refs not valid: is this a git repository? 看了很多网上的都不靠谱,最后自己乱点着找, ...
- Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty messa
1.git提交的时候遇到: # Please enter the commit message for your changes. Lines starting with '#' will be ig ...