Merge remote-tracking branch 'origin/master'

# Conflicts:
#	frontend/src/business/components/xpack
This commit is contained in:
Captain.B 2021-01-12 15:09:04 +08:00
commit d7dbcf0860
33 changed files with 516 additions and 352 deletions

View File

@ -58,6 +58,8 @@ public class MsScenario extends MsTestElement {
if (!this.isEnable()) {
return;
}
config.setStep(this.name);
config.setEnableCookieShare(enableCookieShare);
if (StringUtils.isNotEmpty(environmentId)) {
ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class);

View File

@ -1,5 +1,6 @@
package io.metersphere.api.dto.definition.request;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.annotation.JSONType;
import com.fasterxml.jackson.annotation.JsonSubTypes;
@ -22,8 +23,11 @@ import io.metersphere.api.dto.definition.request.sampler.MsJDBCSampler;
import io.metersphere.api.dto.definition.request.sampler.MsTCPSampler;
import io.metersphere.api.dto.definition.request.timer.MsConstantTimer;
import io.metersphere.api.dto.scenario.KeyValue;
import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
import io.metersphere.api.service.ApiDefinitionService;
import io.metersphere.api.service.ApiTestEnvironmentService;
import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.LogUtil;
import lombok.Data;
@ -153,6 +157,15 @@ public abstract class MsTestElement {
}
return arguments;
}
protected EnvironmentConfig getEnvironmentConfig(String environmentId) {
ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class);
ApiTestEnvironmentWithBLOBs environment = environmentService.get(environmentId);
if (environment != null && environment.getConfig() != null) {
return JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class);
}
return null;
}
}

View File

@ -14,5 +14,9 @@ public class ParameterConfig {
private List<ScenarioVariable> variables;
// 公共Cookie
private boolean enableCookieShare;
// 步骤
private String step;
private final String stepType = "STEP_GROUP";
}

View File

