fix(接口测试): 修复识别不到带-的rest参数问题
--bug=1010985 --user=宋天阳 【接口测试】github#11298,REST 参数里变量 带 ‘-’ 的话,识别不到 https://www.tapd.cn/55049933/s/1117628
This commit is contained in:
parent
3389925e9e
commit
7dca59e451
|
@ -633,7 +633,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Pattern p = Pattern.compile("(\\{)([\\w]+)(\\})");
|
Pattern p = Pattern.compile("(\\{)([\\w-]+)(\\})");
|
||||||
Matcher m = p.matcher(path);
|
Matcher m = p.matcher(path);
|
||||||
while (m.find()) {
|
while (m.find()) {
|
||||||
String group = m.group(2);
|
String group = m.group(2);
|
||||||
|
|
|
@ -365,7 +365,12 @@ public class ApiScenarioReportService {
|
||||||
}
|
}
|
||||||
|
|
||||||
long successSize = requestResults.stream().filter(requestResult -> StringUtils.equalsIgnoreCase(requestResult.getStatus(), ScenarioStatus.Success.name())).count();
|
long successSize = requestResults.stream().filter(requestResult -> StringUtils.equalsIgnoreCase(requestResult.getStatus(), ScenarioStatus.Success.name())).count();
|
||||||
scenario.setPassRate(new DecimalFormat("0%").format((float) successSize / requestResults.size()));
|
if(requestResults.size() == 0){
|
||||||
|
scenario.setPassRate("0%");
|
||||||
|
}else {
|
||||||
|
scenario.setPassRate(new DecimalFormat("0%").format((float) successSize / requestResults.size()));
|
||||||
|
}
|
||||||
|
|
||||||
scenario.setReportId(dto.getReportId());
|
scenario.setReportId(dto.getReportId());
|
||||||
int executeTimes = 0;
|
int executeTimes = 0;
|
||||||
if (scenario.getExecuteTimes() != null) {
|
if (scenario.getExecuteTimes() != null) {
|
||||||
|
|
Loading…
Reference in New Issue