fix: TCP自定义请求

This commit is contained in:
chenjianxing 2021-02-01 20:07:12 +08:00
parent b136576c40
commit fa457c1aa8
4 changed files with 12 additions and 2 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;

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

@ -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';