Commit 41d9f868 authored by 黎博's avatar 黎博

用例执行bug修复

parent b9abfd83
...@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -71,9 +72,15 @@ public class TestcaseServiceImpl extends ServiceImpl<TestcaseMapper, Testcase> i ...@@ -71,9 +72,15 @@ public class TestcaseServiceImpl extends ServiceImpl<TestcaseMapper, Testcase> i
// String variables = testcase.getVariables(); // String variables = testcase.getVariables();
String extract = testcase.getExtract(); String extract = testcase.getExtract();
String validate = testcase.getValidate(); String validate = testcase.getValidate();
Map<String, String> headersMap = new HashMap<>();
Map<String, String> parameterMap = new HashMap<>();
// 参数准备 // 参数准备
Map<String, String> headersMap = JSON.parseObject(headers, Map.class); if (!StringUtils.isEmpty(headers)) {
Map<String, String> parameterMap = JSON.parseObject(parameters, Map.class); headersMap = JSON.parseObject(headers, Map.class);
}
if (!StringUtils.isEmpty(parameters)) {
parameterMap = JSON.parseObject(parameters, Map.class);
}
// 使用变量替换headers // 使用变量替换headers
// if (variables != null && !variables.isEmpty() && headers != null && !headers.isEmpty()) { // if (variables != null && !variables.isEmpty() && headers != null && !headers.isEmpty()) {
// headersMap = autoUtilsService.replaceHeaders(headers, variables); // headersMap = autoUtilsService.replaceHeaders(headers, variables);
...@@ -99,6 +106,8 @@ public class TestcaseServiceImpl extends ServiceImpl<TestcaseMapper, Testcase> i ...@@ -99,6 +106,8 @@ public class TestcaseServiceImpl extends ServiceImpl<TestcaseMapper, Testcase> i
response = HttpClientUtils.doPostJson(url, headersMap, JSON.toJSONString(parameterMap)); response = HttpClientUtils.doPostJson(url, headersMap, JSON.toJSONString(parameterMap));
} else if (paramType.equals("form")) { } else if (paramType.equals("form")) {
response = HttpClientUtils.doPost(url, headersMap, parameterMap); response = HttpClientUtils.doPost(url, headersMap, parameterMap);
} else if (paramType.equals("params")) {
response = HttpClientUtils.doPost(url, headersMap, parameterMap);
} }
break; break;
default: default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment