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设计模式之单例模 ...
随机推荐
- 【leetcode】Convert Sorted List to Binary Search Tree (middle)
Given a singly linked list where elements are sorted in ascending order, convert it to a height bala ...
- iOS蓝牙4.0
iOS的蓝牙用到了 CoreBluetooth 框架 首先导入框架 #import <CoreBluetooth/CoreBluetooth.h> 我们需要一个管理者来管理蓝牙设备,CB ...
- September 20th 2016 Week 39th Tuesday
Failure is not fatal, but failure to change might be. 失败并不致命,但无法改变却可能是致命的. I need change, but it see ...
- sql 查询最近30分钟或者自定义时间数据
) FROM dual; 30分钟或者自定义
- Google 如何修复 TrustManager 实施方式不安全的应用
引用谷歌市场的帮助说明:https://support.google.com/faqs/answer/6346016 本文面向的是发布的应用中 X509TrustManager 接口实施方式不安全的开 ...
- json_encode() 和 json_decode()
php json_decode返回数据js的处理,json_decode后,返回到前台的数据如:encode_str => {"green":10,"size&qu ...
- vim 查找时忽略大小写
:set ic 忽略大小写#ignorecase :set noic 不忽略大小写#noignorecase
- Ubuntu下安装Python3.4
转自:http://blog.sina.com.cn/s/blog_7cdaf8b60102vf2b.html 1. 通过命令行安装Python3.4,执行命令:sudo apt-get instal ...
- Server.MapPath查询路径那几件事
主要总结Server.MapPath 这个方法的使用以及使用的场景,不是什么时候都适合使用: 1.实现功能: Server.MapPath能够获取指定URL相对服务器的物理路径,在IIS服务端,能够根 ...
- SQL脚本书写的几点建议
1.索引很关键,创建合理的索引,提升查询速度: DBCC FREEPORCCACHE DBCC DROPCLEANBUFFERS ...