Merge remote-tracking branch 'origin/v1.7' into v1.7

This commit is contained in:
song.tianyang 2021-02-02 10:38:54 +08:00
commit 172ff3d92d
10 changed files with 47 additions and 28 deletions

View File

@ -98,6 +98,8 @@ public abstract class MsTestElement {
private String refType;
@JSONField(ordinal = 10)
private LinkedList<MsTestElement> hashTree;
@JSONField(ordinal = 11)
private boolean customizeReq;
private MsTestElement parent;
@ -188,15 +190,14 @@ public abstract class MsTestElement {
csvDataSet.setEnabled(true);
csvDataSet.setProperty(TestElement.TEST_CLASS, CSVDataSet.class.getName());
csvDataSet.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
csvDataSet.setName(item.getName());
csvDataSet.setProperty("fileEncoding", item.getEncoding());
csvDataSet.setProperty("variableNames", item.getName());
csvDataSet.setName(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName());
csvDataSet.setProperty("fileEncoding", StringUtils.isEmpty(item.getEncoding()) ? "UTF-8" : item.getEncoding());
if (CollectionUtils.isNotEmpty(item.getFiles())) {
csvDataSet.setProperty("filename", BODY_FILE_DIR + "/" + item.getFiles().get(0).getId() + "_" + item.getFiles().get(0).getName());
}
csvDataSet.setIgnoreFirstLine(false);
csvDataSet.setProperty("delimiter", item.getDelimiter());
csvDataSet.setComment(item.getDescription());
csvDataSet.setComment(StringUtils.isEmpty(item.getDescription()) ? "" : item.getDescription());
tree.add(csvDataSet);
});
}
@ -218,7 +219,7 @@ public abstract class MsTestElement {
counterConfig.setVarName(item.getName());
counterConfig.setIncrement(item.getIncrement());
counterConfig.setFormat(item.getValue());
counterConfig.setComment(item.getDescription());
counterConfig.setComment(StringUtils.isEmpty(item.getDescription()) ? "" : item.getDescription());
tree.add(counterConfig);
});
}

View File

@ -79,13 +79,13 @@ public class MsIfController extends MsTestElement {
}
if (StringUtils.equals(operator, "is empty")) {
variable = "empty(" + variable + ")";
variable = "!empty(" + variable + ")";
operator = "";
value = "";
}
if (StringUtils.equals(operator, "is not empty")) {
variable = "!empty(" + variable + ")";
variable = "empty(" + variable + ")";
operator = "";
value = "";
}

View File

@ -123,13 +123,13 @@ public class MsLoopController extends MsTestElement {
}
if (StringUtils.equals(operator, "is empty")) {
variable = "empty(" + variable + ")";
variable = "!empty(" + variable + ")";
operator = "";
value = "";
}
if (StringUtils.equals(operator, "is not empty")) {
variable = "!empty(" + variable + ")";
variable = "empty(" + variable + ")";
operator = "";
value = "";
}

View File

@ -12,6 +12,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.jmeter.config.Arguments;
import org.apache.jmeter.config.ConfigTestElement;
import org.apache.jmeter.modifiers.UserParameters;
import org.apache.jmeter.protocol.tcp.sampler.TCPSampler;
@ -79,6 +80,13 @@ public class MsTCPSampler extends MsTestElement {
}
config.setConfig(getEnvironmentConfig(useEnvironment));
parseEnvironment(config.getConfig());
// 添加环境中的公共变量
Arguments arguments = this.addArguments(config);
if (arguments != null) {
tree.add(this.addArguments(config));
}
final HashTree samplerHashTree = new ListedHashTree();
samplerHashTree.add(tcpConfig());
tree.set(tcpSampler(config), samplerHashTree);
@ -94,7 +102,7 @@ public class MsTCPSampler extends MsTestElement {
}
private void parseEnvironment(EnvironmentConfig config) {
if (config != null && config.getTcpConfig() != null) {
if (!isCustomizeReq() && config != null && config.getTcpConfig() != null) {
this.server = config.getTcpConfig().getServer();
this.port = config.getTcpConfig().getPort();
}

View File

@ -516,7 +516,6 @@ public class ApiAutomationService {
ParameterConfig config = new ParameterConfig();
config.setConfig(envConfig);
HashTree hashTree = request.getTestElement().generateHashTree(config);
// 调用执行方法
createScenarioReport(request.getId(), request.getScenarioId(), request.getScenarioName(), ReportTriggerMode.MANUAL.name(), request.getExecuteType(), request.getProjectId(),
SessionUtils.getUserId());
@ -717,7 +716,9 @@ public class ApiAutomationService {
apiScenarios.forEach(item -> {
JSONObject object = JSONObject.parseObject(item.getScenarioDefinition());
object.put("environmentId", request.getEnvironmentId());
if (object != null) {
item.setScenarioDefinition(JSONObject.toJSONString(object));
}
apiScenarioMapper.updateByPrimaryKeySelective(item);
});
}

View File

@ -235,6 +235,7 @@
this.loading = true;
this.runData = [];
this.request.useEnvironment = this.currentEnvironmentId;
this.request.customizeReq = this.isCustomizeReq;
let debugData = {
id: this.currentScenario.id, name: this.currentScenario.name, type: "scenario",
variables: this.currentScenario.variables, referenced: 'Created', enableCookieShare: this.enableCookieShare,

View File

@ -406,7 +406,6 @@
},
setNodeTree(data) {
this.nodeTree = data;
console.log( this.nodeTree)
},
changeSelectDataRangeAll(tableType) {
this.$route.params.dataSelectRange = 'all';

View File

@ -278,8 +278,10 @@
url = "/api/testcase/update";
} else {
tmp.request.path = this.api.path;
if (tmp.request.protocol != "dubbo://" && tmp.request.protocol != "DUBBO") {
tmp.request.method = this.api.method;
}
}
if (tmp.tags instanceof Array) {
tmp.tags = JSON.stringify(tmp.tags);
}

View File

@ -72,4 +72,9 @@
<style scoped>
.jar-config-list {
max-height: 600px;
overflow: scroll;
}
</style>

View File

@ -322,6 +322,7 @@ export function _getBodyUploadFiles(request, bodyUploadFiles, obj) {
body = request.body;
}
if (body) {
if (body.kvs) {
body.kvs.forEach(param => {
if (param.files) {
param.files.forEach(item => {
@ -337,6 +338,7 @@ export function _getBodyUploadFiles(request, bodyUploadFiles, obj) {
});
}
});
}
if (body.binary) {
body.binary.forEach(param => {
if (param.files) {