testng xml 示例
TestNG的DTD检查文件:http://testng.org/testng-1.0.dtd.php
更多testng配置及说明,请移步http://testdoc.org/docmaster?pid=111
testng.xml文件结构:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="suitename" junit="false" verbose="3" parallel="false" thread-count="5" configfailurepolicy="<span style="font-family:Arial;"><span style="font-size: 14px; line-height: 26px;">skip</span></span>" annotations="javadoc" time-out="10000" skipfailedinvocationcounts="true" data-provider-thread-count="5" object-factory="classname" allow-return-values="true"> <!-- name参数为必须 -->
<suite-files>
<suite-file path="/path/to/suitefile1"></suite-file> <!-- path参数为必须 -->
<suite-file path="/path/to/suitefile2"></suite-file>
</suite-files>
<parameter name="par1" value="value1"></parameter> <!-- name, value参数为必须 -->
<parameter name="par2" value="value2"></parameter>
<method-selectors>
<method-selector>
<selector-class name="classname" priority="1"></selector-class> <!-- name参数为必须 -->
<script language="java"></script> <!-- language参数为必须 -->
</method-selector>
</method-selectors>
<test name="testename" junit="false" verbose="3" parallel="false" thread-count="5" annotations="javadoc" time-out="10000" enabled="true" skipfailedinvocationcounts="true" preserve-order="true" allow-return-values="true"> <!-- name参数为必须 -->
<parameter name="par1" value="value1"></parameter> <!-- name, value参数为必须 -->
<parameter name="par2" value="value2"></parameter>
<groups>
<define name="xxx"> <!-- name参数为必须 -->
<include name="" description="" invocation-numbers="" /> <!-- name参数为必须 -->
<include name="" description="" invocation-numbers="" />
</define>
<run>
<include name="" /> <!-- name参数为必须 -->
<exclude name="" /> <!-- name参数为必须 -->
</run>
<dependencies>
<group name="" depends-on=""></group> <!-- name,depends-on均为参数为必须 -->
<group name="" depends-on=""></group>
</dependencies>
</groups>
<classes>
<class name="classname"> <!-- name参数为必须 -->
<methods>
<parameter name="par3" value="value3"></parameter>
<include name="" description="" invocation-numbers=""></include>
<exclude name=""></exclude>
</methods>
<methods></methods>
</class>
</classes>
<packages>
<package name="" /> <!-- name参数为必须 -->
<package name="">
<include name="" description="" invocation-numbers=""></include>
<exclude name=""></exclude>
</package>
</packages>
<listeners>
<listener class-name="classname1" /> <!-- name参数为必须 -->
<listener class-name="classname2" />
</listeners>
</test>
<test></test>
</suite>
testng.xml文件节点属性说明:
suite属性说明:
@name: suite的名称,必须参数
@junit:是否以Junit模式运行,可选值(true | false),默认"false"
@verbose:命令行信息打印等级,不会影响测试报告输出内容;可选值(1|2|3|4|5)
@parallel:是否多线程并发运行测试;可选值(false | methods | tests | classes | instances),默认 "false"
@thread-count:当为并发执行时的线程池数量,默认为"5"
@configfailurepolicy:一旦Before/After Class/Methods这些方法失败后,是继续执行测试还是跳过测试;可选值 (skip | continue),默认"skip"
@annotations:获取注解的位置,如果为"javadoc", 则使用javadoc注解,否则使用jdk注解
@time-out:为具体执行单元设定一个超时时间,具体参照parallel的执行单元设置;单位为毫秒
@skipfailedinvocationcounts:是否跳过失败的调用,可选值(true | false),默认"false"
@data-provider-thread-count:并发执行时data-provider的线程池数量,默认为"10"
@object-factory:一个实现IObjectFactory接口的类,用来实例测试对象
@allow-return-values:是否允许返回函数值,可选值(true | false),默认"false"
@preserve-order:顺序执行开关,可选值(true | false) "true"
@group-by-instances:是否按实例分组,可选值(true | false) "false"
test属性说明:
@name:test的名字,必选参数;测试报告中会有体现
@junit:是否以Junit模式运行,可选值(true | false),默认"false"
@verbose:命令行信息打印等级,不会影响测试报告输出内容;可选值(1|2|3|4|5)
@parallel:是否多线程并发运行测试;可选值(false | methods | tests | classes | instances),默认 "false"
@thread-count:当为并发执行时的线程池数量,默认为"5"
@annotations:获取注解的位置,如果为"javadoc", 则使用javadoc注解,否则使用jdk5注解
@time-out:为具体执行单元设定一个超时时间,具体参照parallel的执行单元设置;单位为毫秒
@enabled:设置当前test是否生效,可选值(true | false),默认"true"
@skipfailedinvocationcounts:是否跳过失败的调用,可选值(true | false),默认"false"
@preserve-order:顺序执行开关,可选值(true | false) "true"
@group-by-instances:是否按实例分组,可选值(true | false) "false"
@allow-return-values:是否允许返回函数值,可选值(true | false),默认"false"
可以允许的实例
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Default suite" parallel="classes" thread-count="1">
<test verbose="2" name="Default test">
<classes>
<class name="com.fc.htgl.testcases.TestOrder">
<methods>
<include name="getReturnExpressSF"></include>
<include name="getReturnExpressSTO"></include>
</methods>
</class>
<class name="com.fc.htgl.testcases.TestSendExpress">
<methods>
<include name="testCustomerGetExpressSF"></include>
<include name="testCustomerGetExpressSTO"></include>
</methods> </class>
</classes> </test> <!-- Default test -->
</suite> <!-- Default suite -->
testng xml 示例的更多相关文章
- TestNG+Maven+IDEA 自动化测试(二) TestNG.xml
示例代码: https://github.com/ryan255/TestNG-Demo 项目代码结构参考上一章 TestNG+Maven+IDEA 自动化测试(一) 环境搭建 maven插件引入 & ...
- TestNG的testng.xml配置概述
TestNG提供的annotaions用来辅助定义测试类. TestNG的testng.xml配置文件用来辅助定义执行什么样的测试,即testng.xml更像是一个测试规划. testng.xml配置 ...
- testNG官方文档翻译-3 testng.xml
你可以通过以下几种不同的方法触发TestNG: 用一个testng.xml文件 使用ant 从命令行触发 这个章节将会介绍testng.xml的格式(你也可以在下面找到关于ant和命令行的内容). 关 ...
- testng教程之testng.xml的配置和使用,以及参数传递
昨天学习了一下testng基础教程,http://www.cnblogs.com/tobecrazy/p/4579414.html 昨天主要学习的是testng 的annotation基本用法和生命周 ...
- TestNG官方文档中文版(3)-testng.xml
TestNG的官方文档的中文翻译版第3章,原文请见 http://testng.org/doc/documentation-main.html 3 - testng.xml 调用TestNG由几种不同 ...
- testng.xml文件结构组成及节点属性说明
TestNG的DTD检查文件:http://testng.org/testng-1.0.dtd.PHP 更多testng配置及说明,请移步http://testdoc.org/docmaster?pi ...
- testng.xml顺序执行多个case配置
testng.xml顺序执行多个case配置 项目结构如图:
- testng.xml创建及解析
项目右键---TestNG -----> Convert to TestNG 会自动产生一个testng.xml的文件 http://www.cnblogs.com/choosewang/art ...
- TestNG中同一个类中执行多个test()方法如何配置testng.xml
public class IndexInfo extends BaseTesting{ private IndexPage IndexPage1;// private AddEquipmentInfo ...
随机推荐
- 【实验 1-1】编写一个简单的 TCP 服务器和 TCP 客户端程序。程序均为控制台程序窗口。
在新建的 C++源文件中编写如下代码. 1.TCP 服务器端#include<winsock2.h> //包含头文件#include<stdio.h>#include<w ...
- Find命令简介
Find命令主要用于目标的搜索,尽量做到少使用,因为find会消耗大量的系统资源. 使用该命令时,需要避开服务器运行高峰期,最好在指定的小范围内进行搜索,不要轻易使用全盘搜索. Find命令常用的参数 ...
- 自定义ViewGroup 流式布局
使用 public class MainActivity extends Activity { @Override protected void onCreate(Bundle sav ...
- (转)Phonegap VS AppCan
简介 Phonegap PhoneGap是一个用基于HTML,CSS和JavaScript的,创建移动跨平台移动应用程序的快速开发平台.它使开发者能够利用iPhone,Android,Palm,Sym ...
- jquery获取checkbox被选中的值
只用一个循环,就可以找出被选中的checkbox的值 var s; $("[name = b]:checkbox").each(function () { ...
- 创建自托管的SignalR服务端
微软官方例子地址:http://www.asp.net/signalr/overview/deployment/tutorial-signalr-self-host 1.说明: SignalR服务端可 ...
- 自定义标签(JSTL)
自定义标签的步骤: 1.确定需求,如:用<my:date/>输出当前时间 2.编写Java类:需要实现实现接口javax.servlet.jsp.tagext.JspTag 具体的接口为: ...
- MySQL学习笔记(1) - cmd登陆和退出
1. 打开cmd,输入,回车 mysql -uroot -p -P3306 -h127. 1)-u :指定用户名,root为超级权限用户. 2)-p :输入密码,不指定时回车后会提示输入密码,并用*号 ...
- Java protobuf框架使用向导
ProtoBuf,全称是Protocol Buffers, 它是谷歌内部用的一种高效的.可扩展的对结构化数据进行编码的格式规范.谷歌自己内部很多程序之间的通信协议都用了ProtoBuf. 下面介绍的是 ...
- web标准(复习)--5 超链接伪类
今天我们开始学习超链接伪类,包含以下内容和知识点: 链接的四种样式 将链接转换为块状 用css制作按钮 首字下沉 一.超链接的四种样式 超链接可以说是网页发展史上一个伟大的发明,它使得许多页面相互链接 ...