修改了写入excel方法,并对其他子类进行调整
This commit is contained in:
parent
49c25fa57f
commit
272dba9db8
Binary file not shown.
|
@ -47,4 +47,33 @@ public class ExcelRecord extends AbstractWriteExcel<ExcelRecord> {
|
|||
this.brower = brower;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将xml文件中编写的文档内部超链接内容进行转换
|
||||
* @param linkContent 链接内容
|
||||
* @return 转换后的在poi使用的超链接代码
|
||||
*/
|
||||
private String getDocumentLinkPath(String linkContent) {
|
||||
String[] linkContents = linkContent.split("|");
|
||||
int length = linkContents.length;
|
||||
|
||||
//获取超链接的sheet名称
|
||||
String linkSheetName = linkContents[0];
|
||||
//根据sheet名称以及字段id,获取该字段在sheet中的列数字下标,并将数字下标转换为英文下标
|
||||
String linkColumnIndex = num2CharIndex(getColumnNumIndex(linkSheetName, linkContents[1]));
|
||||
|
||||
String linkRowIndex = "";
|
||||
//获取当前表格的最后一行元素个数
|
||||
int lastIndex = xw.getSheet(linkSheetName).getLastRowNum();
|
||||
//判断当前linkContents是否存在链接行数(即第三个元素)且链接的文本为数字
|
||||
//若符合规则,则将linkRowIndex设置为当前编写的内容
|
||||
//若不符合规则,则将linkRowIndex设置为当前sheet的最后一行
|
||||
if (length > 2) {
|
||||
linkRowIndex = String.valueOf(getPoiIndex(lastIndex + 1, Integer.valueOf(linkContents[2])));
|
||||
} else {
|
||||
linkRowIndex = String.valueOf(lastIndex);
|
||||
}
|
||||
|
||||
//返回文档链接的内容
|
||||
return "'" + nowSheetName + "'!" + linkColumnIndex + linkRowIndex;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ public abstract class AbstractTestCaseWrite<T extends AbstractTestCaseWrite<T>>
|
|||
*/
|
||||
public void relevanceCase(String field, String labelType) {
|
||||
// 判断字段是否存在,若不存在,则抛出异常
|
||||
if (!fieldMap.containsKey(field)) {
|
||||
if (!fieldMap.get(nowSheetName).containsKey(field)) {
|
||||
throw new LabelNotFoundException("当前sheet不存在的标签id:" + field);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@ package pres.auxiliary.work.testcase.file;
|
|||
|
||||
import java.io.File;
|
||||
|
||||
import org.dom4j.DocumentException;
|
||||
|
||||
/**
|
||||
* <p><b>文件名:</b>BasicTestCaseWrite.java</p>
|
||||
* <p><b>用途:</b>在无相应的测试用例文件类时,可使用本类,对自定义的一个测试用例模板进行编辑</p>
|
||||
|
@ -19,9 +21,10 @@ public class BasicTestCaseWrite extends AbstractTestCaseWrite<BasicTestCaseWrite
|
|||
*
|
||||
* @param configFile 测试文件模板xml配置文件类对象
|
||||
* @param caseFile 测试用例文件类对象
|
||||
* @throws DocumentException
|
||||
* @throws IncorrectFileException 文件格式或路径不正确时抛出的异常
|
||||
*/
|
||||
public BasicTestCaseWrite(File configFile, File caseFile) {
|
||||
public BasicTestCaseWrite(File configFile, File caseFile) throws DocumentException {
|
||||
super(configFile, caseFile);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@ import java.io.File;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.dom4j.DocumentException;
|
||||
|
||||
/**
|
||||
* <p><b>文件名:</b>CommonTestCaseWrite.java</p>
|
||||
* <p><b>用途:</b>定义了测试用例中一些基本方法的添加,如添加步骤、预期方法等,使编码时更加直观</p>
|
||||
|
@ -21,9 +23,10 @@ public abstract class CommonTestCaseWrite<T extends CommonTestCaseWrite<T>> exte
|
|||
*
|
||||
* @param configFile 测试文件模板xml配置文件类对象
|
||||
* @param caseFile 测试用例文件类对象
|
||||
* @throws DocumentException
|
||||
* @throws IncorrectFileException 文件格式或路径不正确时抛出的异常
|
||||
*/
|
||||
public CommonTestCaseWrite(File configFile, File caseFile) {
|
||||
public CommonTestCaseWrite(File configFile, File caseFile) throws DocumentException {
|
||||
super(configFile, caseFile);
|
||||
}
|
||||
|
||||
|
@ -117,7 +120,7 @@ public abstract class CommonTestCaseWrite<T extends CommonTestCaseWrite<T>> exte
|
|||
//1.命中一个结果,则直接存入结果
|
||||
//2.命中多个结果或未命中结果,则以“/key1/key2/key3/.../keyN”的形式拼接字符串
|
||||
//获取数据有效性
|
||||
ArrayList<String> dataList = fieldMap.get(getModuleName()).matchDataValidation(keys);
|
||||
ArrayList<String> dataList = fieldMap.get(nowSheetName).get(getModuleName()).matchDataValidation(keys);
|
||||
//存储最终得到的模块信息
|
||||
StringBuilder dataText = new StringBuilder();
|
||||
if (dataList.size() == 1) {
|
||||
|
|
|
@ -2,6 +2,8 @@ package pres.auxiliary.work.testcase.file;
|
|||
|
||||
import java.io.File;
|
||||
|
||||
import org.dom4j.DocumentException;
|
||||
|
||||
import pres.auxiliary.work.testcase.templet.LabelType;
|
||||
|
||||
/**
|
||||
|
@ -24,9 +26,10 @@ public class JiraTestCaseWrite extends CommonTestCaseWrite<JiraTestCaseWrite> {
|
|||
*
|
||||
* @param configFile 测试文件模板xml配置文件类对象
|
||||
* @param caseFile 测试用例文件类对象
|
||||
* @throws DocumentException
|
||||
* @throws IncorrectFileException 文件格式或路径不正确时抛出的异常
|
||||
*/
|
||||
public JiraTestCaseWrite(File configFile, File caseFile) {
|
||||
public JiraTestCaseWrite(File configFile, File caseFile) throws DocumentException {
|
||||
super(configFile, caseFile);
|
||||
|
||||
//TODO 添加与测试用例模板的关联,若测试用例模板字段有所改变,则在此改变关联字段
|
||||
|
|
|
@ -27,16 +27,16 @@ public abstract class Case {
|
|||
/**
|
||||
* 用于标记获取标签下所有的文本
|
||||
*/
|
||||
final String ALL = "-1:getAllText";
|
||||
protected final String ALL = "-1:getAllText";
|
||||
|
||||
/**
|
||||
* 用于存储需要替换的词语的开始标记
|
||||
*/
|
||||
final String START_SIGN = "*{";
|
||||
protected final String START_SIGN = "*{";
|
||||
/**
|
||||
* 用于存储需要替换的词语的结束标记
|
||||
*/
|
||||
final String END_SIGN = "}*";
|
||||
protected final String END_SIGN = "}*";
|
||||
|
||||
/**
|
||||
* 用于存储传入到正则表达式中的开始标记
|
||||
|
@ -46,17 +46,17 @@ public abstract class Case {
|
|||
/**
|
||||
* 用于指向测试用例xml文件的Document对象
|
||||
*/
|
||||
Document configXml;
|
||||
protected Document configXml;
|
||||
|
||||
/**
|
||||
* 存储xml文件中其需要替换的词语
|
||||
*/
|
||||
HashMap<String, String> wordMap = new HashMap<String, String>(16);
|
||||
protected HashMap<String, String> wordMap = new HashMap<String, String>(16);
|
||||
|
||||
/**
|
||||
* 存储字段的文本内容
|
||||
*/
|
||||
HashMap<String, ArrayList<String>> fieldTextMap = new HashMap<String, ArrayList<String>>(16);
|
||||
protected HashMap<String, ArrayList<String>> fieldTextMap = new HashMap<String, ArrayList<String>>(16);
|
||||
|
||||
/**
|
||||
* 根据用例xml文件来构造Case类
|
||||
|
@ -96,7 +96,7 @@ public abstract class Case {
|
|||
* @param text 需要替换的文本
|
||||
* @return 替换后的文本
|
||||
*/
|
||||
String replaceText(String text) {
|
||||
protected String replaceText(String text) {
|
||||
StringBuilder sb = new StringBuilder(text);
|
||||
//存储替换符的位置
|
||||
int index = 0;
|
||||
|
@ -119,11 +119,24 @@ public abstract class Case {
|
|||
/**
|
||||
* 用于获取用例xml中对应用例的标签内的文本,并返回替换词语后的文本
|
||||
* @param caseName 用例名称
|
||||
* @param label 标签枚举
|
||||
* @param labelType 标签枚举{@link LabelType}
|
||||
* @param id 对应标签的id属性
|
||||
* @return 标签中存储的文本,并进行处理
|
||||
*/
|
||||
String getLabelText(String caseName, LabelType label, String id) {
|
||||
protected String getLabelText(String caseName, LabelType labelType, String id) {
|
||||
//返回处理替换的单词后相应的文本
|
||||
return getLabelText(caseName, labelType.getName(), id);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于获取用例xml中对应用例的标签内的文本,并返回替换词语后的文本
|
||||
* @param caseName 用例名称
|
||||
* @param labelName 标签名称
|
||||
* @param id 对应标签的id属性
|
||||
* @return 标签中存储的文本,并进行处理
|
||||
*/
|
||||
protected String getLabelText(String caseName, String labelName, String id) {
|
||||
//定位case标签的名称属性名
|
||||
String caseLabelNameAttribute = "name";
|
||||
//定位标签中能指向调用用例的属性(id)
|
||||
|
@ -134,7 +147,7 @@ public abstract class Case {
|
|||
//拼接xpath,规则"//case[@name='caseName']//标签名称[@id='id']"
|
||||
String xpath = "//" + LabelType.CASE.getName() +
|
||||
"[@" + caseLabelNameAttribute + "='" +
|
||||
caseName + "']//" + label.getName() +
|
||||
caseName + "']//" + labelName +
|
||||
"[@" + labelIdAttribute + "='" + id +"']";
|
||||
|
||||
//获取相应的文本内容
|
||||
|
@ -143,7 +156,7 @@ public abstract class Case {
|
|||
|
||||
//判断集合是否存在元素,若不存在元素,则抛出异常
|
||||
if (textElement == null) {
|
||||
throw new LabelNotFoundException("不存在的标签:<" + label.getName() + " " + labelIdAttribute + "='" + id +"'...>");
|
||||
throw new LabelNotFoundException("不存在的标签:<" + labelName + " " + labelIdAttribute + "='" + id +"'...>");
|
||||
}
|
||||
|
||||
//返回处理替换的单词后相应的文本
|
||||
|
@ -158,7 +171,7 @@ public abstract class Case {
|
|||
* @return 标签中存储的文本,并进行处理
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
ArrayList<String> getAllLabelText(String caseName, LabelType label) {
|
||||
protected ArrayList<String> getAllLabelText(String caseName, LabelType label) {
|
||||
//定位case标签的名称属性名
|
||||
String caseLabelNameAttribute = "name";
|
||||
//定位相应标签中存储用例内容的属性
|
||||
|
@ -209,7 +222,7 @@ public abstract class Case {
|
|||
* 用于保存xml文件中的字段
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
void saveField() {
|
||||
protected void saveField() {
|
||||
//获取case标签下所有的标签,存储至fieldTextMap,以初始化所有的字段名称
|
||||
((List<Element>) (configXml.getRootElement().elements("case"))).forEach(caseElement -> {
|
||||
((List<Element>) caseElement.elements()).forEach(labelElement -> {
|
||||
|
@ -225,23 +238,41 @@ public abstract class Case {
|
|||
* @param label 标签名称(枚举)
|
||||
* @param text 相应内容
|
||||
*/
|
||||
void addFieldText(LabelType label, String text) {
|
||||
protected void addFieldText(LabelType label, String text) {
|
||||
fieldTextMap.get(label.getName()).add(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于添加多行文本
|
||||
* @param label 标签名称
|
||||
* @param texts 相应内容
|
||||
*/
|
||||
protected void addFieldText(String labelName, List<String> texts) {
|
||||
fieldTextMap.get(labelName).addAll(texts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于添加一行文本
|
||||
* @param label 标签名称
|
||||
* @param text 相应内容
|
||||
*/
|
||||
protected void addFieldText(String labelName, String text) {
|
||||
fieldTextMap.get(labelName).add(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于添加多行文本
|
||||
* @param label 标签名称(枚举)
|
||||
* @param texts 相应内容
|
||||
*/
|
||||
void addFieldText(LabelType label, List<String> texts) {
|
||||
protected void addFieldText(LabelType label, List<String> texts) {
|
||||
fieldTextMap.get(label.getName()).addAll(texts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于清空字段的内容,以避免存储上一次输入的用例
|
||||
*/
|
||||
void clearFieldText() {
|
||||
protected void clearFieldText() {
|
||||
fieldTextMap.forEach((key, value) -> {
|
||||
fieldTextMap.get(key).clear();
|
||||
});
|
||||
|
@ -255,7 +286,7 @@ public abstract class Case {
|
|||
return fieldTextMap;
|
||||
}
|
||||
|
||||
/**`
|
||||
/**
|
||||
* 由于添加与参数相关的数据时需要将关联的字段(如步骤及结果)都添加至其中,
|
||||
* 若后期关联字段增加,则代码量将是成倍的增加,故将关联的内容提取出来,在
|
||||
* 外部进行添加,之后修改关联字段时只需修改该方法即可。若传入-1,则表示
|
||||
|
@ -268,7 +299,7 @@ public abstract class Case {
|
|||
* @param caseName 读取的用例名称
|
||||
* @param ids id参数串
|
||||
*/
|
||||
void relevanceAddData(String caseName, String...ids) {
|
||||
protected void relevanceAddData(String caseName, String...ids) {
|
||||
//添加步骤
|
||||
if (ids[0].equals(ALL)) {
|
||||
addFieldText(LabelType.STEP, getAllLabelText(caseName, LabelType.STEP));
|
||||
|
|
|
@ -73,9 +73,7 @@ public class BasicTestCaseWriteTest {
|
|||
public void openFolder() throws IOException {
|
||||
wtc.writeFile();
|
||||
System.out.println("----------------------------");
|
||||
// System.out.println("优先级:");
|
||||
// Arrays.stream(wtc.getRank()).forEach(System.out::println);
|
||||
// wtc.getCaseXml();
|
||||
wtc.getCaseXml();
|
||||
// java.awt.Desktop.getDesktop().open(wtc.getCaseXml());
|
||||
java.awt.Desktop.getDesktop().open(tempFile.getParentFile());
|
||||
java.awt.Desktop.getDesktop().open(tempFile);
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<cases><sheet name="测试用例"><case id="9faf569f-9de4-46db-ad85-eb667586d3dc"><field name="前置条件"><text value="1.myTest001_前置1"/><text value="2.myTest001_前置2"/></field><field name="步骤"><text value="1.myTest001_步骤1"/><text value="2.myTest001_步骤2"/></field><field name="优先级"><text value="myTest001_优先级1"/></field><field name="状态"><text value="Approved"/></field><field name="项目"><text value=""/></field><field name="目的"><text value="验证创建账号界面各个控件输入是否有效"/></field><field name="预期"><text value="1.myTest001_预期1"/><text value="2.myTest001_预期2"/></field><field name="关联需求"><text value="TEST-1"/></field><field name="关键用例"><text value=""/></field><field name="模块"><text value="/测试项目/账号管理/创建账号"/></field><field name="标题"><text value="myTest001_标题1"/></field><field name="设计者"><text value="test"/></field></case><case id="34536547-71e4-428b-b269-4fa5d7972ad2"><field name="前置条件"><text value="1.myTest002_前置1"/><text value="2.myTest002_前置2"/></field><field name="步骤"><text value="1.myTest002_步骤1_测试"/><text value="2.myTest002_步骤2"/><text value="3.myTest002_步骤3"/></field><field name="优先级"><text value="myTest002_优先级1"/></field><field name="状态"><text value="Approved"/></field><field name="项目"><text value=""/></field><field name="目的"><text value="验证创建账号界面各个控件输入是否有效"/></field><field name="预期"><text value="1.myTest002_预期1"/></field><field name="关联需求"><text value="TEST-1"/></field><field name="关键用例"><text value=""/></field><field name="模块"><text value="/测试项目/账号管理/创建账号"/></field><field name="标题"><text value="myTest002_标题1"/></field><field name="设计者"><text value="test"/></field></case><case id="aaf1e599-e397-4877-ada0-aebee6b2d99c"><field name="前置条件"><text value="1.myTest001_前置1"/><text value="2.myTest001_前置2"/></field><field name="步骤"><text value="1.myTest001_步骤1"/><text value="2.myTest001_步骤2"/></field><field name="优先级"><text value="myTest001_优先级1"/></field><field name="状态"><text value="Approved"/></field><field name="项目"><text value=""/></field><field name="目的"><text value="验证创建账号界面各个控件输入是否有效"/></field><field name="预期"><text value="1.myTest001_预期1"/><text value="2.myTest001_预期2"/></field><field name="关联需求"><text value="TEST-1"/></field><field name="关键用例"><text value=""/></field><field name="模块"><text value="/测试项目/账号管理/创建账号"/></field><field name="标题"><text value="myTest001_标题1混合"/></field><field name="设计者"><text value="test"/></field></case></sheet></cases>
|
|
@ -0,0 +1,97 @@
|
|||
package pres.readme.code;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import pres.auxiliary.work.testcase.templet.Case;
|
||||
import pres.auxiliary.work.testcase.templet.LabelType;
|
||||
|
||||
public class MyCase extends Case {
|
||||
|
||||
public MyCase(File configXmlFile) {
|
||||
super(configXmlFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于生成app上浏览列表的测试用例
|
||||
* @return 类本身
|
||||
*/
|
||||
public Case myCase1() {
|
||||
//清空字段的内容
|
||||
clearFieldText();
|
||||
// 存储case标签的name属性内容
|
||||
String caseName = "myTest001";
|
||||
|
||||
//存储标题信息
|
||||
addFieldText(LabelType.TITLE, getLabelText(caseName, LabelType.TITLE, "1"));
|
||||
|
||||
//添加步骤与预期
|
||||
relevanceAddData(caseName, ALL, ALL);
|
||||
|
||||
//存储前置条件信息
|
||||
addFieldText(LabelType.PRECONDITION, getAllLabelText(caseName, LabelType.PRECONDITION));
|
||||
|
||||
//存储关键词信息
|
||||
addFieldText(LabelType.KEY, getLabelText(caseName, LabelType.KEY, "1"));
|
||||
//存储优先级信息
|
||||
addFieldText(LabelType.RANK, getLabelText(caseName, LabelType.RANK, "1"));
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于生成web上列表的测试用例
|
||||
* @return 类本身
|
||||
*/
|
||||
public Case myCase2(String word) {
|
||||
//清空字段的内容
|
||||
clearFieldText();
|
||||
// 存储case标签的name属性内容
|
||||
String caseName = "myTest002";
|
||||
|
||||
wordMap.put("词语", word);
|
||||
//存储标题信息
|
||||
addFieldText(LabelType.TITLE, getLabelText(caseName, LabelType.TITLE, "1"));
|
||||
|
||||
//添加步骤与预期
|
||||
relevanceAddData(caseName, ALL, ALL);
|
||||
|
||||
//存储前置条件信息
|
||||
addFieldText(LabelType.PRECONDITION, getAllLabelText(caseName, LabelType.PRECONDITION));
|
||||
|
||||
//存储关键词信息
|
||||
addFieldText(LabelType.KEY, getLabelText(caseName, LabelType.KEY, "1"));
|
||||
//存储优先级信息
|
||||
addFieldText(LabelType.RANK, getLabelText(caseName, LabelType.RANK, "1"));
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于生成web上列表的测试用例
|
||||
* @return 类本身
|
||||
*/
|
||||
public Case myCase3() {
|
||||
//清空字段的内容
|
||||
clearFieldText();
|
||||
// 存储case标签的name属性内容
|
||||
String caseName = "myTest001";
|
||||
|
||||
//添加替换词语
|
||||
wordMap.put("条件", "混合");
|
||||
//存储标题信息
|
||||
addFieldText(LabelType.TITLE, getLabelText(caseName, LabelType.TITLE, "1"));
|
||||
|
||||
//添加步骤与预期
|
||||
relevanceAddData(caseName, ALL, ALL);
|
||||
|
||||
//存储前置条件信息
|
||||
addFieldText(LabelType.PRECONDITION, getAllLabelText(caseName, LabelType.PRECONDITION));
|
||||
|
||||
//存储关键词信息
|
||||
addFieldText(LabelType.KEY, getLabelText(caseName, LabelType.KEY, "1"));
|
||||
//存储优先级信息
|
||||
addFieldText(LabelType.RANK, getLabelText(caseName, LabelType.RANK, "1"));
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<cases>
|
||||
<case name='myTest001'>
|
||||
<steps>
|
||||
<step id='1' value='myTest001_步骤1'/>
|
||||
<step id='2' value='myTest001_步骤2'/>
|
||||
</steps>
|
||||
<excepts>
|
||||
<except id='1' value='myTest001_预期1'/>
|
||||
<except id='2' value='myTest001_预期2'/>
|
||||
</excepts>
|
||||
<titles>
|
||||
<title id='1' value='myTest001_标题1*{条件}*' />
|
||||
</titles>
|
||||
<preconditions>
|
||||
<precondition id='1' value='myTest001_前置1' />
|
||||
<precondition id='2' value='myTest001_前置2' />
|
||||
</preconditions>
|
||||
<ranks>
|
||||
<rank id='1' value='myTest001_优先级1' />
|
||||
</ranks>
|
||||
<keys>
|
||||
<key id='1' value='myTest001_关键词1' />
|
||||
</keys>
|
||||
</case>
|
||||
|
||||
<case name='myTest002'>
|
||||
<steps>
|
||||
<step id='1' value='myTest002_步骤1_*{词语}*'/>
|
||||
<step id='2' value='myTest002_步骤2'/>
|
||||
<step id='3' value='myTest002_步骤3'/>
|
||||
</steps>
|
||||
<excepts>
|
||||
<except id='1' value='myTest002_预期1'/>
|
||||
</excepts>
|
||||
<titles>
|
||||
<title id='1' value='myTest002_标题1' />
|
||||
</titles>
|
||||
<preconditions>
|
||||
<precondition id='1' value='myTest002_前置1' />
|
||||
<precondition id='2' value='myTest002_前置2' />
|
||||
</preconditions>
|
||||
<ranks>
|
||||
<rank id='1' value='myTest002_优先级1' />
|
||||
</ranks>
|
||||
<keys>
|
||||
<key id='1' value='myTest002_关键词1' />
|
||||
</keys>
|
||||
</case>
|
||||
</cases>
|
|
@ -10,7 +10,6 @@ import org.testng.annotations.Test;
|
|||
|
||||
import pres.auxiliary.tool.file.excel.CreateExcelFile;
|
||||
import pres.auxiliary.work.testcase.file.BasicTestCaseWrite;
|
||||
import pres.auxiliary.work.testcase.file.JiraTestCaseWrite.JiraFieldIdType;
|
||||
import pres.auxiliary.work.testcase.templet.InformationCase;
|
||||
import pres.auxiliary.work.testcase.templet.LabelType;
|
||||
|
||||
|
@ -71,6 +70,7 @@ public class TestWriteCase {
|
|||
|
||||
@AfterClass
|
||||
public void openFolder() throws IOException {
|
||||
java.awt.Desktop.getDesktop().open(wtc.getCaseXml());
|
||||
//将测试用例内容写入到文件中
|
||||
wtc.writeFile();
|
||||
}
|
||||
|
@ -79,5 +79,16 @@ public class TestWriteCase {
|
|||
public void addCase() {
|
||||
wtc.addCase(ic.addBasicTextboxCase("姓名", false, true, false)).end();
|
||||
wtc.addCase(ic.addIdCardCase("身份证", true, false, false)).end();
|
||||
|
||||
wtc.setFieldValue("模块", "/测试项目/账号管理/创建账号2");
|
||||
wtc.addCase(ic.addIdCardCase("护照号", true, false, false)).end();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void myCaseTest() {
|
||||
MyCase mc = new MyCase(new File("src/test/java/pres/readme/code/MyCase.xml"));
|
||||
wtc.addCase(mc.myCase1()).end();
|
||||
wtc.addCase(mc.myCase2("测试")).end();
|
||||
wtc.addCase(mc.myCase3()).end();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue