国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

TestNG入門指導——include/exclude中的正則表達式

2019-11-10 20:55:01
字體:
來源:轉載
供稿:網友

TestNG中的include/exclude屬性支持使用正則表達式,下面讓我們一起來學習其用法:新建一個java項目,如下結構

RegularExpClass中增加如下代碼:

package test.regularexppackage;import org.testng.annotations.Test;public class RegularExpClass {@Testpublic void includeTestFirst(){System.out.PRint("First include test method");}@Testpublic void includeTestSecond(){System.out.print("Second include test method");}@Testpublic void excludeTestFirst(){System.out.println("First exclude test method");}@Testpublic void excludeTestSecond(){System.out.println("Second exclude test method");}@Testpublic void includeMethod(){System.out.println("Include method");}@Testpublic void excludeMethod(){System.out.println("Exclude method");}}

excreg-testng.xml中增加如下配置信息 (testNG 中任意字符的表示方法 .*)

<?xml version="1.0" encoding="UTF-8"?><!-- 執行方法名中包含Testd的方法 --><suite name="Regular Exp Suite" verbose="1"><test name="Regular Exp Test"><classes><class name="test.regularexppackage.RegularExpClass"><methods><include name=".*Test.*" /></methods></class></classes></test></suite>

increg-testng.xml 中增加如下配置信息

<?xml version="1.0" encoding="UTF-8"?><!-- 不執行方法名中包含Testd的方法 --><suite name="Regular Exp Suite" verbose="1"><test name="Regular Exp Test"><classes><class name="test.regularexppackage.RegularExpClass"><methods><exclude name=".*Test.*" /></methods></class></classes></test></suite>

選擇對應的xml文件然后右擊——run as 【TestNG Suite】檢查執行結果


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 华阴市| 奉新县| 昌乐县| 普洱| 宣武区| 连云港市| 肥西县| 自贡市| 绩溪县| 东乡| 漠河县| 垦利县| 东方市| 叙永县| 青田县| 体育| 曲水县| 射洪县| 来安县| 琼海市| 泗洪县| 博兴县| 玉门市| 柘荣县| 威信县| 吴江市| 扶绥县| 天水市| 浙江省| 辉南县| 阿巴嘎旗| 原阳县| 公安县| 峡江县| 调兵山市| 赤峰市| 孟州市| 霍山县| 朝阳县| 汶川县| 汉阴县|