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

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

TestNG入門指導(dǎo)——include/exclude中的正則表達(dá)式

2019-11-10 20:05:43
字體:
供稿:網(wǎng)友

TestNG中的include/exclude屬性支持使用正則表達(dá)式,下面讓我們一起來學(xué)習(xí)其用法:新建一個(gè)java項(xiàng)目,如下結(jié)構(gòu)

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"?><!-- 執(zhí)行方法名中包含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"?><!-- 不執(zhí)行方法名中包含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>

選擇對(duì)應(yīng)的xml文件然后右擊——run as 【TestNG Suite】檢查執(zhí)行結(jié)果


發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 卫辉市| 松阳县| 漾濞| 肇东市| 磐石市| 镇赉县| 兴仁县| 赣榆县| 五家渠市| 新巴尔虎右旗| 德昌县| 弋阳县| 丁青县| 泰州市| 万全县| 朝阳区| 报价| 嘉黎县| 正安县| 牙克石市| 辉南县| 亚东县| 兴业县| 栾川县| 郓城县| 彭泽县| 徐汇区| 莫力| 大埔区| 山东| 新营市| 正定县| 通州市| 禹州市| 古蔺县| 和田县| 太原市| 德保县| 武威市| 安达市| 建始县|