public abstract class AbstractPresetCaseTemplet extends AbstractXmlCaseTemplet
文件名:PresetCaseTemplet.java
用途:定义预设模板中所包含的字段及方法
编码时间:2023年1月18日 上午8:07:16
修改时间:2023年1月18日 上午8:07:16
Modifier and Type | Field and Description |
---|---|
protected String |
ATT_ID
标识(id)属性
|
protected String |
ATT_INTENTION
测试意图(intention)属性
|
protected String |
ATT_NAME
名称(name)属性
|
protected String |
ATT_RANK
优先级(rank)属性
|
protected String |
ATT_STEP
步骤(step)属性
|
protected String |
ATT_VALUE
值(value)属性
|
protected static String |
DEFAULT_TEMPLET_FOLDER
定义包内用例模板文件所在的路径
|
protected boolean |
isStepDetail
存储是否读取详细步骤的内容
|
protected boolean |
isStepIndependentCase
存储每条步骤是否作为独立的用例
|
protected String |
LABEL_CASES
根标签(cases)
|
protected String |
LABEL_EXPECT
预期(except)标签
|
protected String |
LABEL_GROUP
用例组(group)标签
|
protected String |
LABEL_KEY
关键词(key)标签
|
protected String |
LABEL_PRECONDITION
前置条件(precondition)标签
|
protected String |
LABEL_RANK
优先级(rank)标签
|
protected String |
LABEL_STEP
步骤标(step)签
|
protected String |
LABEL_STEPDETAIL
详细步骤(stepdetail)标签
|
protected String |
LABEL_TITLE
标题(title)标签
|
static String |
RANK_1
1级优先级
|
static String |
RANK_2
2级优先级
|
static String |
RANK_3
3级优先级
|
static String |
RANK_4
4级优先级
|
configXml
placeholder, REPLACE_WORD_SIGN
Modifier | Constructor and Description |
---|---|
|
AbstractPresetCaseTemplet(File xmlTempletFile)
构造对象,读取xml文件模板类
|
protected |
AbstractPresetCaseTemplet(String fileName)
构造对象,根据资源文件夹中的默认模板文件名,对模板文件进行读取
|
Modifier and Type | Method and Description |
---|---|
protected Map<LabelType,List<Entry<String,String[]>>> |
addContent(Map<LabelType,List<Entry<String,String[]>>> allContentMap,
LabelType labelType,
List<Entry<String,String[]>> contentList)
该方法用于将需要添加的测试用例内容,附加到内容map集合中,并返回该集合进行返回
|
protected List<CaseData> |
createCaseDataList(AbstractPresetCaseTemplet templetClass,
Map<LabelType,List<Entry<String,String[]>>> allContentMap)
该方法用于生成测试用例集合
|
protected List<String> |
getAttributeValue(String xptah,
String attribute)
该方法用于根据指定的xptah内容,查找并返回元素指定属性下的内容集合
|
protected List<String> |
getContentList(String groupName,
String labelName,
String otherXpath,
String attName,
String... ids)
该方法用于读取模板中的指定内容,并将所有需要读取的内容组成集合进行返回
|
List<String> |
getTempletContent(LabelType labelType,
String groupName,
String... ids)
该方法用于返回用指定例组中的指定id对应的内容
|
protected String |
getXpathFormat(String groupName,
String labelName,
String id,
String lowerLabel)
该方法用于生成查找元素的xpath信息
|
addReplaceFunction, addReplaceWord, getPlaceholder
public static final String RANK_1
public static final String RANK_2
public static final String RANK_3
public static final String RANK_4
protected static final String DEFAULT_TEMPLET_FOLDER
protected final String LABEL_CASES
protected final String LABEL_GROUP
protected final String LABEL_RANK
protected final String LABEL_KEY
protected final String LABEL_PRECONDITION
protected final String LABEL_TITLE
protected final String LABEL_STEP
protected final String LABEL_STEPDETAIL
protected final String LABEL_EXPECT
protected final String ATT_NAME
protected final String ATT_ID
protected final String ATT_VALUE
protected final String ATT_INTENTION
protected final String ATT_STEP
protected final String ATT_RANK
protected boolean isStepDetail
protected boolean isStepIndependentCase
public AbstractPresetCaseTemplet(File xmlTempletFile)
xmlTempletFile
- xml模板文件类对象protected AbstractPresetCaseTemplet(String fileName)
fileName
- 文件名称public List<String> getTempletContent(LabelType labelType, String groupName, String... ids)
labelType
- 预设用例模板内容枚举groupName
- 用例组名称ids
- 用例id组protected List<String> getContentList(String groupName, String labelName, String otherXpath, String attName, String... ids)
groupName
- 用例组名称labelName
- 读取的标签otherXpath
- 需要拼接的xpath内容attName
- 读取的属性名称ids
- 用例id组protected List<String> getAttributeValue(String xptah, String attribute)
xptah
- 查找元素的xpathattribute
- 元素对应的属性protected String getXpathFormat(String groupName, String labelName, String id, String lowerLabel)
groupName
- 用例组名称labelName
- 标签名称id
- 标签idlowerLabel
- 下级元素标签protected List<CaseData> createCaseDataList(AbstractPresetCaseTemplet templetClass, Map<LabelType,List<Entry<String,String[]>>> allContentMap)
templetClass
- 测试用例模板读取类allContentMap
- 需要读取的测试用例集合protected Map<LabelType,List<Entry<String,String[]>>> addContent(Map<LabelType,List<Entry<String,String[]>>> allContentMap, LabelType labelType, List<Entry<String,String[]>> contentList)
allContentMap
- 所有测试用例内容集合labelType
- 标签枚举contentList
- 内容集合Copyright © 2024. All rights reserved.