| 限定符和类型 | 字段和说明 |
|---|---|
protected LinkedHashMap<String,String> |
formParaMap
post提交时form的参数值对
|
protected String |
getUrl
get方法所需参数拼接后的字符串
|
protected TreeMap<String,String> |
headersMap
header的参数值对
|
protected String |
httpUrl
发起请求的地址
|
protected HttpUtil |
httpUtil
http请求执行类
|
protected static LogUtil |
log
日志记录
|
protected String |
postUrl
post方法所需参数拼接后的字符串
|
protected LinkedHashMap<String,String> |
urlParaMap
httpurl的参数值对
|
| 构造器和说明 |
|---|
CasesUtils()
无参构造函数 说明:创建httpclient连接初始化
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
closeConn()
关闭httpclient连接
|
boolean |
CreatReportExcel(String folder,
String excelName,
String sheetName,
List<LinkedHashMap<String,String>> arrres)
输出Excel格式测试报告
|
ResponseInfo |
ExecGetResquest(TreeMap<String,String> header,
String gethttpurl)
发起Get请求
|
ResponseInfo |
ExecPostResquest(TreeMap<String,String> header,
String http,
String posturl)
发起Post
|
ResponseInfo |
execResquest(IftTestCase testCase)
发起请求,目前只支持get和post两个方法,待扩展
|
IFtResultInfo |
getIFtResultInfo(ResponseInfo resInfo,
String expRes,
String actRes)
返回结果比对后的信息
|
IFtResultInfo |
getIFtResultInfo(ResponseInfo resInfo,
String expRes,
String actRes,
int parseJson)
返回结果比对后的信息
|
protected static TreeMap<String,String> |
getSignMap(IftTestCase testcase)
获取参与签名计算的键值对map表
|
protected static IftTestCase |
updateAllParaForCase(IftTestCase testCase,
int randNum)
针对参数值中的特殊标识做处理 当前只针对标识为rand、timetamp、date时进行处理
|
protected static IftTestCase |
updateAllToListForCase(IftTestCase testcase,
String[] urlParaCheck,
String[] formParaCheck,
String[] headerParaCheck)
更新参与签名计算、url参数、form参数、header参数的List到用例中
|
protected static IftTestCase |
updateCookieForCase(IftTestCase testCase)
针对cookie信息的处理 中文按照用例中指定编码进行urlEncode转码
|
protected boolean |
updateFormParaMap(IftTestCase testcase)
拼接post方法所需的字符串 中文按照enCoding字段指定编码进行urlEncode转码
|
protected boolean |
updateHeadersMap(IftTestCase testcase)
往headers中添加参数信息
|
protected boolean |
updateHttpUrl(IftTestCase testCase)
更新httpurl
|
protected static IftTestCase |
updateSignValueForCase(IftTestCase testCase,
String signValue)
更新计算后的签名值到用例中
|
protected boolean |
updateUrlPara(IftTestCase testCase)
拼接get方法所需的字符串 中文按照enCoding字段指定编码进行urlEncode转码
|
protected static LogUtil log
protected String getUrl
protected String postUrl
protected String httpUrl
protected LinkedHashMap<String,String> urlParaMap
protected LinkedHashMap<String,String> formParaMap
protected HttpUtil httpUtil
public ResponseInfo execResquest(IftTestCase testCase)
testCase - public IFtResultInfo getIFtResultInfo(ResponseInfo resInfo, String expRes, String actRes)
resInfo - http请求后返回的信息expRes - 从用例中读取的预期结果actRes - 格式化后的实际结果 目前只支持json和xml格式public IFtResultInfo getIFtResultInfo(ResponseInfo resInfo, String expRes, String actRes, int parseJson)
resInfo - http请求后返回的信息expRes - 从用例中读取的预期结果actRes - 格式化后的实际结果 目前只支持json和xml格式parseJson - json的解析方式 默认为单层解析public void closeConn()
protected boolean updateHttpUrl(IftTestCase testCase)
testCase - protected boolean updateUrlPara(IftTestCase testCase)
testCase - protected boolean updateFormParaMap(IftTestCase testcase)
testcase - protected boolean updateHeadersMap(IftTestCase testcase)
testcase - protected static TreeMap<String,String> getSignMap(IftTestCase testcase)
testcase - protected static IftTestCase updateAllToListForCase(IftTestCase testcase, String[] urlParaCheck, String[] formParaCheck, String[] headerParaCheck)
testcase - urlParaCheck - formParaCheck - headerParaCheck - protected static IftTestCase updateSignValueForCase(IftTestCase testCase, String signValue)
testCase - signValue - protected static IftTestCase updateAllParaForCase(IftTestCase testCase, int randNum)
testCase - randNum - protected static IftTestCase updateCookieForCase(IftTestCase testCase)
testCase - public boolean CreatReportExcel(String folder, String excelName, String sheetName, List<LinkedHashMap<String,String>> arrres)
folder - excelName - sheetName - arrres - public ResponseInfo ExecPostResquest(TreeMap<String,String> header, String http, String posturl)
header - http - url地址posturl - 参数键值对 格式key=value&key=valuepublic ResponseInfo ExecGetResquest(TreeMap<String,String> header, String gethttpurl)
header - gethttpurl - get请求的url 包括参数键值对 ...?key=value&key=valueCopyright © 2013. All Rights Reserved.