分离通过xml生成exel,并试图添加超链接方法
This commit is contained in:
parent
b68e0d3eb6
commit
f4b8fb16f3
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templet>
|
||||
<sheet name="测试用例" freeze="3">
|
||||
<column id="case_id" name="用例编号" wide="17" align="center" link="运行记录|case_id"/>
|
||||
<column id="module" name="所属模块" wide="25" align="center"/>
|
||||
<column id="title" name="用例标题" wide="30" align="left"/>
|
||||
<column id="step" name="步骤" wide="45" align="left"/>
|
||||
<column id="expect" name="预期" wide="45" align="left"/>
|
||||
<column id="condition" name="前置条件" wide="30" align="left"/>
|
||||
<column id="flow" name="所属流程" wide="13" align="center"/>
|
||||
</sheet>
|
||||
<sheet name="运行记录" freeze="6" >
|
||||
<column id="id" name="序号" wide="8" align="center"/>
|
||||
<column id="case_id" name="用例编号" wide="17" align="center" link="测试用例|case_id"/>
|
||||
<column id="class_name" name="类名" wide="25" align="left"/>
|
||||
<column id="method_name" name="方法名" wide="15" align="left"/>
|
||||
<column id="state" name="执行状态" wide="10" align="center" link="错误记录|id"/>
|
||||
<column id="step" name="执行步骤" wide="25" align="left"/>
|
||||
<column id="result" name="执行结果" wide="25" align="left"/>
|
||||
<column id="condition" name="前置条件" wide="25" align="left"/>
|
||||
<column id="mark" name="备注" wide="25" align="left"/>
|
||||
<column id="bug_number" name="Bug数量" wide="10" align="center"/>
|
||||
<column id="screenshot_position" name="截图位置" wide="25" align="center" link="运行记录截图|id"/>
|
||||
<column id="use_time" name="执行耗时(s)" wide="15" align="center"/>
|
||||
<column id="active_person" name="执行者" wide="20" align="center"/>
|
||||
<column id="active_time" name="执行时间" wide="12" align="center"/>
|
||||
<column id="brower" name="浏览器" wide="12" align="center"/>
|
||||
<column id="version" name="版本" wide="12" align="center"/>
|
||||
<column id="system" name="操作系统" wide="12" align="center"/>
|
||||
</sheet>
|
||||
|
||||
<sheet name="运行记录截图" freeze="0">
|
||||
<column id="id" name="序号" wide="8" align="center"/>
|
||||
<column id="class_name" name="类名" wide="25" align="left"/>
|
||||
<column id="method_name" name="方法名" wide="15" align="left" link="运行记录|id"/>
|
||||
<column id="screenshot" name="截图" wide="25" align="left" link="本地"/>
|
||||
</sheet>
|
||||
|
||||
<sheet name="错误记录" freeze="4">
|
||||
<column id="id" name="序号" wide="8" align="center"/>
|
||||
<column id="class_name" name="类名" wide="25" align="left"/>
|
||||
<column id="method_name" name="方法名" wide="15" align="left" link="运行记录|id"/>
|
||||
<column id="error_step" name="错误步骤" wide="25" align="left"/>
|
||||
<column id="error_class" name="异常类" wide="25" align="left"/>
|
||||
<column id="error_information" name="异常信息" wide="25" align="left"/>
|
||||
<column id="screenshot_position" name="截图位置" wide="25" align="left" link="错误记录截图|id"/>
|
||||
</sheet>
|
||||
|
||||
<sheet name="错误记录截图" freeze="0">
|
||||
<column id="id" name="序号" wide="8" align="center"/>
|
||||
<column id="class_name" name="类名" wide="25" align="left"/>
|
||||
<column id="method_name" name="方法名" wide="15" align="left" link="错误记录|id"/>
|
||||
<column id="screenshot" name="截图" wide="25" align="left" link="本地"/>
|
||||
</sheet>
|
||||
</templet>
|
|
@ -0,0 +1,72 @@
|
|||
package pres.auxiliary.tool.file;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.Element;
|
||||
import org.dom4j.io.OutputFormat;
|
||||
import org.dom4j.io.XMLWriter;
|
||||
|
||||
import pres.auxiliary.work.selenium.tool.ExcelRecord;
|
||||
|
||||
/**
|
||||
* <p><b>文件名:</b>ConfigXmlTool.java</p>
|
||||
* <p><b>用途:</b>
|
||||
* 用于创建特定类中使用到的xml文件,方便在未保存xml配置文件时,对配置文件进行创建。
|
||||
* </p>
|
||||
* <p><b>编码时间:</b>2020年8月12日下午4:14:32</p>
|
||||
* <p><b>修改时间:</b>2020年8月12日下午4:14:32</p>
|
||||
* @author 彭宇琦
|
||||
* @version Ver1.0
|
||||
*
|
||||
*/
|
||||
public class ExcelConfigXmlTool {
|
||||
/**
|
||||
* 存储生成的Document对象
|
||||
*/
|
||||
private static Document document;
|
||||
|
||||
/**
|
||||
* 用于生成{@link ExcelRecord}类所需的xml结构
|
||||
* @return {@link ExcelRecord}类所需的xml结构
|
||||
*/
|
||||
public static Document createExcelRecordXml() {
|
||||
|
||||
|
||||
return document;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于将生成的{@link Document}对象写入到指定的文件中
|
||||
* @param saveFile 生成的xml文件对象
|
||||
* @throws IOException xml文件生成有误时抛出的异常
|
||||
* @throws NullPointerException 未生成{@link Document}对象时抛出的异常
|
||||
*/
|
||||
public static void createFile(File saveFile) throws IOException {
|
||||
if (document == null) {
|
||||
throw new NullPointerException("未生成xml配置文件Document对象");
|
||||
}
|
||||
|
||||
//创建文件存储路径
|
||||
saveFile.getParentFile().mkdirs();
|
||||
|
||||
//格式化document
|
||||
OutputFormat format = OutputFormat.createPrettyPrint();
|
||||
format.setEncoding(document.getXMLEncoding());
|
||||
|
||||
//将document中的内容写入到相应的文件中
|
||||
XMLWriter writer = new XMLWriter(new FileWriter(saveFile), format);
|
||||
writer.write(document);
|
||||
writer.close();
|
||||
}
|
||||
|
||||
private void root() {
|
||||
document.setRootElement(document.addElement("templet"));
|
||||
}
|
||||
|
||||
private void sheet(String name, String freeze) {
|
||||
Element root = document.getRootElement();
|
||||
}
|
||||
}
|
|
@ -6,28 +6,23 @@ public class UnsupportedFileException extends RuntimeException {
|
|||
|
||||
public UnsupportedFileException() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public UnsupportedFileException(String message, Throwable cause, boolean enableSuppression,
|
||||
boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public UnsupportedFileException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public UnsupportedFileException(String message) {
|
||||
super(message);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public UnsupportedFileException(Throwable cause) {
|
||||
super(cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,39 @@
|
|||
package pres.auxiliary.tool.file.excel;
|
||||
|
||||
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||
import org.apache.poi.xssf.usermodel.XSSFFont;
|
||||
|
||||
/**
|
||||
* <p><b>文件名:</b>CellStyleType.java</p>
|
||||
* <p><b>用途:</b>
|
||||
* 枚举常用的单元格样式,方便后续调用
|
||||
* </p>
|
||||
* <p><b>编码时间:</b>2020年8月14日上午7:49:07</p>
|
||||
* <p><b>修改时间:</b>2020年8月14日上午7:49:07</p>
|
||||
* @author 彭宇琦
|
||||
* @version Ver1.0
|
||||
* @since POI 3.15
|
||||
*/
|
||||
public enum CellStyleType {
|
||||
/**
|
||||
* 指向超链接文本样式
|
||||
*/
|
||||
LINK_TEXT;
|
||||
|
||||
public void getXSSFCellStyle(XSSFCell cell) {
|
||||
switch (this) {
|
||||
case LINK_TEXT:
|
||||
// 获取字体信息
|
||||
XSSFFont xf = cell.getCellStyle().getFont();
|
||||
// 添加下划线
|
||||
xf.setUnderline((byte) 1);
|
||||
// 设置字体颜色为蓝色
|
||||
xf.setColor(IndexedColors.BLUE.getIndex());
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package pres.auxiliary.work.testcase.file;
|
||||
package pres.auxiliary.tool.file.excel;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
|
@ -21,6 +21,7 @@ import org.dom4j.Element;
|
|||
import org.dom4j.io.SAXReader;
|
||||
|
||||
import pres.auxiliary.work.selenium.datadriven.ListFileRead;
|
||||
import pres.auxiliary.work.testcase.file.IncorrectFileException;
|
||||
import pres.auxiliary.work.testcase.templet.LabelNotFoundException;
|
||||
|
||||
/**
|
||||
|
@ -28,7 +29,7 @@ import pres.auxiliary.work.testcase.templet.LabelNotFoundException;
|
|||
* <b>文件名:</b>CreateCaseFile.java
|
||||
* </p>
|
||||
* <p>
|
||||
* <b>用途:</b>用于根据测试用例模板xml配置文件来生成测试用例模板文件
|
||||
* <b>用途:</b>用于根据模板xml配置文件来生成Excel模板文件
|
||||
* </p>
|
||||
* <p>
|
||||
* <b>编码时间:</b>2020年2月11日下午11:12:56
|
||||
|
@ -39,10 +40,10 @@ import pres.auxiliary.work.testcase.templet.LabelNotFoundException;
|
|||
*
|
||||
* @author 彭宇琦
|
||||
* @version Ver1.0
|
||||
* @since JDK 12
|
||||
* @since JDK 8
|
||||
*
|
||||
*/
|
||||
public class CreateCaseFile {
|
||||
public class CreateExcelFile {
|
||||
/**
|
||||
* 用于对数据有效性在文件中标题的sheet与id之间的分隔符
|
||||
*/
|
||||
|
@ -56,7 +57,7 @@ public class CreateCaseFile {
|
|||
/**
|
||||
* 用于指向用例文件,并赋予其默认值
|
||||
*/
|
||||
private File templetFile = new File("Result/TestCase/测试用例.xlsx");
|
||||
private File templetFile = new File("");
|
||||
|
||||
/**
|
||||
* 用于控制是否覆盖原文件
|
||||
|
@ -69,29 +70,33 @@ public class CreateCaseFile {
|
|||
private Document xml;
|
||||
|
||||
/**
|
||||
* 构造TestCaseTemplet类,并指向xml配置文件位置以及模板文件生成文件位置
|
||||
* 根据xml配置文件位置以及模板文件生成文件位置进行构造
|
||||
*
|
||||
* @param configurationFile xml配置文件
|
||||
* @param templetFile 测试用例模板文件生成位置
|
||||
* @throws DocumentException 当xml配置文件错误时抛出
|
||||
* @throws IncorrectFileException 文件格式或路径不正确时抛出的异常
|
||||
*/
|
||||
public CreateCaseFile(File configurationFile, File templetFile) throws DocumentException {
|
||||
// 判断传入的configurationFile是否为一个文件类对象,若非文件类对象,则抛出异常(isFile()方法包含判断文件是否存在)
|
||||
// 再判断文件是否包含文件路径是否包含“.xml”
|
||||
if (configurationFile.isFile() && configurationFile.getAbsolutePath().indexOf(".xml") > -1) {
|
||||
// 读取xml文件的信息
|
||||
xml = new SAXReader().read(configurationFile);
|
||||
} else {
|
||||
throw new IncorrectFileException("不正确的文件格式:" + configurationFile.getAbsolutePath());
|
||||
public CreateExcelFile(File configurationFile, File templetFile) throws DocumentException {
|
||||
this(new SAXReader().read(configurationFile), templetFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据文件模板xml的{@link Document}类对象以及模板文件生成文件位置进行构造
|
||||
*
|
||||
* @param configDocument 文件模板xml的{@link Document}类对象
|
||||
* @param templetFile 测试用例模板文件生成位置
|
||||
* @throws IncorrectFileException 文件格式或路径不正确时抛出的异常
|
||||
*/
|
||||
public CreateExcelFile(Document configDocument, File templetFile) {
|
||||
// 判断路径是否包含“.xlsx”(使用的方法为XSSFWork)
|
||||
if (templetFile.getAbsolutePath().indexOf(".xlsx") > -1) {
|
||||
this.templetFile = templetFile;
|
||||
} else {
|
||||
throw new IncorrectFileException("不正确的文件格式:" + templetFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
xml = configDocument;
|
||||
}
|
||||
|
||||
/**
|
|
@ -0,0 +1,39 @@
|
|||
package pres.auxiliary.tool.file.excel;
|
||||
|
||||
/**
|
||||
* <p><b>文件名:</b>IncorrectIndexException.java</p>
|
||||
* <p><b>用途:</b>
|
||||
* 当下标不正确时抛出的异常
|
||||
* </p>
|
||||
* <p><b>编码时间:</b>2020年8月16日下午10:42:47</p>
|
||||
* <p><b>修改时间:</b>2020年8月16日下午10:42:47</p>
|
||||
* @author 彭宇琦
|
||||
* @version Ver1.0
|
||||
*
|
||||
*/
|
||||
public class IncorrectIndexException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public IncorrectIndexException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public IncorrectIndexException(String message, Throwable cause, boolean enableSuppression,
|
||||
boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
|
||||
public IncorrectIndexException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public IncorrectIndexException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public IncorrectIndexException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package pres.auxiliary.tool.file.excel;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentException;
|
||||
|
||||
import pres.auxiliary.work.testcase.file.IncorrectFileException;
|
||||
|
||||
/**
|
||||
* <p><b>文件名:</b>WriteExcel.java</p>
|
||||
* <p><b>用途:</b>
|
||||
* 用于根据xml配置文件,将所需内容写入到excel文件中。在写入内容时,
|
||||
* 可通过调用<br>
|
||||
* {@code setReplactWord(String word, String replactWord) }<br>
|
||||
* 方法,设置需要替换词语,在文本中使用“#替换词语#”进行标记。需要注意的是,若被标记的词语
|
||||
* 未进行设置,则会保留原始内容(包含标记符号)。
|
||||
* <p>
|
||||
* 在添加内容时,亦可通过调用<br>
|
||||
* {@code setFieldValue(String field, String content) }<br>
|
||||
* 方法来设置常值,即被标记的字段每行文本都使用相同的内容。
|
||||
* </p>
|
||||
* </p>
|
||||
* <p><b>编码时间:</b>2020年8月12日上午8:53:55</p>
|
||||
* <p><b>修改时间:</b>2020年8月12日上午8:53:55</p>
|
||||
* @author 彭宇琦
|
||||
* @version Ver1.0
|
||||
*
|
||||
*/
|
||||
public class WriteExcel extends AbstractWriteExcel<WriteExcel> {
|
||||
/**
|
||||
* 通过测试文件模板xml配置文件和测试用例文件进行构造。当配置文件中
|
||||
* 只存在一个sheet标签时,则直接获取其对应sheet下所有column标签的id属性;若存在
|
||||
* 多个sheet标签时,则读取第一个sheet标签,如需切换sheet标签,则可调用{@link #switchSheet(String)} 方法。
|
||||
*
|
||||
* @param configFile 测试文件模板xml配置文件类对象
|
||||
* @param caseFile 测试用例文件类对象
|
||||
* @throws DocumentException 当xml配置文件错误时抛出
|
||||
* @throws IncorrectFileException 文件格式或路径不正确时抛出的异常
|
||||
*/
|
||||
public WriteExcel(File configFile, File caseFile) throws DocumentException {
|
||||
super(configFile, caseFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过测试文件模板xml配置文件的{@link Document}类对象和测试用例文件进行构造。当配置文件中
|
||||
* 只存在一个sheet标签时,则直接获取其对应sheet下所有column标签的id属性;若存在
|
||||
* 多个sheet标签时,则读取第一个sheet标签,如需切换sheet标签,则可调用{@link #switchSheet(String)} 方法。
|
||||
*
|
||||
* @param configFile 测试文件模板xml配置文件类对象
|
||||
* @param caseFile 测试用例文件类对象
|
||||
* @throws IncorrectFileException 文件格式或路径不正确时抛出的异常
|
||||
*/
|
||||
public WriteExcel(Document configDocument, File caseFile) {
|
||||
super(configDocument, caseFile);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package pres.auxiliary.tool.regex;
|
||||
|
||||
/**
|
||||
* <p><b>文件名:</b>RegexType.java</p>
|
||||
* <p><b>用途:</b>
|
||||
* 枚举常用的正则表达式
|
||||
* </p>
|
||||
* <p><b>编码时间:</b>2020年8月17日下午5:47:33</p>
|
||||
* <p><b>修改时间:</b>2020年8月17日下午5:47:33</p>
|
||||
* @author 彭宇琦
|
||||
* @version Ver1.0
|
||||
*
|
||||
*/
|
||||
public enum RegexType {
|
||||
URL("(?:(?:(?:[a-z]+:)?\\/\\/)|www\\.)(?:\\S+(?::\\S*)?@)?(?:localhost|(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3})|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))\\.?)(?::\\d{2,5})?(?:[/?#][^\\s\"]*)?"),
|
||||
EMAIL("(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))"),
|
||||
FOLDER_PATH("([a-zA-Z]:(\\/|\\\\))?([^/:*?<>\\\"\"|\\\\]+(\\/|\\\\)?)+"),
|
||||
;
|
||||
|
||||
/**
|
||||
* 存储枚举的正则
|
||||
*/
|
||||
private String regex;
|
||||
|
||||
/**
|
||||
* 初始化枚举值
|
||||
* @param regex 枚举值
|
||||
*/
|
||||
private RegexType(String regex) {
|
||||
this.regex = regex;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回枚举对应的正则表达式
|
||||
* @return 正则表达式
|
||||
*/
|
||||
public String getRegex() {
|
||||
return regex;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于判断字符串是否符合当前枚举的正则表达式
|
||||
* @param content 待判断的字符串
|
||||
* @return 是否符合当前枚举的正则表达式
|
||||
*/
|
||||
public boolean judgeString(String content) {
|
||||
return content.matches(regex);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -70,7 +70,7 @@ public class RecordTool {
|
|||
/**
|
||||
* Record类对象,默认构造
|
||||
*/
|
||||
private static ExcelRecord record = new ExcelRecord(DEFAULT_FILE_PATH);
|
||||
private static ExcelRecord_Old record = new ExcelRecord_Old(DEFAULT_FILE_PATH);
|
||||
/**
|
||||
* Screenshot类对象,默认构造
|
||||
*/
|
||||
|
@ -136,11 +136,11 @@ public class RecordTool {
|
|||
}
|
||||
|
||||
/**
|
||||
* 返回{@link ExcelRecord}类对象
|
||||
* 返回{@link ExcelRecord_Old}类对象
|
||||
*
|
||||
* @return {@link ExcelRecord}类对象
|
||||
* @return {@link ExcelRecord_Old}类对象
|
||||
*/
|
||||
public static ExcelRecord getRecord() {
|
||||
public static ExcelRecord_Old getRecord() {
|
||||
return record;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -12,14 +12,14 @@ import org.junit.Test;
|
|||
import org.junit.rules.TestName;
|
||||
import org.openqa.selenium.TimeoutException;
|
||||
|
||||
import pres.auxiliary.work.selenium.tool.ExcelRecord;
|
||||
import pres.auxiliary.work.selenium.tool.ExcelRecord_Old;
|
||||
import pres.auxiliary.work.selenium.tool.RecordTool;
|
||||
import pres.auxiliary.work.selenium.tool.Screenshot;
|
||||
|
||||
public class TestRecord {
|
||||
@Rule
|
||||
public TestName name = new TestName();
|
||||
static ExcelRecord r;
|
||||
static ExcelRecord_Old r;
|
||||
static FirefoxBrower fb;
|
||||
static Event event;
|
||||
static Screenshot sc;
|
||||
|
|
|
@ -12,9 +12,9 @@ import org.testng.annotations.BeforeMethod;
|
|||
import org.testng.annotations.Test;
|
||||
|
||||
import pres.auxiliary.work.testcase.file.MarkColorsType;
|
||||
import pres.auxiliary.work.testcase.file.CreateCaseFile;
|
||||
import pres.auxiliary.work.testcase.file.AbstractTestCaseWrite;
|
||||
import pres.auxiliary.work.testcase.file.AbstractTestCaseWrite.CaseMark;
|
||||
import pres.auxiliary.tool.file.excel.AbstractWriteExcel;
|
||||
import pres.auxiliary.tool.file.excel.CreateExcelFile;
|
||||
import pres.auxiliary.tool.file.excel.AbstractWriteExcel.FieldMark;
|
||||
import pres.auxiliary.work.testcase.templet.InformationCase;
|
||||
import pres.auxiliary.work.testcase.templet.LabelType;
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class BasicTestCaseWriteTest {
|
|||
|
||||
@BeforeClass
|
||||
public void createTemplet() throws DocumentException, IOException {
|
||||
CreateCaseFile temp = new CreateCaseFile(conFile, tempFile);
|
||||
CreateExcelFile temp = new CreateExcelFile(conFile, tempFile);
|
||||
temp.setCoverFile(true);
|
||||
temp.create();
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class BasicTestCaseWriteTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* 测试{@link AbstractTestCaseWrite#addContent(String, String)}方法
|
||||
* 测试{@link AbstractWriteExcel#addContent(String, String)}方法
|
||||
*/
|
||||
@Test
|
||||
public void addContentTest_NotDataValidetion() {
|
||||
|
@ -103,7 +103,7 @@ public class BasicTestCaseWriteTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* 测试{@link AbstractTestCaseWrite#addContent(String, String)}方法
|
||||
* 测试{@link AbstractWriteExcel#addContent(String, String)}方法
|
||||
*/
|
||||
@Test
|
||||
public void addContentTest_hasDataValidetion() {
|
||||
|
@ -111,7 +111,7 @@ public class BasicTestCaseWriteTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* 测试{@link AbstractTestCaseWrite#addCase(pres.auxiliary.work.n.testcase.Case)}方法
|
||||
* 测试{@link AbstractWriteExcel#addCase(pres.auxiliary.work.n.testcase.Case)}方法
|
||||
*/
|
||||
@Test
|
||||
public void addCaseTest() {
|
||||
|
@ -127,7 +127,7 @@ public class BasicTestCaseWriteTest {
|
|||
|
||||
|
||||
/**
|
||||
* 测试{@link AbstractTestCaseWrite#setReplactWord(String, String)}方法
|
||||
* 测试{@link AbstractWriteExcel#setReplactWord(String, String)}方法
|
||||
*/
|
||||
@Test
|
||||
public void setReplactWordTest() {
|
||||
|
@ -141,26 +141,26 @@ public class BasicTestCaseWriteTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* 测试{@link CaseMark#fieldComment(String, String)}方法
|
||||
* 测试{@link FieldMark#fieldComment(String, String)}方法
|
||||
*/
|
||||
@Test
|
||||
public void markFieldTest() {
|
||||
CaseMark cm = wtc.end().fieldComment("步骤", "步骤标记").fieldComment("预期", "预期标记");
|
||||
FieldMark cm = wtc.end().fieldComment("步骤", "步骤标记").fieldComment("预期", "预期标记");
|
||||
cm.fieldComment("目的", "目的标记");
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试{@link CaseMark#fieldBackground(String, MarkColorsType)}方法
|
||||
* 测试{@link FieldMark#fieldBackground(String, MarkColorsType)}方法
|
||||
*/
|
||||
@Test
|
||||
public void fieldBackgroundTest() {
|
||||
CaseMark cm = wtc.end().changeFieldBackground("步骤", MarkColorsType.BLUE).changeFieldBackground("预期",
|
||||
FieldMark cm = wtc.end().changeFieldBackground("步骤", MarkColorsType.BLUE).changeFieldBackground("预期",
|
||||
MarkColorsType.RED);
|
||||
cm.changeFieldBackground("目的", MarkColorsType.GREEN);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试{@link CaseMark#rowBackground(MarkColorsType)}方法
|
||||
* 测试{@link FieldMark#rowBackground(MarkColorsType)}方法
|
||||
*/
|
||||
@Test
|
||||
public void rowBackgroundTest() {
|
||||
|
@ -168,7 +168,7 @@ public class BasicTestCaseWriteTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* 测试{@link CaseMark#markText(String, int, MarkColorsType)}方法
|
||||
* 测试{@link FieldMark#markText(String, int, MarkColorsType)}方法
|
||||
*/
|
||||
@Test
|
||||
public void markTextTest() {
|
||||
|
@ -185,7 +185,7 @@ public class BasicTestCaseWriteTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* 测试{@link AbstractTestCaseWrite#removeContent(String, int...)}方法
|
||||
* 测试{@link AbstractWriteExcel#removeContent(String, int...)}方法
|
||||
*/
|
||||
@Test
|
||||
public void removeContentTest_1() {
|
||||
|
@ -194,7 +194,7 @@ public class BasicTestCaseWriteTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* 测试{@link AbstractTestCaseWrite#removeContent(String, int...)}方法
|
||||
* 测试{@link AbstractWriteExcel#removeContent(String, int...)}方法
|
||||
*/
|
||||
@Test
|
||||
public void removeContentTest_2() {
|
||||
|
@ -202,7 +202,7 @@ public class BasicTestCaseWriteTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* 测试{@link AbstractTestCaseWrite#removeContent(String, int...)}方法
|
||||
* 测试{@link AbstractWriteExcel#removeContent(String, int...)}方法
|
||||
*/
|
||||
@Test
|
||||
public void removeContentTest_3() {
|
||||
|
@ -211,7 +211,7 @@ public class BasicTestCaseWriteTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* 测试{@link AbstractTestCaseWrite#insertContent(String, int, String...)}方法
|
||||
* 测试{@link AbstractWriteExcel#insertContent(String, int, String...)}方法
|
||||
*/
|
||||
@Test
|
||||
public void insertContentTest_1() {
|
||||
|
@ -220,7 +220,7 @@ public class BasicTestCaseWriteTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* 测试{@link AbstractTestCaseWrite#insertContent(String, int, String...)}方法
|
||||
* 测试{@link AbstractWriteExcel#insertContent(String, int, String...)}方法
|
||||
*/
|
||||
@Test
|
||||
public void insertContentTest_2() {
|
||||
|
@ -228,7 +228,7 @@ public class BasicTestCaseWriteTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* 测试{@link AbstractTestCaseWrite#insertContent(String, int, String...)}方法
|
||||
* 测试{@link AbstractWriteExcel#insertContent(String, int, String...)}方法
|
||||
*/
|
||||
@Test
|
||||
public void insertContentTest_3() {
|
||||
|
@ -237,7 +237,7 @@ public class BasicTestCaseWriteTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* 测试{@link AbstractTestCaseWrite#insertContent(String, int, String...)}方法
|
||||
* 测试{@link AbstractWriteExcel#insertContent(String, int, String...)}方法
|
||||
*/
|
||||
@Test
|
||||
public void insertContentTest_4() {
|
||||
|
@ -246,7 +246,7 @@ public class BasicTestCaseWriteTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* 测试{@link AbstractTestCaseWrite#insertContent(String, int, String...)}方法
|
||||
* 测试{@link AbstractWriteExcel#insertContent(String, int, String...)}方法
|
||||
*/
|
||||
@Test
|
||||
public void insertContentTest_5() {
|
||||
|
@ -255,7 +255,7 @@ public class BasicTestCaseWriteTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* 测试{@link AbstractTestCaseWrite#replaceContent(String, int, String...)}方法
|
||||
* 测试{@link AbstractWriteExcel#replaceContent(String, int, String...)}方法
|
||||
*/
|
||||
@Test
|
||||
public void replaceContentTest_1() {
|
||||
|
@ -264,7 +264,7 @@ public class BasicTestCaseWriteTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* 测试{@link AbstractTestCaseWrite#replaceContent(String, int, String...)}方法
|
||||
* 测试{@link AbstractWriteExcel#replaceContent(String, int, String...)}方法
|
||||
*/
|
||||
@Test
|
||||
public void replaceContentTest_2() {
|
||||
|
@ -272,7 +272,7 @@ public class BasicTestCaseWriteTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* 测试{@link AbstractTestCaseWrite#replaceContent(String, int, String...)}方法
|
||||
* 测试{@link AbstractWriteExcel#replaceContent(String, int, String...)}方法
|
||||
*/
|
||||
@Test
|
||||
public void replaceContentTest_3() {
|
||||
|
@ -281,7 +281,7 @@ public class BasicTestCaseWriteTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* 测试{@link AbstractTestCaseWrite#replaceContent(String, int, String...)}方法
|
||||
* 测试{@link AbstractWriteExcel#replaceContent(String, int, String...)}方法
|
||||
*/
|
||||
@Test
|
||||
public void replaceContentTest_4() {
|
||||
|
@ -290,7 +290,7 @@ public class BasicTestCaseWriteTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* 测试{@link AbstractTestCaseWrite#replaceContent(String, int, String...)}方法
|
||||
* 测试{@link AbstractWriteExcel#replaceContent(String, int, String...)}方法
|
||||
*/
|
||||
@Test
|
||||
public void replaceContentTest_5() {
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.testng.annotations.BeforeClass;
|
|||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import pres.auxiliary.tool.file.excel.CreateExcelFile;
|
||||
import pres.auxiliary.work.testcase.file.JiraTestCaseWrite.JiraFieldIdType;
|
||||
import pres.auxiliary.work.testcase.templet.DataListCase;
|
||||
|
||||
|
@ -38,7 +39,7 @@ public class JiraTestCaseWriteTest {
|
|||
|
||||
@BeforeClass
|
||||
public void createTemplet() throws DocumentException, IOException {
|
||||
CreateCaseFile temp = new CreateCaseFile(conFile, tempFile);
|
||||
CreateExcelFile temp = new CreateExcelFile(conFile, tempFile);
|
||||
temp.setCoverFile(true);
|
||||
temp.create();
|
||||
|
||||
|
|
|
@ -9,14 +9,14 @@ import org.testng.annotations.BeforeClass;
|
|||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import pres.auxiliary.tool.file.excel.CreateExcelFile;
|
||||
import pres.auxiliary.work.testcase.file.IncorrectFileException;
|
||||
import pres.auxiliary.work.testcase.file.CreateCaseFile;
|
||||
|
||||
public class TestCaseTempletTest {
|
||||
/**
|
||||
* 类对象
|
||||
*/
|
||||
CreateCaseFile temp;
|
||||
CreateExcelFile temp;
|
||||
|
||||
/**
|
||||
* 模板文件类对象
|
||||
|
@ -33,7 +33,7 @@ public class TestCaseTempletTest {
|
|||
*/
|
||||
@BeforeClass
|
||||
public void newTestCaseTemplet() throws DocumentException {
|
||||
temp = new CreateCaseFile(conFile, tempFile);
|
||||
temp = new CreateExcelFile(conFile, tempFile);
|
||||
temp.setCoverFile(true);
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ public class TestCaseTempletTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* 测试{@link CreateCaseFile#create()}以及{@link CreateCaseFile#setCoverFile(boolean)} <br>
|
||||
* 测试{@link CreateExcelFile#create()}以及{@link CreateExcelFile#setCoverFile(boolean)} <br>
|
||||
* 断言将抛出IncorrectFileException异常
|
||||
* @throws IOException
|
||||
*/
|
||||
|
|
|
@ -7,8 +7,8 @@ import org.testng.annotations.AfterMethod;
|
|||
import org.testng.annotations.BeforeClass;
|
||||
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.CreateCaseFile;
|
||||
|
||||
public class DataListCaseTest {
|
||||
/**
|
||||
|
@ -32,7 +32,7 @@ public class DataListCaseTest {
|
|||
|
||||
@BeforeClass
|
||||
public void start() throws Exception {
|
||||
CreateCaseFile tct = new CreateCaseFile(templetXml, testCaseFile);
|
||||
CreateExcelFile tct = new CreateExcelFile(templetXml, testCaseFile);
|
||||
//为方便演示,则允许覆盖用例文件
|
||||
tct.setCoverFile(true);
|
||||
//生成用例文件
|
||||
|
|
|
@ -10,8 +10,8 @@ import org.testng.annotations.BeforeGroups;
|
|||
import org.testng.annotations.BeforeTest;
|
||||
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.CreateCaseFile;
|
||||
import pres.auxiliary.work.testcase.file.MarkColorsType;
|
||||
import pres.auxiliary.work.testcase.templet.InformationCase.InputRuleType;
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class ProgramWriteTestCaseDemo {
|
|||
*/
|
||||
@BeforeTest
|
||||
public void createCaseFile() throws IOException, DocumentException {
|
||||
CreateCaseFile tct = new CreateCaseFile(templetXml, testCaseFile);
|
||||
CreateExcelFile tct = new CreateExcelFile(templetXml, testCaseFile);
|
||||
//为方便演示,则允许覆盖用例文件
|
||||
tct.setCoverFile(true);
|
||||
//生成用例文件
|
||||
|
|
|
@ -8,8 +8,8 @@ import org.testng.annotations.AfterClass;
|
|||
import org.testng.annotations.BeforeClass;
|
||||
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.CreateCaseFile;
|
||||
import pres.auxiliary.work.testcase.file.JiraTestCaseWrite.JiraFieldIdType;
|
||||
import pres.auxiliary.work.testcase.templet.InformationCase;
|
||||
import pres.auxiliary.work.testcase.templet.LabelType;
|
||||
|
@ -41,7 +41,7 @@ public class TestWriteCase {
|
|||
@BeforeClass
|
||||
public void createTemplet() throws DocumentException, IOException {
|
||||
//创建测试用例模板文件
|
||||
CreateCaseFile temp = new CreateCaseFile(conFile, tempFile);
|
||||
CreateExcelFile temp = new CreateExcelFile(conFile, tempFile);
|
||||
temp.setCoverFile(true);
|
||||
temp.create();
|
||||
|
||||
|
|
Loading…
Reference in New Issue