TestNg依赖详解(三)------灵活的文件配置依赖
配置型的依赖测试,让依赖测试不局限于测试代码中,在XML文件中进行灵活的依赖配置
原创文章,版权所有,允许转载,标明出处:http://blog.csdn.net/wanghantong
Javacode:
- /**
- *
- * <p>
- * Title: TestngDependencyOnXML
- * </p>
- *
- * <p>
- * Description: 不使用注解的情况下,通过对testng-xml来进行依赖配置
- *
- * 执行原则:
- * 被依赖的group最先执行,如果某个group没有被配置成被依赖,那么它将在被依赖的group之后执行,最后执行的是需要依赖其它group的方法
- * ,如果都没有配置依赖,则按顺序执行.一个方法有多个依赖时用空格隔开
- * </p>
- *
- * <p>
- * Company:
- * </p>
- *
- * @author : Dragon
- *
- * @date : 2014年10月21日
- */
- 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>
运行结果:
- 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
- ===============================================
总结: 被依赖的group最先执行,如果某个group没有被配置成被依赖,那么它将在被依赖的group之后执行,最后执行的是需要依赖其它group的方法,如果都没有配置依赖,则按顺序执行.一个方法有多个依赖时用空格隔开
TestNg依赖详解(三)------灵活的文件配置依赖的更多相关文章
- java分享第十四天(TestNG Assert详解)
TestNG Assert 详解org.testng.Assert 用来校验接口测试的结果,那么它提供哪些方法呢? 中心为Assert测试类,一级节点为方法例如assertEquals,二级结点为参 ...
- Android 之窗口小部件详解(三) 部分转载
原文地址:http://blog.csdn.net/iefreer/article/details/4626274. (一) 应用程序窗口小部件App Widgets 应用程序窗口小部件(Widget ...
- JAVA TestNG单元测试详解
TestNG单元测试详解 by:授客 QQ:1033553122 1. 测试环境 2 2. 介绍 2 3. Annotation 2 4. testng.xml 3 4.1. 例1 3 4.2. ...
- pscp使用详解 Windows与Linux文件互传工具
pscp使用详解 Windows与Linux文件互传工具 pscp使用方法详解:pscp是putty安装包所带的远程文件传输工具,是一款十分常见windows与linux系统之间文件互传的工具,使用方 ...
- .NET DLL 保护措施详解(三)最终效果
针对.NET DLL 保护措施详解所述思路完成最终的实现,以下为程序包下载地址 下载 注意: 运行环境为.net4.0,需要安装VS2015 C++可发行组件包vc_redist.x86.exe.然后 ...
- elasticSearch+spring 整合 maven依赖详解
摘自:http://www.mayou18.com/detail/nTxPQSyu.html [Elasticsearch基础]elasticSearch+spring 整合 maven依赖详解 Ma ...
- WebSocket安卓客户端实现详解(三)–服务端主动通知
WebSocket安卓客户端实现详解(三)–服务端主动通知 本篇依旧是接着上一篇继续扩展,还没看过之前博客的小伙伴,这里附上前几篇地址 WebSocket安卓客户端实现详解(一)–连接建立与重连 We ...
- logback -- 配置详解 -- 三 -- <encoder>
附: logback.xml实例 logback -- 配置详解 -- 一 -- <configuration>及子节点 logback -- 配置详解 -- 二 -- <appen ...
- python设计模式之装饰器详解(三)
python的装饰器使用是python语言一个非常重要的部分,装饰器是程序设计模式中装饰模式的具体化,python提供了特殊的语法糖可以非常方便的实现装饰模式. 系列文章 python设计模式之单例模 ...
随机推荐
- 【jquery】字符ascii码转换函数
js 字符ascii码转换函数 字符转ascii码:用charCodeAt();ascii码砖字符:用fromCharCode(); 看一个小例子 <script> str="A ...
- linker command failed with exit code 1 (use -v to see invocation)
library not found for -|AFNetworking 错误内容如图所示: 解决方法:1. 如果没有安装pod,则安装pod,并导入项目AFNetworking参考:http://w ...
- [Android Pro] Service (startservice , bindservice , unbindservice, stopService)
1: startService -------stopService (this will call onDestroy) 2: bindService -------unbindService ...
- c++中有些重载运算符为什么要返回引用
事实上,我们的重载运算符返回void.返回对象本身.返回对象引用都是可以的,并不是说一定要返回一个引用,只不过在不同的情况下需要不同的返回值. 那么什么情况下要返回对象的引用呢? 原因有两个: 允许进 ...
- NYOJ题目64鸡兔同笼
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAsAAAAIZCAIAAAAnfB5fAAAgAElEQVR4nO3dO1LjygIG4LsJchZC7I ...
- ASP.NET MVC 使用带有短横线的html Attributes(转载)
转载地址:http://www.nmtree.net/2013/10/25/asp-net-mvc-use-dash-in-html-attributes.html 情景再现 我们常常需要一个文本框来 ...
- .net学习之进程外Session的配置
转载地址:http://www.cnblogs.com/rohelm/archive/2012/05/13/2498465.html 人人都知道怎么去使用session,但是初学者,尤其是自学的学生可 ...
- PostgreSQL的时间/日期函数使用
PostgreSQL的常用时间函数使用整理如下: 一.获取系统时间函数 1.1 获取当前完整时间 select now(); david=# select now(); now ----------- ...
- Oracle【IT实验室】数据库备份与恢复之二:SQL*Loader
2.1 基本知识 Oracle 的 SQL* LOADER 可以将外部格式化的文本数据加载到数据库表中.通常 与 SPOOL导出文本数据方法配合使用. 1.命令格式 SQLLDR keyw ...
- URAL 1966 Cycling Roads 点在线段上、线段是否相交、并查集
F - Cycling Roads Description When Vova was in Shenzhen, he rented a bike and spent most of the ...