Merge remote-tracking branch 'origin/v1.7' into v1.7
This commit is contained in:
commit
172ff3d92d
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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 = "";
|
||||
}
|
||||
|
|
|
@ -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 = "";
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
item.setScenarioDefinition(JSONObject.toJSONString(object));
|
||||
if (object != null) {
|
||||
item.setScenarioDefinition(JSONObject.toJSONString(object));
|
||||
}
|
||||
apiScenarioMapper.updateByPrimaryKeySelective(item);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -406,7 +406,6 @@
|
|||
},
|
||||
setNodeTree(data) {
|
||||
this.nodeTree = data;
|
||||
console.log( this.nodeTree)
|
||||
},
|
||||
changeSelectDataRangeAll(tableType) {
|
||||
this.$route.params.dataSelectRange = 'all';
|
||||
|
|
|
@ -278,7 +278,9 @@
|
|||
url = "/api/testcase/update";
|
||||
} else {
|
||||
tmp.request.path = this.api.path;
|
||||
tmp.request.method = this.api.method;
|
||||
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);
|
||||
|
|
|
@ -72,4 +72,9 @@
|
|||
|
||||
<style scoped>
|
||||
|
||||
.jar-config-list {
|
||||
max-height: 600px;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -322,21 +322,23 @@ export function _getBodyUploadFiles(request, bodyUploadFiles, obj) {
|
|||
body = request.body;
|
||||
}
|
||||
if (body) {
|
||||
body.kvs.forEach(param => {
|
||||
if (param.files) {
|
||||
param.files.forEach(item => {
|
||||
if (item.file) {
|
||||
if (!item.id) {
|
||||
let fileId = getUUID().substring(0, 12);
|
||||
item.name = item.file.name;
|
||||
item.id = fileId;
|
||||
if (body.kvs) {
|
||||
body.kvs.forEach(param => {
|
||||
if (param.files) {
|
||||
param.files.forEach(item => {
|
||||
if (item.file) {
|
||||
if (!item.id) {
|
||||
let fileId = getUUID().substring(0, 12);
|
||||
item.name = item.file.name;
|
||||
item.id = fileId;
|
||||
}
|
||||
obj.bodyUploadIds.push(item.id);
|
||||
bodyUploadFiles.push(item.file);
|
||||
}
|
||||
obj.bodyUploadIds.push(item.id);
|
||||
bodyUploadFiles.push(item.file);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
if (body.binary) {
|
||||
body.binary.forEach(param => {
|
||||
if (param.files) {
|
||||
|
|
Loading…
Reference in New Issue