public class ExcelRecord extends WriteExcelTempletFile<ExcelRecord>
文件名:ExcelRecord.java
用途: 用于记录自动化测试的运行过程,可记录用例步骤、结果、浏览器信息等,并在记录失败时提供自动截图。
编码时间:2020年8月12日下午2:16:55
修改时间:2021年10月1日 上午10:51:09
WriteExcelTempletFile.AlignmentType
COLUMN_SPLIT_SIGN, DATA_SHEET_NAME, DATA_TITLE_FORMAT, KEY_LINK_CONTENT, KEY_WORK, KEY_WRAP_TEXT, styleMap
dataMap, DEFAULT_NAME
caseIndex, endField, KEY_CASE, KEY_CONTENT, KEY_DATA, KEY_DEFAULT, KEY_TEMPLET, KEY_TEXT, placeholder, WORD_SIGN, writeRowNum
KEY_COMMENT
KEY_COLOR
KEY_BOLD, KEY_FONT_NAME, KEY_FONT_SIZE, KEY_ITALIC, KEY_UNDERLINE
KEY_LINK
KEY_NAME
Constructor and Description |
---|
ExcelRecord(File saveFile)
根据默认的模板,将记录文件生成到指定的目录下
|
Modifier and Type | Method and Description |
---|---|
ExcelRecord |
caseCondition(String... text)
用于添加测试用例的前置条件,支持传入多条,每条数据将自动编号以及换行
|
ExcelRecord |
caseExpect(String... text)
用于添加测试用例的预期,支持传入多条,每条数据将自动编号以及换行
|
ExcelRecord |
caseId(String text)
用于添加测试用例的用例编号,不支持传入多个用例编号,每次调用方法后将覆盖之前传入的内容
|
ExcelRecord |
caseStep(String... text)
用于添加测试用例的步骤,支持传入多条,每条数据将自动编号以及换行
|
ExcelRecord |
caseTitle(String text)
用于添加测试用例的标题,不支持传入多个标题,每次调用方法后将覆盖之前传入的内容
|
ExcelRecord |
end(int index)
标记完成一条用例数据的编写,并将内容插入到指定行内容下
|
ExcelRecord |
exception(Exception exception)
用于添加异常步骤的信息,传入异常类后,将会自动记录异常步骤
|
ExcelRecord |
exception(Exception exception,
File screenshotFile)
用于添加异常步骤信息,并记录截图,可参见
exception(Exception) |
ExcelRecord |
reckonByTime()
用于记录执行开始时间,记录结束时,会写入相应的结束时间
|
ExcelRecord |
runId(String text)
用于添加运行记录编号
|
ExcelRecord |
runMark(String text)
用于添加运行备注
|
ExcelRecord |
runMethod(String className,
String methodName)
用于添加运行类名以及运行方法名。多次调用时会清空上一次记录的内容
|
ExcelRecord |
runResult(String text,
boolean bug)
用于添加执行结果,根据传入的Bug判定来记录当前执行的Bug数量。该方法可调用多次, 将多个结果,结果将自动编号。
|
ExcelRecord |
runScreenshot(File screenshotFile)
用于添加运行时截图
|
ExcelRecord |
runStep(String... text)
用于添加实际运行步骤,支持传入多条,每条数据将自动编号以及换行
|
ExcelRecord |
setActionName(String actionName)
用于添加执行者。该方法不能单独调用,必须配合的其他其他方法一起使用, 否则在生成文件时,其写入的内容不会被填写到文件中
|
ExcelRecord |
setBrowerInformation(AbstractBrower brower)
用于添加浏览器信息。该方法不能单独调用,必须配合其他 其他方法一起使用,否则在生成文件时,其写入的内容不会被填写到文件中
|
addComment, addContent, addDataOption, addLink, appendContent, bold, border, border, changeCaseBackground, changeFieldBackground, changeTextColor, contentWriteTemplet, createTempletFile, fieldComment, fieldJson2StyleJson, getCell, getStyle, isExistTemplet, italic, linkEmail, linkField, linkFile, linkUrl, readDataOptionTitle, setCellContent, setContent, underline, writeMultipleCellContent, writeSingleCellContent
addTemplet, getAllTempletJson, getDataMap, getTemplet, getWriteFileData, setWriteData, switchPage, write, write
addContent, addContent, addContent, addReplaceFunction, addReplaceWord, analysisIndex, clearCase, clearContent, clearFieldValue, disposeWriteFieldsContent, end, getCase, getPlaceholder, getTextJson, getWriteData, replenishDefaultContent, setContentJson, setEndField, setFieldValue, setFileTemplet, setPlaceholder, setWriteRowNum, toTempletJson, toWriteFileJson
public ExcelRecord(File saveFile) throws org.dom4j.DocumentException
saveFile
- 记录文件保存路径org.dom4j.DocumentException
public ExcelRecord setBrowerInformation(AbstractBrower brower)
brower
- 继承自AbstractBrower
类的浏览器类对象public ExcelRecord setActionName(String actionName)
actionName
- 执行者public ExcelRecord runMethod(String className, String methodName)
className
- 类名methodName
- 方法名public ExcelRecord reckonByTime()
public ExcelRecord runStep(String... text)
text
- 实际运行步骤public ExcelRecord runResult(String text, boolean bug)
text
- 结果bug
- 标记是否为Bugpublic ExcelRecord runMark(String text)
text
- 备注文本public ExcelRecord runScreenshot(File screenshotFile)
screenshotFile
- 截图文件对象public ExcelRecord runId(String text)
text
- 编号文本public ExcelRecord exception(Exception exception)
exception
- 异常类public ExcelRecord exception(Exception exception, File screenshotFile)
exception(Exception)
exception
- 异常类screenshotFile
- 截图文件对象public ExcelRecord caseCondition(String... text)
text
- 前置条件public ExcelRecord caseId(String text)
text
- 用例编号public ExcelRecord caseTitle(String text)
text
- 标题public ExcelRecord caseStep(String... text)
text
- 标题public ExcelRecord caseExpect(String... text)
text
- 标题public ExcelRecord end(int index)
WriteTempletFile
调用该方法后,则将数据的缓存写入到文本的缓存内容中,以表示当前段落数据编写完成, 之后再次调用添加数据方法时,则写入一段新的内容。
注意:若调用了WriteTempletFile.getCase(int)
方法覆盖指定行内容的用例时,则传入的下标无效
end
in class WriteMultipleTempletFile<ExcelRecord>
index
- 内容下标Copyright © 2024. All rights reserved.