fix(接口测试): 修复识别不到带-的rest参数问题

--bug=1010985 --user=宋天阳 【接口测试】github#11298,REST 参数里变量 带 ‘-’ 的话,识别不到
https://www.tapd.cn/55049933/s/1117628
This commit is contained in:
song-tianyang 2022-03-15 00:26:12 +08:00 committed by fit2-zhao
parent 3389925e9e
commit 7dca59e451
2 changed files with 7 additions and 2 deletions

View File

@ -633,7 +633,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
});
}
try {
Pattern p = Pattern.compile("(\\{)([\\w]+)(\\})");
Pattern p = Pattern.compile("(\\{)([\\w-]+)(\\})");
Matcher m = p.matcher(path);
while (m.find()) {
String group = m.group(2);

View File

@ -365,7 +365,12 @@ public class ApiScenarioReportService {
}
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());
int executeTimes = 0;
if (scenario.getExecuteTimes() != null) {