fix(接口自动化,测试跟踪): 修复匹配的环境请求头不起作用问题;修复思维导图导入问题。

This commit is contained in:
fit2-zhao 2021-05-07 10:06:15 +08:00 committed by fit2-zhao
parent 1b9328cc15
commit 019bd8f71c
2 changed files with 4 additions and 26 deletions

View File

@ -505,11 +505,8 @@ public class MsHTTPSamplerProxy extends MsTestElement {
}
}
// HTTP 环境中请求头
if (httpConfig != null) {
Arguments arguments = arguments(httpConfig.getHeaders());
if (arguments != null) {
tree.add(ParameterConfig.valueSupposeMock(arguments));
}
if (httpConfig != null && CollectionUtils.isNotEmpty(httpConfig.getHeaders())) {
setHeader(tree, httpConfig.getHeaders());
}
return httpConfig;
}
@ -538,25 +535,6 @@ public class MsHTTPSamplerProxy extends MsTestElement {
return null;
}
private Arguments arguments(List<KeyValue> headers) {
Arguments arguments = new Arguments();
arguments.setEnabled(true);
arguments.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : "Arguments");
arguments.setProperty(TestElement.TEST_CLASS, Arguments.class.getName());
arguments.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("ArgumentsPanel"));
// HTTP放到请求中按照域名匹配
if (CollectionUtils.isNotEmpty(headers)) {
headers.stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).forEach(keyValue ->
arguments.addArgument(keyValue.getName(), keyValue.getValue(), "=")
);
}
if (arguments.getArguments() != null && arguments.getArguments().size() > 0) {
return arguments;
}
return null;
}
private boolean isRest() {
return this.getRest().stream().filter(KeyValue::isEnable).filter(KeyValue::isValid).toArray().length > 0;
}

View File

@ -201,7 +201,7 @@ public class XmindCaseParser {
item.setParent(parent);
this.formatTestCase(item.getTitle(), parent.getPath(), item.getChildren() != null ? item.getChildren().getAttached() : null);
} else {
String nodePath = parent.getPath() + "/" + item.getTitle();
String nodePath = parent.getPath().trim() + "/" + item.getTitle().trim();
item.setPath(nodePath);
item.setParent(parent);
if (item.getChildren() != null && CollectionUtils.isNotEmpty(item.getChildren().getAttached())) {
@ -286,7 +286,7 @@ public class XmindCaseParser {
// 用例名称
String name = title.replace(tcArrs[0] + "", "").replace(tcArrs[0] + ":", "");
testCase.setName(name);
testCase.setNodePath(nodePath);
testCase.setNodePath(nodePath.trim());
// 用例等级和用例性质处理
if (tcArrs[0].indexOf("-") != -1) {