@ -15,6 +15,7 @@ import io.metersphere.api.dto.scenario.KeyValue;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.jmeter.config.ConfigTestElement;
import org.apache.jmeter.save.SaveService;
import org.apache.jmeter.testelement.TestElement;
@ -64,7 +65,7 @@ public class MsDubboSampler extends MsTestElement {
this.getRefElement(this);
}
final HashTree testPlanTree = tree.add(dubboSample());
final HashTree testPlanTree = tree.add(dubboSample(config));
if (CollectionUtils.isNotEmpty(hashTree)) {
hashTree.forEach(el -> {
el.toHashTree(testPlanTree, el.getHashTree(), config);
@ -72,9 +73,12 @@ public class MsDubboSampler extends MsTestElement {
}
}
private DubboSample dubboSample() {
private DubboSample dubboSample(ParameterConfig config) {
DubboSample sampler = new DubboSample();
sampler.setName(this.getName());
if (config != null && StringUtils.isNotEmpty(config.getStep())) {
sampler.setName(this.getName() + "<->" + config.getStep());
}
sampler.setProperty(TestElement.TEST_CLASS, DubboSample.class.getName());
sampler.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("DubboSampleGui"));
@ -97,19 +101,6 @@ public class MsDubboSampler extends MsTestElement {
return sampler;
}
private ConfigTestElement dubboConfig() {
ConfigTestElement configTestElement = new ConfigTestElement();
configTestElement.setEnabled(true);
configTestElement.setName(this.getName());
configTestElement.setProperty(TestElement.TEST_CLASS, ConfigTestElement.class.getName());
configTestElement.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("DubboDefaultConfigGui"));
configTestElement.addConfigElement(configCenter(this.getConfigCenter()));
configTestElement.addConfigElement(registryCenter(this.getRegistryCenter()));
configTestElement.addConfigElement(consumerAndService(this.getConsumerAndService()));
return configTestElement;
}
private ConfigTestElement configCenter(MsConfigCenter configCenter) {
ConfigTestElement configTestElement = new ConfigTestElement();
if (configCenter != null && configCenter.getProtocol() != null && configCenter.getUsername() != null && configCenter.getPassword() != null) {

View File

@ -1,6 +1,5 @@
package io.metersphere.api.dto.definition.request.sampler;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.annotation.JSONType;
import io.metersphere.api.dto.definition.request.MsTestElement;
@ -8,10 +7,6 @@ import io.metersphere.api.dto.definition.request.ParameterConfig;
import io.metersphere.api.dto.definition.request.dns.MsDNSCacheManager;
import io.metersphere.api.dto.scenario.Body;
import io.metersphere.api.dto.scenario.KeyValue;
import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
import io.metersphere.api.service.ApiTestEnvironmentService;
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.ScriptEngineUtils;
import lombok.Data;
@ -35,6 +30,8 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Data
@EqualsAndHashCode(callSuper = true)
@JSONType(typeName = "HTTPSamplerProxy")
@ -99,6 +96,10 @@ public class MsHTTPSamplerProxy extends MsTestElement {
HTTPSamplerProxy sampler = new HTTPSamplerProxy();
sampler.setEnabled(true);
sampler.setName(this.getName());
if (config != null && StringUtils.isNotEmpty(config.getStep())) {
sampler.setName(this.getName() + "<->" + config.getStep());
}
sampler.setProperty(TestElement.TEST_CLASS, HTTPSamplerProxy.class.getName());
sampler.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("HttpTestSampleGui"));
sampler.setMethod(this.getMethod());
@ -108,13 +109,9 @@ public class MsHTTPSamplerProxy extends MsTestElement {
sampler.setFollowRedirects(this.isFollowRedirects());
sampler.setUseKeepAlive(true);
sampler.setDoMultipart(this.isDoMultipartPost());
if (useEnvironment != null) {
ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class);
ApiTestEnvironmentWithBLOBs environment = environmentService.get(useEnvironment);
if (environment != null && environment.getConfig() != null) {
config.setConfig(JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class));
}
}
config.setConfig(getEnvironmentConfig(useEnvironment));
// 添加环境中的公共变量
Arguments arguments = this.addArguments(config);
if (arguments != null) {

View File

@ -64,7 +64,7 @@ public class MsJDBCSampler extends MsTestElement {
if (this.dataSource == null) {
MSException.throwException("数据源为空无法执行");
}
final HashTree samplerHashTree = tree.add(jdbcSampler());
final HashTree samplerHashTree = tree.add(jdbcSampler(config));
tree.add(jdbcDataSource());
tree.add(arguments(this.getName() + " Variables", this.getVariables()));
if (CollectionUtils.isNotEmpty(hashTree)) {
@ -102,9 +102,12 @@ public class MsJDBCSampler extends MsTestElement {
return arguments;
}
private JDBCSampler jdbcSampler() {
private JDBCSampler jdbcSampler(ParameterConfig config) {
JDBCSampler sampler = new JDBCSampler();
sampler.setName(this.getName());
if (config != null && StringUtils.isNotEmpty(config.getStep())) {
sampler.setName(this.getName() + "<->" + config.getStep());
}
sampler.setProperty(TestElement.TEST_CLASS, JDBCSampler.class.getName());
sampler.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
// request.getDataSource() 是ID需要转换为Name

View File

@ -4,9 +4,12 @@ import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.annotation.JSONType;
import io.metersphere.api.dto.definition.request.MsTestElement;
import io.metersphere.api.dto.definition.request.ParameterConfig;
import io.metersphere.api.dto.scenario.KeyValue;
import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.jmeter.config.ConfigTestElement;
import org.apache.jmeter.protocol.tcp.sampler.TCPSampler;
import org.apache.jmeter.save.SaveService;
@ -15,6 +18,7 @@ import org.apache.jorphan.collections.HashTree;
import org.apache.jorphan.collections.ListedHashTree;
import java.util.List;
import java.util.regex.Matcher;
@Data
@EqualsAndHashCode(callSuper = true)
@ -50,6 +54,10 @@ public class MsTCPSampler extends MsTestElement {
private String request;
@JSONField(ordinal = 34)
private Object requestResult;
@JSONField(ordinal = 35)
private List<KeyValue> parameters;
@JSONField(ordinal = 36)
private String useEnvironment;
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
if (!this.isEnable()) {
@ -58,9 +66,12 @@ public class MsTCPSampler extends MsTestElement {
if (this.getReferenced() != null && this.getReferenced().equals("REF")) {
this.getRefElement(this);
}
parseParameters();
config.setConfig(getEnvironmentConfig(useEnvironment));
parseEnvironment(config.getConfig());
final HashTree samplerHashTree = new ListedHashTree();
samplerHashTree.add(tcpConfig());
tree.set(tcpSampler(), samplerHashTree);
tree.set(tcpSampler(config), samplerHashTree);
if (CollectionUtils.isNotEmpty(hashTree)) {
hashTree.forEach(el -> {
el.toHashTree(samplerHashTree, el.getHashTree(), config);
@ -68,9 +79,20 @@ public class MsTCPSampler extends MsTestElement {
}
}
private TCPSampler tcpSampler() {
private void parseEnvironment(EnvironmentConfig config) {
if (config != null && config.getTcpConfig() != null) {
this.server = config.getTcpConfig().getServer();
this.port = config.getTcpConfig().getPort();
}
}
private TCPSampler tcpSampler(ParameterConfig config) {
TCPSampler tcpSampler = new TCPSampler();
tcpSampler.setName(this.getName());
if (config != null && StringUtils.isNotEmpty(config.getStep())) {
tcpSampler.setName(this.getName() + "<->" + config.getStep());
}
tcpSampler.setProperty(TestElement.TEST_CLASS, TCPSampler.class.getName());
tcpSampler.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TCPSamplerGui"));
tcpSampler.setClassname(this.getClassname());
@ -89,6 +111,16 @@ public class MsTCPSampler extends MsTestElement {
return tcpSampler;
}
private void parseParameters() {
if (CollectionUtils.isNotEmpty(parameters)) {
parameters.forEach(item -> {
if (item.isEnable() && StringUtils.isNotBlank(item.getValue())) {
request = request.replaceAll("\\$\\{" + item.getName() + "\\}", Matcher.quoteReplacement(item.getValue()));
}
});
}
}
private ConfigTestElement tcpConfig() {
ConfigTestElement configTestElement = new ConfigTestElement();
configTestElement.setEnabled(true);

View File

@ -22,7 +22,7 @@ public class ScenarioResult {
private int passAssertions = 0;
private final List<RequestResult> requestResults = new ArrayList<>();
private List<RequestResult> requestResults = new ArrayList<>();
public void addResponseTime(long time) {
this.responseTime += time;

View File

@ -1,9 +1,11 @@
package io.metersphere.api.jmeter;
import io.metersphere.commons.utils.BeanUtils;
import lombok.Data;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.*;
@Data
public class TestResult {
@ -38,5 +40,39 @@ public class TestResult {
this.passAssertions += count;
}
private static final String separator = "<->";
public void addScenario(ScenarioResult result) {
Map<String, List<RequestResult>> requestResultMap = new LinkedHashMap<>();
if (result != null && CollectionUtils.isNotEmpty(result.getRequestResults())) {
result.getRequestResults().forEach(item -> {
if (StringUtils.isNotEmpty(item.getName()) && item.getName().indexOf(separator) != -1) {
String array[] = item.getName().split(separator);
String scenarioName = array[array.length - 1];
item.setName(item.getName().replace(separator + scenarioName, ""));
if (requestResultMap.containsKey(scenarioName)) {
requestResultMap.get(scenarioName).add(item);
} else {
List<RequestResult> requestResults = new LinkedList<>();
requestResults.add(item);
requestResultMap.put(scenarioName, requestResults);
}
item.getSubRequestResults().forEach(subItem -> {
subItem.setName(item.getName());
});
}
});
}
if (!requestResultMap.isEmpty()) {
requestResultMap.forEach((k, v) -> {
ScenarioResult scenarioResult = new ScenarioResult();
BeanUtils.copyBean(scenarioResult, result);
scenarioResult.setName(k);
scenarioResult.setRequestResults(v);
scenarios.add(scenarioResult);
});
} else {
scenarios.add(result);
}
}
}

View File

@ -368,14 +368,12 @@ public class ApiAutomationService {
// 多态JSON普通转换会丢失内容需要通过 ObjectMapper 获取
if (element != null && StringUtils.isNotEmpty(element.getString("hashTree"))) {
LinkedList<MsTestElement> elements = mapper.readValue(element.getString("hashTree"),
new TypeReference<LinkedList<MsTestElement>>() {
});
new TypeReference<LinkedList<MsTestElement>>() {});
scenario.setHashTree(elements);
}
if (StringUtils.isNotEmpty(element.getString("variables"))) {
LinkedList<ScenarioVariable> variables = mapper.readValue(element.getString("variables"),
new TypeReference<LinkedList<ScenarioVariable>>() {
});
new TypeReference<LinkedList<ScenarioVariable>>() {});
scenario.setVariables(variables);
}
group.setEnableCookieShare(scenario.isEnableCookieShare());
@ -443,6 +441,7 @@ 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());

View File

@ -24,7 +24,7 @@ import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.apache.commons.collections.CollectionUtils;
import javax.annotation.Resource;
import java.util.*;
@ -214,22 +214,21 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
request.setUpdateTime(System.currentTimeMillis());
checkApiModuleExist(request);
List<ApiDefinitionResult> apiDefinitionResults = queryByModuleIds(request.getNodeIds());
apiDefinitionResults.forEach(apiDefinition -> {
if (StringUtils.isNotBlank(apiDefinition.getModulePath())) {
StringBuilder path = new StringBuilder(apiDefinition.getModulePath());
List<String> pathLists = Arrays.asList(path.toString().split("/"));
pathLists.set(request.getLevel(), request.getName());
path.delete(0, path.length());
for (int i = 1; i < pathLists.size(); i++) {
path = path.append("/").append(pathLists.get(i));
if (CollectionUtils.isNotEmpty(apiDefinitionResults)) {
apiDefinitionResults.forEach(apiDefinition -> {
if (apiDefinition != null && StringUtils.isNotBlank(apiDefinition.getModulePath())) {
StringBuilder path = new StringBuilder(apiDefinition.getModulePath());
List<String> pathLists = Arrays.asList(path.toString().split("/"));
pathLists.set(request.getLevel(), request.getName());
path.delete(0, path.length());
for (int i = 1; i < pathLists.size(); i++) {
path = path.append("/").append(pathLists.get(i));
}
apiDefinition.setModulePath(path.toString());
}
apiDefinition.setModulePath(path.toString());
}
});
batchUpdateApiDefinition(apiDefinitionResults);
});
batchUpdateApiDefinition(apiDefinitionResults);
}
return apiModuleMapper.updateByPrimaryKeySelective(request);
}

View File

@ -3,7 +3,9 @@ package io.metersphere.api.service;
import com.alibaba.fastjson.JSON;
import io.metersphere.api.dto.DeleteAPIReportRequest;
import io.metersphere.api.dto.QueryAPIReportRequest;
import io.metersphere.api.dto.automation.*;
import io.metersphere.api.dto.automation.APIScenarioReportResult;
import io.metersphere.api.dto.automation.ExecuteType;
import io.metersphere.api.dto.automation.ScenarioStatus;
import io.metersphere.api.dto.datacount.ApiDataCountResult;
import io.metersphere.api.jmeter.ScenarioResult;
import io.metersphere.api.jmeter.TestResult;
@ -26,7 +28,6 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.nio.charset.StandardCharsets;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -136,10 +137,12 @@ public class ApiScenarioReportService {
// 报告详情内容
ApiScenarioReportDetail detail = new ApiScenarioReportDetail();
TestResult newResult = createTestResult(result.getTestId(), scenarioResult);
List<ScenarioResult> scenarioResults = new ArrayList();
scenarioResult.setName(report.getScenarioName());
scenarioResults.add(scenarioResult);
newResult.setScenarios(scenarioResults);
// List<ScenarioResult> scenarioResults = new ArrayList();
// scenarioResult.setName(report.getScenarioName());
// scenarioResults.add(scenarioResult);
// newResult.setScenarios(scenarioResults);
newResult.addScenario(scenarioResult);
detail.setContent(JSON.toJSONString(newResult).getBytes(StandardCharsets.UTF_8));
detail.setReportId(report.getId());
detail.setProjectId(report.getProjectId());
@ -158,10 +161,11 @@ public class ApiScenarioReportService {
// 报告详情内容
ApiScenarioReportDetail detail = new ApiScenarioReportDetail();
TestResult newResult = createTestResult(result.getTestId(), item);
List<ScenarioResult> scenarioResults = new ArrayList();
item.setName(report.getScenarioName());
scenarioResults.add(item);
newResult.setScenarios(scenarioResults);
// List<ScenarioResult> scenarioResults = new ArrayList();
// item.setName(report.getScenarioName());
// scenarioResults.add(item);
// newResult.setScenarios(scenarioResults);
newResult.addScenario(item);
detail.setContent(JSON.toJSONString(newResult).getBytes(StandardCharsets.UTF_8));
detail.setReportId(report.getId());
detail.setProjectId(report.getProjectId());

View File

@ -9,14 +9,21 @@
<main v-if="this.isNotRunning">
<ms-metric-chart :content="content" :totalTime="totalTime"/>
<div>
<ms-scenario-results :scenarios="content.scenarios" v-on:requestResult="requestResult"/>
<!--<ms-scenario-results :scenarios="content.scenarios" v-on:requestResult="requestResult"/>-->
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane :label="$t('api_report.total')" name="total">
<ms-scenario-results :scenarios="content.scenarios" v-on:requestResult="requestResult"/>
</el-tab-pane>
<el-tab-pane name="fail">
<template slot="label">
<span class="fail">{{ $t('api_report.fail') }}</span>
</template>
<ms-scenario-results v-on:requestResult="requestResult" :scenarios="fails"/>
</el-tab-pane>
</el-tabs>
</div>
<!--<el-collapse-transition>-->
<!--<div v-show="isActive" style="width: 99%">-->
<!--<ms-request-result-tail v-if="isRequestResult" :request-type="requestType" :request="request"-->
<!--:scenario-name="scenarioName"/>-->
<!--</div>-->
<!--</el-collapse-transition>-->
<ms-api-report-export v-if="reportExportVisible" id="apiTestReport" :title="report.testName"
:content="content" :total-time="totalTime"/>
</main>

View File

@ -1,5 +1,5 @@
<template>
<div class="scenario-result">
<div class="scenario-result" v-if="scenario && scenario.requestResults && scenario.requestResults.length>0">
<div @click="active">
<el-row :gutter="10" type="flex" align="middle" class="info">

View File

@ -79,7 +79,7 @@
<script>
import MsSqlBasisParameters from "../../definition/components/request/database/BasisParameters";
import MsTcpBasisParameters from "../../definition/components/request/tcp/BasisParameters";
import MsTcpBasisParameters from "../../definition/components/request/tcp/TcpBasisParameters";
import MsDubboBasisParameters from "../../definition/components/request/dubbo/BasisParameters";
import MsApiRequestForm from "../../definition/components/request/http/ApiRequestForm";
import {REQ_METHOD} from "../../definition/model/JsonData";

View File

@ -22,7 +22,7 @@
<script>
import MsSqlBasisParameters from "../../definition/components/request/database/BasisParameters";
import MsTcpBasisParameters from "../../definition/components/request/tcp/BasisParameters";
import MsTcpBasisParameters from "../../definition/components/request/tcp/TcpBasisParameters";
import MsDubboBasisParameters from "../../definition/components/request/dubbo/BasisParameters";
import MsApiRequestForm from "../../definition/components/request/http/ApiRequestForm";

View File

@ -1,5 +1,5 @@
<template>
<div style="min-width: 1200px;margin-bottom: 20px">
<div style="margin-bottom: 20px">
<span class="kv-description" v-if="description">
{{ description }}
</span>

View File

@ -28,18 +28,15 @@
<el-row v-if="body.type == 'Form Data' || body.type == 'WWW_FORM'">
<el-link class="ms-el-link" @click="batchAdd"> {{$t("commons.batch_add")}}</el-link>
</el-row>
<div style="min-width: 1200px;" v-if="body.type == 'Form Data' || body.type == 'WWW_FORM'">
<ms-api-variable :is-read-only="isReadOnly"
:parameters="body.kvs"
:isShowEnable="isShowEnable" type="body" v-if="body.type == 'Form Data'"/>
<ms-api-variable :is-read-only="isReadOnly"
:parameters="body.kvs"
:isShowEnable="isShowEnable"
type="body"
v-if="body.type == 'Form Data'"/>
<ms-api-from-url-variable :is-read-only="isReadOnly"
:parameters="body.kvs"
type="body"
v-if="body.type == 'WWW_FORM'"/>
<ms-api-from-url-variable :is-read-only="isReadOnly"
:parameters="body.kvs"
type="body" v-if="body.type == 'WWW_FORM'"/>
</div>
<div v-if="body.type == 'JSON'">
<div style="padding: 10px">
<el-switch active-text="JSON-SCHEMA" v-model="body.format" active-value="JSON-SCHEMA"/>

View File

@ -90,7 +90,7 @@ import MsApiRequestForm from "../request/http/ApiRequestForm";
import ApiEnvironmentConfig from "../environment/ApiEnvironmentConfig";
import MsApiAssertions from "../assertion/ApiAssertions";
import MsSqlBasisParameters from "../request/database/BasisParameters";
import MsTcpBasisParameters from "../request/tcp/BasisParameters";
import MsTcpBasisParameters from "../request/tcp/TcpBasisParameters";
import MsDubboBasisParameters from "../request/dubbo/BasisParameters";
import MsApiExtendBtns from "../reference/ApiExtendBtns";
import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag";

View File

@ -29,68 +29,70 @@
</template>
<script>
import MsBasisApi from "./BasisApi";
import MsBasisParameters from "../request/dubbo/BasisParameters";
import MsBasisApi from "./BasisApi";
import MsBasisParameters from "../request/dubbo/BasisParameters";
export default {
name: "MsApiDubboRequestForm",
components: {
MsBasisApi, MsBasisParameters
},
props: {
request: {},
basisData: {},
moduleOptions: Array,
isReadOnly: {
type: Boolean,
default: false
}
},
data() {
return {validated: false}
},
methods: {
callback() {
this.validated = true;
export default {
name: "MsApiDubboRequestForm",
components: {
MsBasisApi, MsBasisParameters
},
validateApi() {
this.validated = false;
this.basisData.method = this.request.protocol;
this.$refs['basicForm'].validate();
props: {
request: {},
basisData: {},
moduleOptions: Array,
isReadOnly: {
type: Boolean,
default: false
}
},
saveApi() {
this.validateApi();
if (this.validated) {
this.basisData.request = this.request;
console.log(this.basisData)
if (this.basisData.tags instanceof Array) {
this.basisData.tags = JSON.stringify(this.basisData.tags);
data() {
return {validated: false}
},
methods: {
callback() {
this.validated = true;
},
validateApi() {
this.validated = false;
this.basisData.method = this.request.protocol;
this.$refs['basicForm'].validate();
},
saveApi() {
this.validateApi();
if (this.validated) {
this.basisData.request = this.request;
if (this.basisData.tags instanceof Array) {
this.basisData.tags = JSON.stringify(this.basisData.tags);
}
this.$emit('saveApi', this.basisData);
}
this.$emit('saveApi', this.basisData);
}
},
runTest() {
this.validateApi();
if (this.validated) {
this.basisData.request = this.request;
if (this.basisData.tags instanceof Array) {
this.basisData.tags = JSON.stringify(this.basisData.tags);
}
this.$emit('runTest', this.basisData);
}
},
createRootModelInTree() {
this.$emit("createRootModelInTree");
},
},
runTest() {
this.validateApi();
if (this.validated) {
this.basisData.request = this.request;
this.$emit('runTest', this.basisData);
}
},
createRootModelInTree() {
this.$emit("createRootModelInTree");
},
},
computed: {}
}
computed: {}
}
</script>
<style scoped>
.tip {
padding: 3px 5px;
font-size: 16px;
border-radius: 4px;
border-left: 4px solid #783887;
margin: 0px 20px 0px;
}
.tip {
padding: 3px 5px;
font-size: 16px;
border-radius: 4px;
border-left: 4px solid #783887;
margin: 0px 20px 0px;
}
</style>

View File

@ -71,6 +71,10 @@ export default {
this.validateApi();
if (this.validated) {
this.basisData.request = this.request;
this.basisData.method = this.basisData.protocol;
if (this.basisData.tags instanceof Array) {
this.basisData.tags = JSON.stringify(this.basisData.tags);
}
this.$emit('runTest', this.basisData);
}
},

View File

@ -30,7 +30,7 @@
<script>
import MsBasisApi from "./BasisApi";
import MsBasisParameters from "../request/tcp/BasisParameters";
import MsBasisParameters from "../request/tcp/TcpBasisParameters";
export default {
name: "MsAddCompleteTcpApi",
@ -72,6 +72,9 @@ export default {
this.validateApi();
if (this.validated) {
this.basisData.request = this.request;
if (this.basisData.tags instanceof Array) {
this.basisData.tags = JSON.stringify(this.basisData.tags);
}
this.$emit('runTest', this.basisData);
}
},

View File

@ -2,18 +2,28 @@
<div class="card-container" v-loading="loading">
<el-card class="card-content">
<el-dropdown split-button type="primary" class="ms-api-buttion" @click="handleCommand"
@command="handleCommand" size="small" style="float: right;margin-right: 20px">
{{$t('commons.test')}}
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="save_as">{{$t('api_test.definition.request.save_as')}}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-form :model="debugForm" :rules="rules" ref="debugForm" :inline="true" label-position="right">
<p class="tip">{{$t('test_track.plan_view.base_info')}} </p>
<el-form-item :label="$t('api_test.request.tcp.server')" prop="server">
<el-input v-model="request.server" maxlength="300" show-word-limit size="small"/>
</el-form-item>
<el-form-item :label="$t('api_test.request.tcp.port')" prop="port" label-width="60px">
<el-input-number v-model="request.port" controls-position="right" :min="0" :max="65535" size="small"/>
</el-form-item>
<el-form-item>
<el-dropdown split-button type="primary" class="ms-api-buttion" @click="handleCommand"
@command="handleCommand" size="small" style="float: right;margin-right: 20px">
{{$t('commons.test')}}
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="save_as">{{$t('api_test.definition.request.save_as')}}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-form-item>
</el-form>
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
<!-- TCP 请求参数 -->
<ms-basis-parameters :request="request" @callback="runDebug" ref="requestForm"/>
<tcp-basis-parameters :request="request" @callback="runDebug" ref="requestForm"/>
<!-- TCP 请求返回数据 -->
<p class="tip">{{$t('api_test.definition.request.res_param')}} </p>
@ -39,11 +49,13 @@
import {createComponent} from "../jmeter/components";
import {REQ_METHOD} from "../../model/JsonData";
import MsRequestResultTail from "../response/RequestResultTail";
import MsBasisParameters from "../request/tcp/BasisParameters";
import TcpBasisParameters from "../request/tcp/TcpBasisParameters";
export default {
name: "ApiConfig",
components: {MsRequestResultTail, MsResponseResult, MsApiRequestForm, MsRequestMetric, MsResponseText, MsRun, MsBasisParameters},
components: {
TcpBasisParameters,
MsRequestResultTail, MsResponseResult, MsApiRequestForm, MsRequestMetric, MsResponseText, MsRun},
props: {
currentProtocol: String,
scenario: Boolean,

View File

@ -0,0 +1,119 @@
<template>
<span>
<el-select v-model="currentData.environmentId" size="small" class="ms-htt-width"
:placeholder="$t('api_test.definition.request.run_env')"
@change="environmentChange" clearable>
<el-option v-for="(environment, index) in environments" :key="index"
:label="getLabel(environment)"
:value="environment.id"/>
<el-button class="environment-button" size="mini" type="primary" @click="openEnvironmentConfig">
{{ $t('api_test.environment.environment_config') }}
</el-button>
<template v-slot:empty>
<div class="empty-environment">
<el-button class="environment-button" size="mini" type="primary" @click="openEnvironmentConfig">
{{ $t('api_test.environment.environment_config') }}
</el-button>
</div>
</template>
</el-select>
<!-- 环境 -->
<api-environment-config ref="environmentConfig" @close="environmentConfigClose"/>
</span>
</template>
<script>
import {parseEnvironment} from "../../model/EnvironmentModel";
import ApiEnvironmentConfig from "../../../test/components/ApiEnvironmentConfig";
export default {
name: "EnvironmentSelect",
components: {ApiEnvironmentConfig},
data() {
return {
environments: []
}
},
props: {
projectId: String,
currentData: {},
type: String
},
created() {
this.getEnvironments();
},
methods: {
getEnvironments() {
if (this.projectId) {
this.$get('/api/environment/list/' + this.projectId, response => {
this.environments = response.data;
this.environments.forEach(environment => {
parseEnvironment(environment);
});
let hasEnvironment = false;
for (let i in this.environments) {
if (this.environments[i].id === this.currentData.environmentId) {
this.currentData.environmentId = this.environments[i].id;
hasEnvironment = true;
break;
}
}
if (!hasEnvironment) {
this.currentData.environmentId = '';
this.currentData.environment = undefined;
}
});
} else {
this.currentData.environmentId = '';
this.currentData.environment = undefined;
}
},
getLabel(environment) {
if (environment) {
if (this.type === 'TCP') {
if (environment.config.tcpConfig && environment.config.tcpConfig.server) {
return environment.name + ": " + environment.config.tcpConfig.server + ":" +
(environment.config.tcpConfig.port ? environment.config.tcpConfig.port : "");
} else {
return environment.name;
}
}
return environment.name + (environment.config.httpConfig.socket ?
(': ' + environment.config.httpConfig.protocol + '://' + environment.config.httpConfig.socket) : '');
}
return "";
},
environmentConfigClose() {
this.getEnvironments();
},
environmentChange(value) {
for (let i in this.environments) {
if (this.environments[i].id === value) {
this.currentData.environmentId = value;
if (this.currentData.request) {
this.currentData.request.useEnvironment = value;
}
break;
}
}
},
openEnvironmentConfig() {
if (!this.projectId) {
this.$error(this.$t('api_test.select_project'));
return;
}
this.$refs.environmentConfig.open(this.projectId);
},
}
}
</script>
<style scoped>
.environment-button {
margin-left: 20px;
padding: 7px;
}
</style>

View File

@ -31,6 +31,8 @@ export default class TCPSampler extends Sampler {
this.username = options.username;
this.password = options.password;
this.parameters = [];
this.hashTree = [];
}
}

View File

@ -3,90 +3,94 @@
<el-row>
<el-col :span="21" style="padding-bottom: 20px">
<div style="border:1px #DCDFE6 solid; height: 100%;border-radius: 4px ;width: 100% ;margin: 10px">
<el-form class="tcp" :model="request" :rules="rules" ref="request" label-width="auto" :disabled="isReadOnly" style="margin: 20px">
<el-row :gutter="10">
<el-col :span="9">
<el-form-item label="TCPClient" prop="classname">
<el-select v-model="request.classname" style="width: 100%" size="small">
<el-option v-for="c in classes" :key="c" :label="c" :value="c"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item :label="$t('api_test.request.tcp.server')" prop="server">
<el-input v-model="request.server" maxlength="300" show-word-limit size="small"/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item :label="$t('api_test.request.tcp.port')" prop="port" label-width="60px">
<el-input-number v-model="request.port" controls-position="right" :min="0" :max="65535" size="small"/>
</el-form-item>
</el-col>
</el-row>
<el-form class="tcp" :model="request" :rules="rules" ref="request" :disabled="isReadOnly" style="margin: 20px">
<el-row :gutter="10">
<el-col :span="9">
<el-form-item :label="$t('api_test.request.tcp.connect')" prop="ctimeout">
<el-input-number v-model="request.ctimeout" controls-position="right" :min="0" size="small"/>
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item :label="$t('api_test.request.tcp.response')" prop="timeout">
<el-input-number v-model="request.timeout" controls-position="right" :min="0" size="small"/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item :label="$t('api_test.request.tcp.so_linger')" prop="soLinger">
<el-input v-model="request.soLinger" size="small"/>
</el-form-item>
</el-col>
</el-row>
<el-tabs v-model="activeName" class="request-tabs">
<el-row :gutter="10">
<el-col :span="9">
<el-form-item :label="$t('api_test.request.tcp.username')" prop="username">
<el-input v-model="request.username" maxlength="100" show-word-limit size="small"/>
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item :label="$t('api_test.request.tcp.password')" prop="password">
<el-input v-model="request.password" maxlength="30" show-word-limit show-password
autocomplete="new-password" size="small"/>
</el-form-item>
</el-col>
<!--query 参数-->
<el-tab-pane name="parameters">
<template v-slot:label>
{{$t('api_test.definition.request.req_param')}}
<ms-instructions-icon :content="$t('api_test.definition.request.tcp_parameter_tip')"/>
</template>
<ms-api-variable :is-read-only="isReadOnly" :parameters="request.parameters"/>
</el-tab-pane>
<el-col :span="6">
<el-form-item :label="$t('api_test.request.tcp.eol_byte')" prop="eolByte">
<el-input v-model="request.eolByte" size="small"/>
</el-form-item>
</el-col>
<el-tab-pane :label="$t('api_test.definition.request.message_template')" name="request">
<div class="send-request">
<ms-code-edit mode="text" :read-only="isReadOnly" :data.sync="request.request"
:modes="['text', 'json', 'xml', 'html']" theme="eclipse"/>
</div>
</el-tab-pane>
</el-row>
<el-tab-pane :label="$t('api_test.definition.request.other_config')" name="other" class="other-config">
<el-row>
<el-col :span="8">
<el-form-item label="TCPClient" prop="classname">
<el-select v-model="request.classname" style="width: 100%" size="small">
<el-option v-for="c in classes" :key="c" :label="c" :value="c"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('api_test.request.tcp.connect')" prop="ctimeout">
<el-input-number v-model="request.ctimeout" controls-position="right" :min="0" size="small"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('api_test.request.tcp.response')" prop="timeout">
<el-input-number v-model="request.timeout" controls-position="right" :min="0" size="small"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="6">
<el-form-item :label="$t('api_test.request.tcp.so_linger')" prop="soLinger">
<el-input v-model="request.soLinger" size="small"/>
</el-form-item>
</el-col>
<el-row :gutter="10" style="margin-left: 30px">
<el-col :span="9">
<el-form-item :label="$t('api_test.request.tcp.re_use_connection')">
<el-checkbox v-model="request.reUseConnection"/>
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item :label="$t('api_test.request.tcp.close_connection')">
<el-checkbox v-model="request.closeConnection"/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item :label="$t('api_test.request.tcp.no_delay')">
<el-checkbox v-model="request.nodelay"/>
</el-form-item>
</el-col>
</el-row>
<el-col :span="6">
<el-form-item :label="$t('api_test.request.tcp.eol_byte')" prop="eolByte">
<el-input v-model="request.eolByte" size="small"/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item :label="$t('api_test.request.tcp.username')" prop="username">
<el-input v-model="request.username" maxlength="100" show-word-limit size="small"/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item :label="$t('api_test.request.tcp.password')" prop="password">
<el-input v-model="request.password" maxlength="30" show-word-limit show-password
autocomplete="new-password" size="small"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10" style="margin-left: 30px">
<el-col :span="9">
<el-form-item :label="$t('api_test.request.tcp.re_use_connection')">
<el-checkbox v-model="request.reUseConnection"/>
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item :label="$t('api_test.request.tcp.close_connection')">
<el-checkbox v-model="request.closeConnection"/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item :label="$t('api_test.request.tcp.no_delay')">
<el-checkbox v-model="request.nodelay"/>
</el-form-item>
</el-col>
</el-row>
</el-tab-pane>
</el-tabs>
<el-form-item :label="$t('api_test.request.tcp.request')" prop="request">
<div class="send-request">
<ms-code-edit mode="text" :read-only="isReadOnly" :data.sync="request.request"
:modes="['text', 'json', 'xml', 'html']" theme="eclipse"/>
</div>
</el-form-item>
</el-form>
</div>
@ -133,10 +137,15 @@
import {API_STATUS} from "../../../model/JsonData";
import TCPSampler from "../../jmeter/components/sampler/tcp-sampler";
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
import MsApiVariable from "../../ApiVariable";
import MsInstructionsIcon from "../../../../../common/components/MsInstructionsIcon";
export default {
name: "MsDatabaseConfig",
name: "TcpBasisParameters",
components: {
MsInstructionsIcon,
MsApiVariable,
MsApiScenarioVariables,
MsCodeEdit,
MsJsr233Processor, ApiRequestMethodSelect, MsApiExtract, MsApiAssertions, MsApiKeyValue, ApiEnvironmentConfig
@ -152,7 +161,7 @@
},
data() {
return {
activeName: "assertions",
activeName: "parameters",
classes: TCPSampler.CLASSES,
isReloadData: false,
options: API_STATUS,
@ -166,6 +175,10 @@
},
created() {
this.currentProjectId = getCurrentProjectID();
if (!this.request.parameters) {
this.$set(this.request, 'parameters', []);
this.request.parameters = [];
}
this.getEnvironments();
},
methods: {
@ -275,7 +288,7 @@
},
environmentConfigClose() {
this.getEnvironments();
},
}
}
}
@ -317,4 +330,18 @@
/deep/ .el-form-item {
margin-bottom: 15px;
}
/deep/ .instructions-icon {
font-size: 14px !important;
}
.request-tabs {
margin: 20px;
min-height: 200px;
}
.other-config {
padding: 15px;
}
</style>

View File

@ -15,23 +15,7 @@
<!-- 执行环境 -->
<el-form-item prop="environmentId">
<el-select v-model="api.environmentId" size="small" class="ms-htt-width"
:placeholder="$t('api_test.definition.request.run_env')"
@change="environmentChange" clearable>
<el-option v-for="(environment, index) in environments" :key="index"
:label="environment.name + (environment.config.httpConfig.socket ? (': ' + environment.config.httpConfig.protocol + '://' + environment.config.httpConfig.socket) : '')"
:value="environment.id"/>
<el-button class="environment-button" size="mini" type="primary" @click="openEnvironmentConfig">
{{ $t('api_test.environment.environment_config') }}
</el-button>
<template v-slot:empty>
<div class="empty-environment">
<el-button class="environment-button" size="mini" type="primary" @click="openEnvironmentConfig">
{{ $t('api_test.environment.environment_config') }}
</el-button>
</div>
</template>
</el-select>
<environment-select :current-data="api" :project-id="projectId"/>
</el-form-item>
<!-- 请求地址 -->
@ -77,8 +61,6 @@
:currentApi="api"
ref="caseList"/>
<!-- 环境 -->
<api-environment-config ref="environmentConfig" @close="environmentConfigClose"/>
<!-- 执行组件 -->
<ms-run :debug="false" :environment="api.environment" :reportId="reportId" :run-data="runData"
@runRefresh="runRefresh" ref="runTest"/>
@ -91,20 +73,19 @@
import {downloadFile, getUUID, getCurrentProjectID} from "@/common/js/utils";
import MsApiCaseList from "../case/ApiCaseList";
import MsContainer from "../../../../common/components/MsContainer";
import {parseEnvironment} from "../../model/EnvironmentModel";
import ApiEnvironmentConfig from "../environment/ApiEnvironmentConfig";
import MsRequestResultTail from "../response/RequestResultTail";
import MsRun from "../Run";
import {REQ_METHOD} from "../../model/JsonData";
import EnvironmentSelect from "../environment/EnvironmentSelect";
export default {
name: "RunTestHTTPPage",
components: {
EnvironmentSelect,
MsApiRequestForm,
MsApiCaseList,
MsContainer,
MsRequestResultTail,
ApiEnvironmentConfig,
MsRun
},
data() {
@ -118,7 +99,6 @@
refreshSign: "",
responseData: {type: 'HTTP', responseResult: {}, subRequestResults: []},
reqOptions: REQ_METHOD,
environments: [],
rules: {
method: [{required: true, message: this.$t('test_track.case.input_maintainer'), trigger: 'change'}],
path: [{required: true, message: this.$t('api_test.definition.request.path_info'), trigger: 'blur'}],
@ -230,50 +210,7 @@
this.api.request = this.currentRequest;
}
},
getEnvironments() {
if (this.projectId) {
this.$get('/api/environment/list/' + this.projectId, response => {
this.environments = response.data;
this.environments.forEach(environment => {
parseEnvironment(environment);
});
let hasEnvironment = false;
for (let i in this.environments) {
if (this.environments[i].id === this.api.environmentId) {
this.api.environmentId = this.environments[i].id;
hasEnvironment = true;
break;
}
}
if (!hasEnvironment) {
this.api.environmentId = '';
this.api.environment = undefined;
}
});
} else {
this.api.environmentId = '';
this.api.environment = undefined;
}
},
openEnvironmentConfig() {
if (!this.projectId) {
this.$error(this.$t('api_test.select_project'));
return;
}
this.$refs.environmentConfig.open(this.projectId);
},
environmentChange(value) {
for (let i in this.environments) {
if (this.environments[i].id === value) {
this.api.environmentId = value;
this.api.request.useEnvironment = value;
break;
}
}
},
environmentConfigClose() {
this.getEnvironments();
},
refresh() {
this.$emit('refresh');
},
@ -292,7 +229,6 @@
this.api = this.apiData;
this.api.protocol = this.currentProtocol;
this.currentRequest = this.api.request;
this.getEnvironments();
this.getResult();
}
}
@ -303,11 +239,6 @@
width: 350px;
}
.environment-button {
margin-left: 20px;
padding: 7px;
}
.tip {
padding: 3px 5px;
font-size: 16px;

View File

@ -16,6 +16,10 @@
</el-dropdown-menu>
</el-dropdown>
<p class="tip">{{$t('test_track.plan_view.base_info')}} </p>
<!-- 执行环境 -->
{{$t('api_test.definition.request.run_env')}}
<environment-select :type="'TCP'" :current-data="api" :project-id="projectId"/>
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
<!-- TCP 请求参数 -->
@ -32,8 +36,7 @@
<ms-api-case-list @apiCaseClose="apiCaseClose" @refresh="refresh" @selectTestCase="selectTestCase" :currentApi="api" :refreshSign="refreshSign"
:loaded="loaded" :createCase="createCase"
ref="caseList"/>
<!-- 环境 -->
<api-environment-config ref="environmentConfig" @close="environmentConfigClose"/>
<!-- 执行组件 -->
<ms-run :debug="false" :environment="api.environment" :reportId="reportId" :run-data="runData"
@runRefresh="runRefresh" ref="runTest"/>
@ -47,22 +50,21 @@
import MsApiCaseList from "../case/ApiCaseList";
import MsContainer from "../../../../common/components/MsContainer";
import MsBottomContainer from "../BottomContainer";
import {parseEnvironment} from "../../model/EnvironmentModel";
import ApiEnvironmentConfig from "../environment/ApiEnvironmentConfig";
import MsRequestResultTail from "../response/RequestResultTail";
import MsRun from "../Run";
import MsBasisParameters from "../request/tcp/BasisParameters";
import MsBasisParameters from "../request/tcp/TcpBasisParameters";
import {REQ_METHOD} from "../../model/JsonData";
import EnvironmentSelect from "../environment/EnvironmentSelect";
export default {
name: "RunTestTCPPage",
components: {
EnvironmentSelect,
MsApiRequestForm,
MsApiCaseList,
MsContainer,
MsBottomContainer,
MsRequestResultTail,
ApiEnvironmentConfig,
MsRun,
MsBasisParameters
},
@ -85,6 +87,7 @@
},
runData: [],
reportId: "",
projectId: ""
}
},
props: {apiData: {}, currentProtocol: String,},
@ -180,40 +183,6 @@
this.api.request = this.currentRequest;
}
},
getEnvironments() {
this.$get('/api/environment/list/' + getCurrentProjectID(), response => {
this.environments = response.data;
this.environments.forEach(environment => {
parseEnvironment(environment);
});
let hasEnvironment = false;
for (let i in this.environments) {
if (this.environments[i].id === this.api.environmentId) {
this.api.environment = this.environments[i];
hasEnvironment = true;
break;
}
}
if (!hasEnvironment) {
this.api.environmentId = '';
this.api.environment = undefined;
}
});
},
openEnvironmentConfig() {
this.$refs.environmentConfig.open(getCurrentProjectID());
},
environmentChange(value) {
for (let i in this.environments) {
if (this.environments[i].id === value) {
this.api.request.useEnvironment = this.environments[i].id;
break;
}
}
},
environmentConfigClose() {
this.getEnvironments();
},
getResult() {
let url = "/api/definition/report/getReport/" + this.api.id;
this.$get(url, response => {
@ -228,7 +197,7 @@
this.api = this.apiData;
this.api.protocol = this.currentProtocol;
this.currentRequest = this.api.request;
this.getEnvironments();
this.projectId = getCurrentProjectID();
this.getResult();
}
}

View File

@ -596,9 +596,11 @@ export class TCPRequest extends Request {
super(RequestFactory.TYPES.TCP, options);
this.useEnvironment = options.useEnvironment;
this.debugReport = undefined;
this.parameters = [];
//设置TCPConfig的属性
this.set(new TCPConfig(options));
this.sets({parameters: KeyValue}, options);
this.request = options.request;
}

View File

@ -3,12 +3,12 @@
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane :label="$t('organization.message.template')" name="apiTemplate">
<el-button type="primary" size="mini" style="margin-left: 10px" @click="openOneClickOperation">导入</el-button>
<div style="min-height: 400px">
<div style="min-height: 200px">
<json-schema-editor class="schema" :value="schema" lang="zh_CN" custom/>
</div>
</el-tab-pane>
<el-tab-pane :label="$t('schema.preview')" name="preview">
<div style="min-height: 400px">
<div style="min-height: 200px">
<pre>{{this.preview}}</pre>
</div>
</el-tab-pane>

View File

@ -570,6 +570,9 @@ export default {
update_info: 'Update',
batch_edit: "Batch edit",
path_valid_info: "The request path is invalid",
other_config: "Other Config",
message_template: "Message Template",
tcp_parameter_tip: "The request parameters can be referenced in the request template ${XXX}",
}
},
automation: {

View File

@ -569,6 +569,9 @@ export default {
update_info: '更新',
batch_edit: "批量编辑",
path_valid_info: "请求路径无效",
other_config: "其他设置",
message_template: "报文模版",
tcp_parameter_tip: "请求参数可以在请求模版通过${xxx}引用",
}
},
automation: {

View File

@ -569,6 +569,9 @@ export default {
update_info: '更新',
batch_edit: "批量編輯",
path_valid_info: "請求路徑無效",
other_config: "其他設置",
message_template: "報文模版",
tcp_parameter_tip: "請求參數可以在請求模版通過${xxx}引用",
}
},
automation: {
@ -1450,7 +1453,7 @@ export default {
},
variables: {
cvs_info: "只能上傳CSV文件",
end: "束",
end: "束",
start: "開始",
increment: "增量",
counter_info: "000產生至少3位數字。user_000輸出形式為user_nnn",