mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-11-29 18:48:13 +08:00
refactor(接口测试): 更正拼写错误单词
This commit is contained in:
parent
f4217f60a4
commit
edcdcf9966
@ -38,7 +38,7 @@ public class GenScenarioRequest extends ApiScenarioWithBLOBs {
|
||||
private RunModeConfigDTO config;
|
||||
|
||||
private boolean isTestPlanScheduleJob = false;
|
||||
//生成测试报告:当isTestPlanScheduleJob为ture时使用
|
||||
//生成测试报告:当isTestPlanScheduleJob为true时使用
|
||||
private String testPlanReportId;
|
||||
|
||||
private String requestOriginator;
|
||||
|
@ -43,7 +43,7 @@ public class RunScenarioRequest {
|
||||
|
||||
private boolean isTestPlanScheduleJob = false;
|
||||
|
||||
//生成测试报告:当isTestPlanScheduleJob为ture时使用
|
||||
//生成测试报告:当isTestPlanScheduleJob为true时使用
|
||||
private String testPlanReportId;
|
||||
|
||||
private String requestOriginator;
|
||||
|
@ -124,11 +124,11 @@ public class ApiDataCountDTO {
|
||||
private String interfaceCoverage = " 0%";
|
||||
|
||||
/**
|
||||
* 对Protocal视角对查询结果进行统计
|
||||
* 对Protocol视角对查询结果进行统计
|
||||
*
|
||||
* @param countResultList 查询参数
|
||||
*/
|
||||
public void countProtocal(List<ApiDataCountResult> countResultList) {
|
||||
public void countProtocol(List<ApiDataCountResult> countResultList) {
|
||||
for (ApiDataCountResult countResult :
|
||||
countResultList) {
|
||||
switch (countResult.getGroupField().toUpperCase()) {
|
||||
|
@ -7,6 +7,6 @@ import lombok.Setter;
|
||||
@Setter
|
||||
public class CoverageDTO {
|
||||
public String rateOfCoverage = "0%";
|
||||
public long coverate = 0;
|
||||
public long notCoverate = 0;
|
||||
public long coverage = 0;
|
||||
public long notCoverage = 0;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class ApiDocumentInfoDTO {
|
||||
private String restParams;
|
||||
private String requestBodyParamType;
|
||||
private String requestBodyFormData;
|
||||
private String requestBodyStrutureData;
|
||||
private String requestBodyStructureData;
|
||||
private Object requestPreviewData;
|
||||
private JSONSchemaBodyDTO jsonSchemaBody;
|
||||
|
||||
@ -38,7 +38,7 @@ public class ApiDocumentInfoDTO {
|
||||
private Object jsonSchemaResponseBody;
|
||||
private String responseBodyParamType;
|
||||
private String responseBodyFormData;
|
||||
private String responseBodyStrutureData;
|
||||
private String responseBodyStructureData;
|
||||
|
||||
private String responseCode;
|
||||
private boolean sharePopoverVisible = false;
|
||||
|
@ -105,13 +105,13 @@ public class TestResult {
|
||||
|
||||
//如果有全局前后置脚本,会出现前后置的测试步骤,影响统计。此处略过不处理。
|
||||
// 同时,jmeter会将前后置脚本步骤作为一个请求来计算。当检测到有前后置脚本步骤执行时,请求数也要做处理
|
||||
List<RequestResult> formatedResult = new ArrayList<>();
|
||||
List<RequestResult> formattedResult = new ArrayList<>();
|
||||
|
||||
int successStep = 0;
|
||||
int errorStep = 0;
|
||||
for (RequestResult item :result.getRequestResults()) {
|
||||
if(!StringUtils.startsWithAny(item.getName(),"PRE_PROCESSOR_ENV_","POST_PROCESSOR_ENV_")){
|
||||
formatedResult.add(item);
|
||||
formattedResult.add(item);
|
||||
}else {
|
||||
if(StringUtils.equalsAnyIgnoreCase(item.getName(),"PRE_PROCESSOR_ENV_false","POST_PROCESSOR_ENV_false")){
|
||||
if(item.isSuccess()){
|
||||
@ -128,7 +128,7 @@ public class TestResult {
|
||||
this.error = this.error-errorStep;
|
||||
this.total = this.total - successStep - errorStep;
|
||||
|
||||
result.setRequestResults(formatedResult);
|
||||
result.setRequestResults(formattedResult);
|
||||
|
||||
result.getRequestResults().forEach(item -> {
|
||||
String itemAndScenarioName = StringUtils.EMPTY;
|
||||
|
@ -1,31 +1,20 @@
|
||||
package io.metersphere.api.parse;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import io.metersphere.api.dto.definition.request.processors.pre.MsJSR223PreProcessor;
|
||||
import io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy;
|
||||
import io.metersphere.api.dto.scenario.Body;
|
||||
import io.metersphere.api.dto.scenario.KeyValue;
|
||||
import io.metersphere.api.parse.api.har.model.*;
|
||||
import io.metersphere.api.parse.postman.PostmanEvent;
|
||||
import io.metersphere.api.parse.postman.PostmanKeyValue;
|
||||
import io.metersphere.api.parse.postman.PostmanRequest;
|
||||
import io.metersphere.api.parse.postman.PostmanScript;
|
||||
import io.metersphere.commons.constants.ElementConstants;
|
||||
import io.metersphere.commons.constants.MsRequestBodyType;
|
||||
import io.metersphere.commons.constants.PostmanRequestBodyMode;
|
||||
import io.metersphere.commons.utils.JSON;
|
||||
import io.metersphere.commons.utils.JSONUtil;
|
||||
import io.metersphere.commons.utils.XMLUtil;
|
||||
import io.metersphere.plugin.core.MsTestElement;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class HarScenarioAbstractParser<T> extends ApiImportAbstractParser<T> {
|
||||
|
||||
@ -50,9 +39,9 @@ public abstract class HarScenarioAbstractParser<T> extends ApiImportAbstractPars
|
||||
}
|
||||
|
||||
private void parseParameters(HarRequest harRequest, MsHTTPSamplerProxy request) {
|
||||
List<HarQueryParm> queryStringList = harRequest.queryString;
|
||||
queryStringList.forEach(harQueryParm -> {
|
||||
parseQueryParameters(harQueryParm, request.getArguments());
|
||||
List<HarQueryParam> queryStringList = harRequest.queryString;
|
||||
queryStringList.forEach(harQueryParam -> {
|
||||
parseQueryParameters(harQueryParam, request.getArguments());
|
||||
});
|
||||
List<HarHeader> harHeaderList = harRequest.headers;
|
||||
harHeaderList.forEach(harHeader -> {
|
||||
@ -138,8 +127,8 @@ public abstract class HarScenarioAbstractParser<T> extends ApiImportAbstractPars
|
||||
}
|
||||
|
||||
|
||||
private void parseQueryParameters(HarQueryParm harQueryParm, List<KeyValue> arguments) {
|
||||
arguments.add(new KeyValue(harQueryParm.name, harQueryParm.value, harQueryParm.comment, false));
|
||||
private void parseQueryParameters(HarQueryParam harQueryParam, List<KeyValue> arguments) {
|
||||
arguments.add(new KeyValue(harQueryParam.name, harQueryParam.value, harQueryParam.comment, false));
|
||||
}
|
||||
|
||||
private void parseCookieParameters(HarCookie harCookie, List<KeyValue> headers) {
|
||||
@ -150,99 +139,11 @@ public abstract class HarScenarioAbstractParser<T> extends ApiImportAbstractPars
|
||||
addHeader(headers, harHeader.name, harHeader.value, harHeader.comment, StringUtils.EMPTY, false);
|
||||
}
|
||||
|
||||
private void addPreScript(MsHTTPSamplerProxy request, List<PostmanEvent> event) {
|
||||
if (request != null && CollectionUtils.isNotEmpty(event)) {
|
||||
StringBuilder scriptStr = new StringBuilder();
|
||||
event = event.stream()
|
||||
.filter(item -> item.getScript() != null)
|
||||
.collect(Collectors.toList());
|
||||
event.forEach(item -> {
|
||||
PostmanScript script = item.getScript();
|
||||
if (script != null && item.getListen().contains("prerequest")) {
|
||||
List<String> exec = script.getExec();
|
||||
if (CollectionUtils.isNotEmpty(exec)) {
|
||||
exec.forEach(col -> {
|
||||
if (StringUtils.isNotEmpty(col)) {
|
||||
scriptStr.append(col + StringUtils.LF);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
if (StringUtils.isNotBlank(scriptStr)) {
|
||||
MsJSR223PreProcessor jsr223PreProcessor = new MsJSR223PreProcessor();
|
||||
jsr223PreProcessor.setName(ElementConstants.JSR223_PRE);
|
||||
jsr223PreProcessor.setScriptLanguage("javascript");
|
||||
jsr223PreProcessor.setScript(scriptStr.toString());
|
||||
LinkedList<MsTestElement> hashTree = new LinkedList<>();
|
||||
hashTree.add(jsr223PreProcessor);
|
||||
request.setHashTree(hashTree);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<KeyValue> parseKeyValue(List<PostmanKeyValue> postmanKeyValues) {
|
||||
if (postmanKeyValues == null) {
|
||||
return null;
|
||||
}
|
||||
List<KeyValue> keyValues = new ArrayList<>();
|
||||
postmanKeyValues.forEach(item -> keyValues.add(new KeyValue(item.getKey(), item.getValue(), item.getDescription(), item.getContentType())));
|
||||
return keyValues;
|
||||
}
|
||||
|
||||
private void parseBody(Body body, PostmanRequest requestDesc) {
|
||||
ObjectNode postmanBody = requestDesc.getBody();
|
||||
if (postmanBody == null) {
|
||||
return;
|
||||
}
|
||||
String bodyMode = postmanBody.get("mode").textValue();
|
||||
if (StringUtils.isBlank(bodyMode)) {
|
||||
return;
|
||||
}
|
||||
if (StringUtils.equals(bodyMode, PostmanRequestBodyMode.RAW.value())) {
|
||||
parseRawBody(body, postmanBody, bodyMode);
|
||||
} else if (StringUtils.equalsAny(bodyMode, PostmanRequestBodyMode.FORM_DATA.value(), PostmanRequestBodyMode.URLENCODED.value())) {
|
||||
List<PostmanKeyValue> postmanKeyValues = JSON.parseArray(postmanBody.get(bodyMode).textValue(), PostmanKeyValue.class);
|
||||
body.setKvs(parseKeyValue(postmanKeyValues));
|
||||
if (StringUtils.equals(bodyMode, PostmanRequestBodyMode.FORM_DATA.value())) {
|
||||
body.setType(Body.FORM_DATA);
|
||||
} else if (StringUtils.equals(bodyMode, PostmanRequestBodyMode.URLENCODED.value())) {
|
||||
body.setType(Body.WWW_FROM);
|
||||
}
|
||||
} else if (StringUtils.equals(bodyMode, PostmanRequestBodyMode.FILE.value())) {
|
||||
body.setType(Body.BINARY);
|
||||
body.setKvs(new ArrayList<>());
|
||||
}
|
||||
}
|
||||
|
||||
private String parseXmlBody(String xmlString) {
|
||||
JSONObject object = JSONUtil.parseObject(getDefaultStringValue(xmlString));
|
||||
return XMLUtil.jsonToXmlStr(object);
|
||||
}
|
||||
|
||||
private void parseRawBody(Body body, ObjectNode postmanBody, String bodyMode) {
|
||||
body.setRaw(postmanBody.get(bodyMode).textValue());
|
||||
body.setType(MsRequestBodyType.RAW.value());
|
||||
JsonNode options = postmanBody.get("options");
|
||||
if (options != null) {
|
||||
JsonNode raw = options.get(PostmanRequestBodyMode.RAW.value());
|
||||
if (raw != null) {
|
||||
String bodyType = StringUtils.EMPTY;
|
||||
switch (raw.get("language").textValue()) {
|
||||
case "json":
|
||||
bodyType = Body.JSON_STR;
|
||||
break;
|
||||
case "xml":
|
||||
bodyType = Body.XML;
|
||||
break;
|
||||
default:
|
||||
bodyType = Body.RAW;
|
||||
}
|
||||
body.setType(bodyType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getDefaultStringValue(String val) {
|
||||
return StringUtils.isBlank(val) ? StringUtils.EMPTY : val;
|
||||
}
|
||||
|
@ -190,9 +190,9 @@ public class JmeterDocumentParser {
|
||||
|
||||
// 解析访问地址
|
||||
if (url.contains("?")) {
|
||||
String[] strUrlPatten = url.split("\\?");
|
||||
strUrl = strUrlPatten[0];
|
||||
strUrlParams = strUrlPatten[1];
|
||||
String[] strUrlPattern = url.split("\\?");
|
||||
strUrl = strUrlPattern[0];
|
||||
strUrlParams = strUrlPattern[1];
|
||||
|
||||
} else {
|
||||
strUrl = url;
|
||||
|
@ -87,7 +87,7 @@ public class ESBParser extends EsbAbstractParser {
|
||||
XSSFWorkbook workbook = new XSSFWorkbook();
|
||||
XSSFFont font = workbook.createFont();
|
||||
font.setFontHeightInPoints((short) 9);
|
||||
Map<String, XSSFCellStyle> cellStyleMap = createCellStle(workbook);
|
||||
Map<String, XSSFCellStyle> cellStyleMap = createCellStyle(workbook);
|
||||
XSSFSheet headSheet = workbook.createSheet("公共报文头");
|
||||
generateSheet(headSheet, font, cellStyleMap);
|
||||
XSSFSheet bodySheet = workbook.createSheet("接口报文信息");
|
||||
@ -95,7 +95,7 @@ public class ESBParser extends EsbAbstractParser {
|
||||
return workbook;
|
||||
}
|
||||
|
||||
private static Map<String, XSSFCellStyle> createCellStle(XSSFWorkbook workbook) {
|
||||
private static Map<String, XSSFCellStyle> createCellStyle(XSSFWorkbook workbook) {
|
||||
Map<String, XSSFCellStyle> cellStype = new HashMap<>();
|
||||
short[] colorIndexArr = {IndexedColors.LIGHT_GREEN.getIndex(), IndexedColors.ORCHID.getIndex(), IndexedColors.YELLOW.getIndex()};
|
||||
for (short colorIndex : colorIndexArr) {
|
||||
|
@ -118,9 +118,9 @@ public class HarParser extends HarAbstractParser {
|
||||
}
|
||||
|
||||
private void parseParameters(HarRequest harRequest, MsHTTPSamplerProxy request) {
|
||||
List<HarQueryParm> queryStringList = harRequest.queryString;
|
||||
queryStringList.forEach(harQueryParm -> {
|
||||
parseQueryParameters(harQueryParm, request.getArguments());
|
||||
List<HarQueryParam> queryStringList = harRequest.queryString;
|
||||
queryStringList.forEach(harQueryParam -> {
|
||||
parseQueryParameters(harQueryParam, request.getArguments());
|
||||
});
|
||||
List<HarHeader> harHeaderList = harRequest.headers;
|
||||
harHeaderList.forEach(harHeader -> {
|
||||
@ -278,7 +278,7 @@ public class HarParser extends HarAbstractParser {
|
||||
return XMLUtil.jsonToXmlStr(object);
|
||||
}
|
||||
|
||||
private void parseQueryParameters(HarQueryParm harQueryParm, List<KeyValue> arguments) {
|
||||
arguments.add(new KeyValue(harQueryParm.name, harQueryParm.value, harQueryParm.comment, false));
|
||||
private void parseQueryParameters(HarQueryParam harQueryParam, List<KeyValue> arguments) {
|
||||
arguments.add(new KeyValue(harQueryParam.name, harQueryParam.value, harQueryParam.comment, false));
|
||||
}
|
||||
}
|
||||
|
@ -20,13 +20,13 @@ public class JMeterScriptUtil {
|
||||
/**
|
||||
* 判断脚本是否被过滤
|
||||
*
|
||||
* @param filterProtocals 要过滤掉的请求类型
|
||||
* @param protocal 当前请求类型
|
||||
* @param filterProtocols 要过滤掉的请求类型
|
||||
* @param protocol 当前请求类型
|
||||
* @return
|
||||
*/
|
||||
public static boolean isScriptFilter(List<String> filterProtocals, String protocal) {
|
||||
if (!CollectionUtils.isEmpty(filterProtocals)) {
|
||||
return filterProtocals.contains(protocal);
|
||||
public static boolean isScriptFilter(List<String> filterProtocols, String protocol) {
|
||||
if (!CollectionUtils.isEmpty(filterProtocols)) {
|
||||
return filterProtocols.contains(protocol);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@ -62,26 +62,26 @@ public class JMeterScriptUtil {
|
||||
* @param envConfig 环境配置信息
|
||||
* @param samplerHashTree sampler的hashtree
|
||||
* @param isAfterPrivateScript 是否将脚本放置在sampler的私有脚本之后
|
||||
* @param protocal 请求类型
|
||||
* @param protocol 请求类型
|
||||
* @param environmentId 环境ID
|
||||
* @param config 参数配置
|
||||
*/
|
||||
public static void setScriptByEnvironmentConfig(EnvironmentConfig envConfig, HashTree samplerHashTree, String protocal, String environmentId, ParameterConfig config, boolean isAfterPrivateScript) {
|
||||
public static void setScriptByEnvironmentConfig(EnvironmentConfig envConfig, HashTree samplerHashTree, String protocol, String environmentId, ParameterConfig config, boolean isAfterPrivateScript) {
|
||||
GlobalScriptConfig globalScriptConfig = envConfig != null ? envConfig.getGlobalScriptConfig() : null;
|
||||
MsJSR223PreProcessor preProcessor = JMeterScriptUtil.getPreScript(envConfig);
|
||||
MsJSR223PostProcessor postProcessor = JMeterScriptUtil.getPostScript(envConfig);
|
||||
setScript(globalScriptConfig, protocal, isAfterPrivateScript, environmentId, config, samplerHashTree, preProcessor, postProcessor);
|
||||
setScript(globalScriptConfig, protocol, isAfterPrivateScript, environmentId, config, samplerHashTree, preProcessor, postProcessor);
|
||||
|
||||
}
|
||||
|
||||
public static void setScript(GlobalScriptConfig globalScriptConfig, String protocal, boolean isAfterPrivateScript, String environmentId, ParameterConfig config,
|
||||
public static void setScript(GlobalScriptConfig globalScriptConfig, String protocol, boolean isAfterPrivateScript, String environmentId, ParameterConfig config,
|
||||
HashTree samplerHashTree, MsJSR223PreProcessor preProcessor, MsJSR223PostProcessor postProcessor) {
|
||||
boolean isPreScriptExecAfterPrivateScript = globalScriptConfig == null ? false : globalScriptConfig.isPreScriptExecAfterPrivateScript();
|
||||
boolean isPostScriptExecAfterPrivateScript = globalScriptConfig == null ? false : globalScriptConfig.isPostScriptExecAfterPrivateScript();
|
||||
List<String> preFilterProtocal = globalScriptConfig == null ? null : globalScriptConfig.getFilterRequestPreScript();
|
||||
List<String> postFilterProtocal = globalScriptConfig == null ? null : globalScriptConfig.getFilterRequestPostScript();
|
||||
boolean globalPreScriptIsFilter = JMeterScriptUtil.isScriptFilter(preFilterProtocal, protocal);
|
||||
boolean globalPostScriptIsFilter = JMeterScriptUtil.isScriptFilter(postFilterProtocal, protocal);
|
||||
List<String> preFilterProtocol = globalScriptConfig == null ? null : globalScriptConfig.getFilterRequestPreScript();
|
||||
List<String> postFilterProtocol = globalScriptConfig == null ? null : globalScriptConfig.getFilterRequestPostScript();
|
||||
boolean globalPreScriptIsFilter = JMeterScriptUtil.isScriptFilter(preFilterProtocol, protocol);
|
||||
boolean globalPostScriptIsFilter = JMeterScriptUtil.isScriptFilter(postFilterProtocol, protocol);
|
||||
if (isAfterPrivateScript) {
|
||||
if (isPreScriptExecAfterPrivateScript && !globalPreScriptIsFilter && preProcessor != null && StringUtils.isNotEmpty(preProcessor.getScript())) {
|
||||
addItemHashTree(preProcessor, samplerHashTree, config, environmentId);
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package io.metersphere.api.parse.api.har.model;
|
||||
|
||||
public class HarQueryParm {
|
||||
public class HarQueryParam {
|
||||
|
||||
public String name;
|
||||
|
||||
@ -45,7 +45,7 @@ public class HarQueryParm {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(!(obj instanceof HarQueryParm)) {
|
||||
if(!(obj instanceof HarQueryParam)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -53,8 +53,8 @@ public class HarQueryParm {
|
||||
return false;
|
||||
}
|
||||
|
||||
HarQueryParm harQueryParm = (HarQueryParm) obj;
|
||||
return this.name.equals(harQueryParm.name);
|
||||
HarQueryParam harQueryParam = (HarQueryParam) obj;
|
||||
return this.name.equals(harQueryParam.name);
|
||||
}
|
||||
|
||||
}
|
@ -37,7 +37,7 @@ public class HarRequest {
|
||||
|
||||
public List<HarHeader> headers;
|
||||
|
||||
public List<HarQueryParm> queryString;
|
||||
public List<HarQueryParam> queryString;
|
||||
|
||||
public HarPostData postData;
|
||||
|
||||
|
@ -198,8 +198,8 @@ public class ApiScenarioImportUtil {
|
||||
public static ApiDefinitionResult structureApiDefinitionByJson(ApiDefinitionService apiDefinitionService, JSONObject object, String versionId, String projectId, ApiDefinitionMapper apiDefinitionMapper, Map<String, ApiDefinition> definitionMap) {
|
||||
ApiDefinitionResult test = new ApiDefinitionResult();
|
||||
apiDefinitionService.checkQuota(projectId);
|
||||
String protocal = object.optString("protocal");
|
||||
if (StringUtils.equals(protocal, "DUBBO")) {
|
||||
String protocol = object.optString("protocol");
|
||||
if (StringUtils.equals(protocol, "DUBBO")) {
|
||||
test.setMethod("dubbo://");
|
||||
} else {
|
||||
test.setMethod(object.optString("method"));
|
||||
|
@ -70,22 +70,22 @@ public class EsbDataParser {
|
||||
EsbDataStruct returnData = null;
|
||||
if (paramArr.length > index) {
|
||||
String param = paramArr[index];
|
||||
for (EsbDataStruct dataStuct : esbDataList) {
|
||||
if (StringUtils.equals(dataStuct.getName(), param)) {
|
||||
for (EsbDataStruct dataStruct : esbDataList) {
|
||||
if (StringUtils.equals(dataStruct.getName(), param)) {
|
||||
int newIndex = index + 1;
|
||||
if (paramArr.length > newIndex && dataStuct.getChildren() != null) {
|
||||
EsbDataStruct childElement = selectEsbDataStructByNameStruct(dataStuct.getChildren(), paramArr, newIndex);
|
||||
if (paramArr.length > newIndex && dataStruct.getChildren() != null) {
|
||||
EsbDataStruct childElement = selectEsbDataStructByNameStruct(dataStruct.getChildren(), paramArr, newIndex);
|
||||
if (childElement != null) {
|
||||
returnData = dataStuct.copy(false);
|
||||
returnData = dataStruct.copy(false);
|
||||
returnData.getChildren().add(childElement);
|
||||
}
|
||||
} else {
|
||||
returnData = dataStuct.copy(true);
|
||||
returnData = dataStruct.copy(true);
|
||||
}
|
||||
} else if (index == 0) {
|
||||
//如果是第一个节点不符合,则遍历子节点是否有符合的。
|
||||
int newIndex = index;
|
||||
EsbDataStruct itemData = selectEsbDataStructByNameStruct(dataStuct.getChildren(), paramArr, newIndex);
|
||||
EsbDataStruct itemData = selectEsbDataStructByNameStruct(dataStruct.getChildren(), paramArr, newIndex);
|
||||
if (itemData != null) {
|
||||
returnData = itemData;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ public class HarScenarioParser extends HarScenarioAbstractParser<ScenarioImport>
|
||||
if (samplerProxy.getBody() != null) {
|
||||
List<KeyValue> keyValueList = new ArrayList<>();
|
||||
if (!ObjectUtils.isEmpty(request.queryString)) {
|
||||
for (HarQueryParm model : request.queryString) {
|
||||
for (HarQueryParam model : request.queryString) {
|
||||
KeyValue keyValue = new KeyValue(model.name, model.value);
|
||||
keyValueList.add(keyValue);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public interface ExtApiDefinitionExecResultMapper {
|
||||
|
||||
long countByTestCaseIDInProject(String projectId);
|
||||
|
||||
List<ExecutedCaseInfoResult> findFaliureCaseInTestPlanByProjectIDAndExecuteTimeAndLimitNumber(@Param("projectId") String projectId, @Param("selectFunctionCase") boolean selectFunctionCase, @Param("startTimestamp") long startTimestamp);
|
||||
List<ExecutedCaseInfoResult> findFailureCaseInTestPlanByProjectIDAndExecuteTimeAndLimitNumber(@Param("projectId") String projectId, @Param("selectFunctionCase") boolean selectFunctionCase, @Param("startTimestamp") long startTimestamp);
|
||||
|
||||
String selectExecResult(String resourceId);
|
||||
|
||||
|
@ -65,7 +65,7 @@
|
||||
WHERE integrated_report_id = #{0}
|
||||
</select>
|
||||
|
||||
<select id="findFaliureCaseInTestPlanByProjectIDAndExecuteTimeAndLimitNumber"
|
||||
<select id="findFailureCaseInTestPlanByProjectIDAndExecuteTimeAndLimitNumber"
|
||||
resultType="io.metersphere.api.dto.datacount.ExecutedCaseInfoResult">
|
||||
SELECT *
|
||||
FROM (
|
||||
|
@ -75,8 +75,8 @@ public class MockApiUtils {
|
||||
//判断是否是JsonSchema
|
||||
boolean isJsonSchema = false;
|
||||
if (bodyObj.has("format")) {
|
||||
String foramtValue = String.valueOf(bodyObj.get("format"));
|
||||
if (StringUtils.equals("JSON-SCHEMA", foramtValue)) {
|
||||
String formatValue = String.valueOf(bodyObj.get("format"));
|
||||
if (StringUtils.equals("JSON-SCHEMA", formatValue)) {
|
||||
isJsonSchema = true;
|
||||
}
|
||||
}
|
||||
@ -84,8 +84,8 @@ public class MockApiUtils {
|
||||
String jsonString = StringUtils.EMPTY;
|
||||
if (isJsonSchema) {
|
||||
if (bodyObj.has("jsonSchema")) {
|
||||
String bodyRetunStr = bodyObj.optJSONObject("jsonSchema").toString();
|
||||
jsonString = JSONSchemaGenerator.getJson(bodyRetunStr);
|
||||
String bodyReturnStr = bodyObj.optJSONObject("jsonSchema").toString();
|
||||
jsonString = JSONSchemaGenerator.getJson(bodyReturnStr);
|
||||
}
|
||||
} else {
|
||||
if (bodyObj.has("raw")) {
|
||||
@ -178,8 +178,8 @@ public class MockApiUtils {
|
||||
//判断是否是JsonSchema
|
||||
boolean isJsonSchema = false;
|
||||
if (bodyObj.has("format")) {
|
||||
String foramtValue = String.valueOf(bodyObj.get("format"));
|
||||
if (StringUtils.equals("JSON-SCHEMA", foramtValue)) {
|
||||
String formatValue = String.valueOf(bodyObj.get("format"));
|
||||
if (StringUtils.equals("JSON-SCHEMA", formatValue)) {
|
||||
isJsonSchema = true;
|
||||
}
|
||||
}
|
||||
@ -301,8 +301,8 @@ public class MockApiUtils {
|
||||
//判断是否是JsonSchema
|
||||
boolean isJsonSchema = false;
|
||||
if (bodyObj.has("format")) {
|
||||
String foramtValue = String.valueOf(bodyObj.get("format"));
|
||||
if (StringUtils.equals("JSON-SCHEMA", foramtValue)) {
|
||||
String formatValue = String.valueOf(bodyObj.get("format"));
|
||||
if (StringUtils.equals("JSON-SCHEMA", formatValue)) {
|
||||
isJsonSchema = true;
|
||||
}
|
||||
}
|
||||
@ -518,13 +518,13 @@ public class MockApiUtils {
|
||||
private static String readXml(HttpServletRequest request) {
|
||||
String inputLine = null;
|
||||
// 接收到的数据
|
||||
StringBuffer recieveData = new StringBuffer();
|
||||
StringBuffer receiveData = new StringBuffer();
|
||||
BufferedReader in = null;
|
||||
try {
|
||||
in = new BufferedReader(new InputStreamReader(
|
||||
request.getInputStream(), StandardCharsets.UTF_8.name()));
|
||||
while ((inputLine = in.readLine()) != null) {
|
||||
recieveData.append(inputLine);
|
||||
receiveData.append(inputLine);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
} finally {
|
||||
@ -536,7 +536,7 @@ public class MockApiUtils {
|
||||
}
|
||||
}
|
||||
|
||||
return recieveData.toString();
|
||||
return receiveData.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -181,8 +181,8 @@ public class ApiTestCaseController {
|
||||
}
|
||||
|
||||
@PostMapping("/get-del-reference")
|
||||
public DeleteCheckResult checkDeleteDatas(@RequestBody ApiTestBatchRequest request) {
|
||||
return apiTestCaseService.checkDeleteDatas(request);
|
||||
public DeleteCheckResult checkDeleteData(@RequestBody ApiTestBatchRequest request) {
|
||||
return apiTestCaseService.checkDeleteData(request);
|
||||
}
|
||||
|
||||
@PostMapping("/relevance")
|
||||
|
@ -68,7 +68,7 @@ public class ApiHomeController {
|
||||
ApiDataCountDTO apiCountResult = new ApiDataCountDTO();
|
||||
|
||||
List<ApiDataCountResult> countResultByProtocolList = apiDefinitionService.countProtocolByProjectID(projectId);
|
||||
apiCountResult.countProtocal(countResultByProtocolList);
|
||||
apiCountResult.countProtocol(countResultByProtocolList);
|
||||
|
||||
long dateCountByCreateInThisWeek = apiDefinitionService.countByProjectIDAndCreateInThisWeek(projectId);
|
||||
apiCountResult.setThisWeekAddedCount(dateCountByCreateInThisWeek);
|
||||
@ -79,9 +79,9 @@ public class ApiHomeController {
|
||||
long allCount = apiCountResult.getFinishedCount() + apiCountResult.getRunningCount() + apiCountResult.getNotStartedCount();
|
||||
|
||||
if (allCount != 0) {
|
||||
float complateRageNumber = (float) apiCountResult.getFinishedCount() * 100 / allCount;
|
||||
float completeRageNumber = (float) apiCountResult.getFinishedCount() * 100 / allCount;
|
||||
DecimalFormat df = new DecimalFormat("0.0");
|
||||
apiCountResult.setCompletionRage(df.format(complateRageNumber) + "%");
|
||||
apiCountResult.setCompletionRage(df.format(completeRageNumber) + "%");
|
||||
}
|
||||
|
||||
apiCountResult.setHttpCountStr("HTTP <br/><br/>" + apiCountResult.getHttpApiDataCountNumber());
|
||||
@ -117,12 +117,12 @@ public class ApiHomeController {
|
||||
|
||||
try {
|
||||
if (effectiveApiCount == 0) {
|
||||
coverage.setCoverate(0);
|
||||
coverage.setNotCoverate(0);
|
||||
coverage.setCoverage(0);
|
||||
coverage.setNotCoverage(0);
|
||||
} else {
|
||||
long quotedApiCount = apiHasCase + apiInScenario;
|
||||
coverage.setCoverate(quotedApiCount);
|
||||
coverage.setNotCoverate(effectiveApiCount - quotedApiCount);
|
||||
coverage.setCoverage(quotedApiCount);
|
||||
coverage.setNotCoverage(effectiveApiCount - quotedApiCount);
|
||||
float coverageRageNumber = (float) quotedApiCount * 100 / effectiveApiCount;
|
||||
DecimalFormat df = new DecimalFormat("0.0");
|
||||
coverage.setRateOfCoverage(df.format(coverageRageNumber) + "%");
|
||||
@ -160,7 +160,7 @@ public class ApiHomeController {
|
||||
public ApiDataCountDTO testCaseInfoCount(@PathVariable String projectId) {
|
||||
ApiDataCountDTO apiCountResult = new ApiDataCountDTO();
|
||||
List<ApiDataCountResult> countResultList = apiTestCaseService.countProtocolByProjectID(projectId);
|
||||
apiCountResult.countProtocal(countResultList);
|
||||
apiCountResult.countProtocol(countResultList);
|
||||
long dateCountByCreateInThisWeek = apiTestCaseService.countByProjectIDAndCreateInThisWeek(projectId);
|
||||
apiCountResult.setThisWeekAddedCount(dateCountByCreateInThisWeek);
|
||||
long executedInThisWeekCountNumber = apiDefinitionExecResultService.countByTestCaseIDInProjectAndExecutedInThisWeek(projectId);
|
||||
|
@ -255,8 +255,8 @@ public class ShareInfoService extends BaseShareInfoService {
|
||||
//判断是否是JsonSchema
|
||||
boolean isJsonSchema = false;
|
||||
if (bodyObj.has("format")) {
|
||||
String foramtValue = String.valueOf(bodyObj.get("format"));
|
||||
if (StringUtils.equals("JSON-SCHEMA", foramtValue)) {
|
||||
String formatValue = String.valueOf(bodyObj.get("format"));
|
||||
if (StringUtils.equals("JSON-SCHEMA", formatValue)) {
|
||||
isJsonSchema = true;
|
||||
}
|
||||
}
|
||||
@ -271,7 +271,7 @@ public class ShareInfoService extends BaseShareInfoService {
|
||||
String raw = bodyObj.get("raw").asText();
|
||||
jsonSchemaBodyDTO.setRaw(raw);
|
||||
apiInfoDTO.setJsonSchemaBody(jsonSchemaBodyDTO);
|
||||
apiInfoDTO.setRequestBodyStrutureData(raw);
|
||||
apiInfoDTO.setRequestBodyStructureData(raw);
|
||||
//转化jsonObje 或者 jsonArray
|
||||
this.setPreviewData(previewJsonArray, raw);
|
||||
}
|
||||
@ -279,7 +279,7 @@ public class ShareInfoService extends BaseShareInfoService {
|
||||
} else if (StringUtils.equalsAny(type, "XML", "Raw")) {
|
||||
if (bodyObj.has("raw")) {
|
||||
String raw = bodyObj.get("raw").asText();
|
||||
apiInfoDTO.setRequestBodyStrutureData(raw);
|
||||
apiInfoDTO.setRequestBodyStructureData(raw);
|
||||
this.setPreviewData(previewJsonArray, raw);
|
||||
}
|
||||
} else if (StringUtils.equalsAny(type, "Form Data", "WWW_FORM")) {
|
||||
@ -376,8 +376,8 @@ public class ShareInfoService extends BaseShareInfoService {
|
||||
//判断是否是JsonSchema
|
||||
boolean isJsonSchema = false;
|
||||
if (bodyObj.has("format")) {
|
||||
String foramtValue = String.valueOf(bodyObj.get("format"));
|
||||
if (StringUtils.equals("JSON-SCHEMA", foramtValue)) {
|
||||
String formatValue = String.valueOf(bodyObj.get("format"));
|
||||
if (StringUtils.equals("JSON-SCHEMA", formatValue)) {
|
||||
isJsonSchema = true;
|
||||
}
|
||||
}
|
||||
@ -387,7 +387,7 @@ public class ShareInfoService extends BaseShareInfoService {
|
||||
} else {
|
||||
if (bodyObj.has("raw")) {
|
||||
String raw = bodyObj.get("raw").asText();
|
||||
apiInfoDTO.setResponseBodyStrutureData(raw);
|
||||
apiInfoDTO.setResponseBodyStructureData(raw);
|
||||
}
|
||||
}
|
||||
} else if (StringUtils.equalsAny(type, "Form Data", "WWW_FORM")) {
|
||||
|
@ -9,7 +9,6 @@ import io.metersphere.base.mapper.ext.ExtApiDefinitionExecResultMapper;
|
||||
import io.metersphere.base.mapper.plan.TestPlanApiCaseMapper;
|
||||
import io.metersphere.commons.constants.ApiRunMode;
|
||||
import io.metersphere.commons.constants.NoticeConstants;
|
||||
import io.metersphere.commons.constants.TestPlanApiExecuteStatus;
|
||||
import io.metersphere.commons.constants.TriggerMode;
|
||||
import io.metersphere.commons.enums.ApiReportStatus;
|
||||
import io.metersphere.commons.utils.*;
|
||||
@ -140,16 +139,6 @@ public class ApiDefinitionExecResultService {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isSchedule) {
|
||||
// 这个方法得优化大批量跑有问题
|
||||
Map<String, String> apiIdResultMap = new HashMap<>();
|
||||
long errorSize = dto.getRequestResults().stream().filter(requestResult -> requestResult.getError() > 0).count();
|
||||
String status = errorSize > 0 || dto.getRequestResults().isEmpty() ? TestPlanApiExecuteStatus.FAILD.name() : TestPlanApiExecuteStatus.SUCCESS.name();
|
||||
if (StringUtils.isNotEmpty(dto.getReportId())) {
|
||||
apiIdResultMap.put(dto.getReportId(), status);
|
||||
}
|
||||
LoggerUtil.info("TestPlanReportId[" + dto.getTestPlanReportId() + "] API CASE OVER. API CASE STATUS:" + JSON.toJSONString(apiIdResultMap));
|
||||
}
|
||||
}
|
||||
}
|
||||
sqlSession.flushStatements();
|
||||
@ -346,7 +335,7 @@ public class ApiDefinitionExecResultService {
|
||||
|
||||
}
|
||||
|
||||
public List<ExecutedCaseInfoResult> findFailureCaseInfoByProjectIDAndLimitNumberInSevenDays(String projectId, boolean selectFuntionCase, int limitNumber) {
|
||||
public List<ExecutedCaseInfoResult> findFailureCaseInfoByProjectIDAndLimitNumberInSevenDays(String projectId, boolean selectFunctionCase, int limitNumber) {
|
||||
|
||||
//获取7天之前的日期
|
||||
Date startDay = DateUtils.dateSum(new Date(), -6);
|
||||
@ -361,7 +350,7 @@ public class ApiDefinitionExecResultService {
|
||||
if (startTime == null) {
|
||||
return new ArrayList<>(0);
|
||||
} else {
|
||||
List<ExecutedCaseInfoResult> list = extApiDefinitionExecResultMapper.findFaliureCaseInTestPlanByProjectIDAndExecuteTimeAndLimitNumber(projectId, selectFuntionCase, startTime.getTime());
|
||||
List<ExecutedCaseInfoResult> list = extApiDefinitionExecResultMapper.findFailureCaseInTestPlanByProjectIDAndExecuteTimeAndLimitNumber(projectId, selectFunctionCase, startTime.getTime());
|
||||
|
||||
List<ExecutedCaseInfoResult> returnList = new ArrayList<>(limitNumber);
|
||||
|
||||
|
@ -1919,11 +1919,11 @@ public class ApiDefinitionService {
|
||||
for (EsbApiParamsWithBLOBs model : apiImport.getEsbApiParamsMap().values()) {
|
||||
EsbApiParamsExample example = new EsbApiParamsExample();
|
||||
example.createCriteria().andResourceIdEqualTo(model.getResourceId());
|
||||
List<EsbApiParamsWithBLOBs> exiteModelList = esbApiParamsMapper.selectByExampleWithBLOBs(example);
|
||||
if (exiteModelList.isEmpty()) {
|
||||
List<EsbApiParamsWithBLOBs> exitModelList = esbApiParamsMapper.selectByExampleWithBLOBs(example);
|
||||
if (exitModelList.isEmpty()) {
|
||||
esbApiParamsMapper.insert(model);
|
||||
} else {
|
||||
model.setId(exiteModelList.get(0).getId());
|
||||
model.setId(exitModelList.get(0).getId());
|
||||
esbApiParamsMapper.updateByPrimaryKeyWithBLOBs(model);
|
||||
}
|
||||
}
|
||||
|
@ -624,11 +624,11 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||
Map<String, List<ApiModule>> pidChildrenMap, Map<String, String> idPathMap,
|
||||
Map<String, ApiModuleDTO> idModuleMap, ApiTestImportRequest request,
|
||||
Boolean fullCoverage, List<ApiTestCaseWithBLOBs> importCases, Map<String, EsbApiParamsWithBLOBs> esbApiParamsMap) {
|
||||
List<ApiDefinitionWithBLOBs> optionDatas = new ArrayList<>();
|
||||
List<ApiDefinitionWithBLOBs> optionData = new ArrayList<>();
|
||||
//系统原有的需要更新的list,
|
||||
List<ApiDefinitionWithBLOBs> toUpdateList = new ArrayList<>();
|
||||
//去重,TCP,SQL,DUBBO 模块下名称唯一
|
||||
removeRepeatOrigin(data, fullCoverage, optionDatas);
|
||||
removeRepeatOrigin(data, fullCoverage, optionData);
|
||||
//上传文件时选的模块ID
|
||||
String chooseModuleId = request.getModuleId();
|
||||
//获取选中的模块
|
||||
@ -642,9 +642,9 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||
//需要新增的模块,key 为模块路径
|
||||
Map<String, ApiModule> moduleMap = new HashMap<>();
|
||||
//处理模块
|
||||
setModule(moduleMap, pidChildrenMap, idPathMap, idModuleMap, optionDatas, chooseModule);
|
||||
setModule(moduleMap, pidChildrenMap, idPathMap, idModuleMap, optionData, chooseModule);
|
||||
|
||||
List<ApiDefinitionWithBLOBs> repeatApiDefinitionWithBLOBs = getApiDefinitionWithBLOBsList(request, optionDatas);
|
||||
List<ApiDefinitionWithBLOBs> repeatApiDefinitionWithBLOBs = getApiDefinitionWithBLOBsList(request, optionData);
|
||||
//重复接口的case
|
||||
Map<String, List<ApiTestCaseWithBLOBs>> oldCaseMap = new HashMap<>();
|
||||
if (CollectionUtils.isNotEmpty(repeatApiDefinitionWithBLOBs)) {
|
||||
@ -658,17 +658,17 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||
String chooseModuleParentId = getChooseModuleParentId(chooseModule);
|
||||
String chooseModulePath = getChooseModulePath(idPathMap, chooseModule, chooseModuleParentId);
|
||||
if (fullCoverage) {
|
||||
List<ApiDefinitionWithBLOBs> singleOptionDatas = new ArrayList<>();
|
||||
removeOtherChooseModuleRepeat(optionDatas, singleOptionDatas, chooseModulePath);
|
||||
optionDatas = singleOptionDatas;
|
||||
optionMap = optionDatas.stream().collect(Collectors.toMap(t -> t.getName().concat(chooseModulePath), api -> api));
|
||||
List<ApiDefinitionWithBLOBs> singleOptionData = new ArrayList<>();
|
||||
removeOtherChooseModuleRepeat(optionData, singleOptionData, chooseModulePath);
|
||||
optionData = singleOptionData;
|
||||
optionMap = optionData.stream().collect(Collectors.toMap(t -> t.getName().concat(chooseModulePath), api -> api));
|
||||
} else {
|
||||
getNoHChooseModuleUrlRepeatOptionMap(optionDatas, optionMap, chooseModulePath);
|
||||
getNoHChooseModuleUrlRepeatOptionMap(optionData, optionMap, chooseModulePath);
|
||||
}
|
||||
repeatDataMap = repeatApiDefinitionWithBLOBs.stream().filter(t -> t.getModuleId().equals(chooseModuleId)).collect(Collectors.toMap(t -> t.getName().concat(t.getModulePath()), api -> api));
|
||||
}
|
||||
} else {
|
||||
buildOptionMap(optionDatas, optionMap);
|
||||
buildOptionMap(optionData, optionMap);
|
||||
if (CollectionUtils.isNotEmpty(repeatApiDefinitionWithBLOBs)) {
|
||||
repeatDataMap = repeatApiDefinitionWithBLOBs.stream().collect(Collectors.toMap(t -> t.getName().concat(t.getModulePath()), api -> api));
|
||||
}
|
||||
@ -685,32 +685,32 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||
}
|
||||
} else {
|
||||
//不覆盖
|
||||
removeRepeat(optionDatas, optionMap, repeatDataMap, moduleMap, versionId, optionDataCases);
|
||||
removeRepeat(optionData, optionMap, repeatDataMap, moduleMap, versionId, optionDataCases);
|
||||
}
|
||||
|
||||
//系统内检查重复
|
||||
if (CollectionUtils.isNotEmpty(repeatApiDefinitionWithBLOBs)) {
|
||||
repeatDataMap = repeatApiDefinitionWithBLOBs.stream().collect(Collectors.toMap(t -> t.getName().concat(t.getModulePath()), api -> api));
|
||||
optionMap = optionDatas.stream().collect(Collectors.toMap(t -> t.getName().concat(t.getModulePath()), api -> api));
|
||||
optionMap = optionData.stream().collect(Collectors.toMap(t -> t.getName().concat(t.getModulePath()), api -> api));
|
||||
if (fullCoverage) {
|
||||
cover(moduleMap, toUpdateList, optionMap, repeatDataMap, updateVersionId, optionDataCases, oldCaseMap, esbApiParamsMap);
|
||||
} else {
|
||||
//不覆盖,同一接口不做更新
|
||||
removeRepeat(optionDatas, optionMap, repeatDataMap, moduleMap, versionId, optionDataCases);
|
||||
removeRepeat(optionData, optionMap, repeatDataMap, moduleMap, versionId, optionDataCases);
|
||||
}
|
||||
}
|
||||
|
||||
if (optionDatas.isEmpty()) {
|
||||
if (optionData.isEmpty()) {
|
||||
moduleMap = new HashMap<>();
|
||||
}
|
||||
//将原来的case和更改的case组合在一起,为了同步的设置
|
||||
List<String> caseIds = optionDataCases.stream().map(ApiTestCase::getId).filter(StringUtils::isNotBlank).collect(Collectors.toList());
|
||||
buildCases(optionDataCases, oldCaseMap, caseIds);
|
||||
return getUpdateApiModuleDTO(moduleMap, toUpdateList, optionDatas, optionDataCases);
|
||||
return getUpdateApiModuleDTO(moduleMap, toUpdateList, optionData, optionDataCases);
|
||||
}
|
||||
|
||||
private void getNoHChooseModuleUrlRepeatOptionMap(List<ApiDefinitionWithBLOBs> optionDatas, Map<String, ApiDefinitionWithBLOBs> optionMap, String chooseModulePath) {
|
||||
for (ApiDefinitionWithBLOBs optionDatum : optionDatas) {
|
||||
private void getNoHChooseModuleUrlRepeatOptionMap(List<ApiDefinitionWithBLOBs> optionData, Map<String, ApiDefinitionWithBLOBs> optionMap, String chooseModulePath) {
|
||||
for (ApiDefinitionWithBLOBs optionDatum : optionData) {
|
||||
if (optionDatum.getModulePath() == null) {
|
||||
optionMap.put(optionDatum.getName().concat(chooseModulePath), optionDatum);
|
||||
} else {
|
||||
@ -719,15 +719,15 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||
}
|
||||
}
|
||||
|
||||
private void removeOtherChooseModuleRepeat(List<ApiDefinitionWithBLOBs> optionDatas, List<ApiDefinitionWithBLOBs> singleOptionDatas, String chooseModulePath) {
|
||||
LinkedHashMap<String, List<ApiDefinitionWithBLOBs>> methodPathMap = optionDatas.stream().collect(Collectors.groupingBy(t -> t.getName().concat(chooseModulePath), LinkedHashMap::new, Collectors.toList()));
|
||||
private void removeOtherChooseModuleRepeat(List<ApiDefinitionWithBLOBs> optionData, List<ApiDefinitionWithBLOBs> singleOptionData, String chooseModulePath) {
|
||||
LinkedHashMap<String, List<ApiDefinitionWithBLOBs>> methodPathMap = optionData.stream().collect(Collectors.groupingBy(t -> t.getName().concat(chooseModulePath), LinkedHashMap::new, Collectors.toList()));
|
||||
methodPathMap.forEach((k, v) -> {
|
||||
singleOptionDatas.add(v.get(v.size() - 1));
|
||||
singleOptionData.add(v.get(v.size() - 1));
|
||||
});
|
||||
}
|
||||
|
||||
private void buildOptionMap(List<ApiDefinitionWithBLOBs> optionDatas, Map<String, ApiDefinitionWithBLOBs> optionMap) {
|
||||
for (ApiDefinitionWithBLOBs optionDatum : optionDatas) {
|
||||
private void buildOptionMap(List<ApiDefinitionWithBLOBs> optionData, Map<String, ApiDefinitionWithBLOBs> optionMap) {
|
||||
for (ApiDefinitionWithBLOBs optionDatum : optionData) {
|
||||
if (optionDatum.getModulePath() == null) {
|
||||
optionMap.put(optionDatum.getName(), optionDatum);
|
||||
} else {
|
||||
@ -736,9 +736,9 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||
}
|
||||
}
|
||||
|
||||
private List<ApiDefinitionWithBLOBs> getApiDefinitionWithBLOBsList(ApiTestImportRequest request, List<ApiDefinitionWithBLOBs> optionDatas) {
|
||||
private List<ApiDefinitionWithBLOBs> getApiDefinitionWithBLOBsList(ApiTestImportRequest request, List<ApiDefinitionWithBLOBs> optionData) {
|
||||
//处理数据
|
||||
List<String> nameList = optionDatas.stream().map(ApiDefinitionWithBLOBs::getName).collect(Collectors.toList());
|
||||
List<String> nameList = optionData.stream().map(ApiDefinitionWithBLOBs::getName).collect(Collectors.toList());
|
||||
String projectId = request.getProjectId();
|
||||
String protocol = request.getProtocol();
|
||||
//获取系统内重复数据
|
||||
@ -750,12 +750,12 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||
Map<String, ApiModuleDTO> idModuleMap, ApiTestImportRequest request,
|
||||
Boolean fullCoverage, boolean urlRepeat, List<ApiTestCaseWithBLOBs> importCases) {
|
||||
|
||||
List<ApiDefinitionWithBLOBs> optionDatas = new ArrayList<>();
|
||||
List<ApiDefinitionWithBLOBs> optionData = new ArrayList<>();
|
||||
//系统原有的需要更新的list,
|
||||
List<ApiDefinitionWithBLOBs> toUpdateList = new ArrayList<>();
|
||||
//去重 如果url可重复 则模块+名称+请求方式+路径 唯一,否则 请求方式+路径唯一,
|
||||
//覆盖模式留重复的最后一个,不覆盖留第一个
|
||||
removeHttpRepeat(data, fullCoverage, urlRepeat, optionDatas);
|
||||
removeHttpRepeat(data, fullCoverage, urlRepeat, optionData);
|
||||
|
||||
//上传文件时选的模块ID
|
||||
String chooseModuleId = request.getModuleId();
|
||||
@ -770,23 +770,23 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||
//需要新增的模块,key 为模块路径
|
||||
Map<String, ApiModule> moduleMap = new HashMap<>();
|
||||
//处理模块
|
||||
setModule(moduleMap, pidChildrenMap, idPathMap, idModuleMap, optionDatas, chooseModule);
|
||||
setModule(moduleMap, pidChildrenMap, idPathMap, idModuleMap, optionData, chooseModule);
|
||||
|
||||
if (urlRepeat) {
|
||||
optionDatas = dealHttpUrlRepeat(chooseModule, idPathMap, optionDatas, fullCoverage, request, moduleMap, toUpdateList, optionDataCases);
|
||||
optionData = dealHttpUrlRepeat(chooseModule, idPathMap, optionData, fullCoverage, request, moduleMap, toUpdateList, optionDataCases);
|
||||
} else {
|
||||
dealHttpUrlNoRepeat(optionDatas, fullCoverage, request, moduleMap, toUpdateList, optionDataCases);
|
||||
dealHttpUrlNoRepeat(optionData, fullCoverage, request, moduleMap, toUpdateList, optionDataCases);
|
||||
}
|
||||
|
||||
if (optionDatas.isEmpty()) {
|
||||
if (optionData.isEmpty()) {
|
||||
moduleMap = new HashMap<>();
|
||||
}
|
||||
|
||||
return getUpdateApiModuleDTO(moduleMap, toUpdateList, optionDatas, optionDataCases);
|
||||
return getUpdateApiModuleDTO(moduleMap, toUpdateList, optionData, optionDataCases);
|
||||
|
||||
}
|
||||
|
||||
private void dealHttpUrlNoRepeat(List<ApiDefinitionWithBLOBs> optionDatas,
|
||||
private void dealHttpUrlNoRepeat(List<ApiDefinitionWithBLOBs> optionData,
|
||||
Boolean fullCoverage, ApiTestImportRequest request, Map<String, ApiModule> moduleMap,
|
||||
List<ApiDefinitionWithBLOBs> toUpdateList, List<ApiTestCaseWithBLOBs> optionDataCases) {
|
||||
|
||||
@ -798,13 +798,13 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||
Boolean fullCoverageApi = getFullCoverageApi(request);
|
||||
String projectId = request.getProjectId();
|
||||
//系统内重复的数据
|
||||
List<ApiDefinitionWithBLOBs> repeatApiDefinitionWithBLOBs = extApiDefinitionMapper.selectRepeatByBLOBs(optionDatas, projectId);
|
||||
List<ApiDefinitionWithBLOBs> repeatApiDefinitionWithBLOBs = extApiDefinitionMapper.selectRepeatByBLOBs(optionData, projectId);
|
||||
|
||||
//这个是系统内重复的数据
|
||||
Map<String, List<ApiDefinitionWithBLOBs>> repeatDataMap = repeatApiDefinitionWithBLOBs.stream().collect(Collectors.groupingBy(t -> t.getMethod().concat(t.getPath())));
|
||||
|
||||
//按照原来的顺序
|
||||
optionMap = optionDatas.stream().collect(Collectors.toMap(t -> t.getMethod().concat(t.getPath()), api -> api));
|
||||
optionMap = optionData.stream().collect(Collectors.toMap(t -> t.getMethod().concat(t.getPath()), api -> api));
|
||||
|
||||
Map<String, List<ApiTestCaseWithBLOBs>> oldCaseMap = new HashMap<>();
|
||||
|
||||
@ -816,18 +816,18 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||
if (fullCoverage) {
|
||||
if (fullCoverageApi) {
|
||||
if (CollectionUtils.isNotEmpty(repeatApiDefinitionWithBLOBs)) {
|
||||
startCoverModule(toUpdateList, optionDatas, optionMap, repeatDataMap, updateVersionId, optionDataCases, oldCaseMap);
|
||||
startCoverModule(toUpdateList, optionData, optionMap, repeatDataMap, updateVersionId, optionDataCases, oldCaseMap);
|
||||
}
|
||||
} else {
|
||||
//不覆盖模块
|
||||
if (CollectionUtils.isNotEmpty(repeatApiDefinitionWithBLOBs)) {
|
||||
startCover(toUpdateList, optionDatas, optionMap, repeatDataMap, updateVersionId, optionDataCases, oldCaseMap);
|
||||
startCover(toUpdateList, optionData, optionMap, repeatDataMap, updateVersionId, optionDataCases, oldCaseMap);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//不覆盖,同一接口不做更新
|
||||
if (CollectionUtils.isNotEmpty(repeatApiDefinitionWithBLOBs)) {
|
||||
removeSameData(repeatDataMap, optionMap, optionDatas, moduleMap, versionId, optionDataCases);
|
||||
removeSameData(repeatDataMap, optionMap, optionData, moduleMap, versionId, optionDataCases);
|
||||
}
|
||||
}
|
||||
//将原来的case和更改的case组合在一起,为了同步的设置
|
||||
@ -835,7 +835,7 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||
buildCases(optionDataCases, oldCaseMap, caseIds);
|
||||
}
|
||||
|
||||
private List<ApiDefinitionWithBLOBs> dealHttpUrlRepeat(ApiModuleDTO chooseModule, Map<String, String> idPathMap, List<ApiDefinitionWithBLOBs> optionDatas,
|
||||
private List<ApiDefinitionWithBLOBs> dealHttpUrlRepeat(ApiModuleDTO chooseModule, Map<String, String> idPathMap, List<ApiDefinitionWithBLOBs> optionData,
|
||||
Boolean fullCoverage, ApiTestImportRequest request, Map<String, ApiModule> moduleMap,
|
||||
List<ApiDefinitionWithBLOBs> toUpdateList, List<ApiTestCaseWithBLOBs> optionDataCases) {
|
||||
String updateVersionId = getUpdateVersionId(request);
|
||||
@ -843,7 +843,7 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||
Boolean fullCoverageApi = getFullCoverageApi(request);
|
||||
String projectId = request.getProjectId();
|
||||
//系统内重复的数据
|
||||
List<ApiDefinitionWithBLOBs> repeatApiDefinitionWithBLOBs = extApiDefinitionMapper.selectRepeatByBLOBs(optionDatas, projectId);
|
||||
List<ApiDefinitionWithBLOBs> repeatApiDefinitionWithBLOBs = extApiDefinitionMapper.selectRepeatByBLOBs(optionData, projectId);
|
||||
|
||||
//这个是名称加请求方式加路径加模块为key的map 就是为了去重
|
||||
Map<String, ApiDefinitionWithBLOBs> optionMap = new HashMap<>();
|
||||
@ -856,17 +856,17 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||
String chooseModulePath = getChooseModulePath(idPathMap, chooseModule, chooseModuleParentId);
|
||||
//这样的过滤规则下可能存在重复接口,如果是覆盖模块,需要按照去重规则再次去重,否则就加上接口原有的模块
|
||||
if (fullCoverage) {
|
||||
List<ApiDefinitionWithBLOBs> singleOptionDatas = new ArrayList<>();
|
||||
removeHttpChooseModuleRepeat(optionDatas, singleOptionDatas, chooseModulePath);
|
||||
optionDatas = singleOptionDatas;
|
||||
optionMap = optionDatas.stream().collect(Collectors.toMap(t -> t.getName().concat(t.getMethod()).concat(t.getPath()).concat(chooseModulePath), api -> api));
|
||||
List<ApiDefinitionWithBLOBs> singleOptionData = new ArrayList<>();
|
||||
removeHttpChooseModuleRepeat(optionData, singleOptionData, chooseModulePath);
|
||||
optionData = singleOptionData;
|
||||
optionMap = optionData.stream().collect(Collectors.toMap(t -> t.getName().concat(t.getMethod()).concat(t.getPath()).concat(chooseModulePath), api -> api));
|
||||
} else {
|
||||
getChooseModuleUrlRepeatOptionMap(optionDatas, optionMap, chooseModulePath);
|
||||
getChooseModuleUrlRepeatOptionMap(optionData, optionMap, chooseModulePath);
|
||||
}
|
||||
repeatDataMap = repeatApiDefinitionWithBLOBs.stream().filter(t -> t.getModuleId().equals(chooseModule.getId())).collect(Collectors.groupingBy(t -> t.getName().concat(t.getMethod()).concat(t.getPath()).concat(t.getModulePath())));
|
||||
} else {
|
||||
//否则在整个系统中过滤
|
||||
getUrlRepeatOptionMap(optionDatas, optionMap);
|
||||
getUrlRepeatOptionMap(optionData, optionMap);
|
||||
repeatDataMap = repeatApiDefinitionWithBLOBs.stream().collect(Collectors.groupingBy(t -> t.getName().concat(t.getMethod()).concat(t.getPath()).concat(t.getModulePath())));
|
||||
}
|
||||
Map<String, List<ApiTestCaseWithBLOBs>> oldCaseMap = new HashMap<>();
|
||||
@ -879,48 +879,48 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||
//允许覆盖模块,用导入的重复数据的最后一条覆盖查询的所有重复数据; case 在覆盖的时候,是拼接到原来的case,name唯一;不覆盖,就用原来的
|
||||
if (fullCoverageApi) {
|
||||
if (CollectionUtils.isNotEmpty(repeatApiDefinitionWithBLOBs)) {
|
||||
startCoverModule(toUpdateList, optionDatas, optionMap, repeatDataMap, updateVersionId, optionDataCases, oldCaseMap);
|
||||
startCoverModule(toUpdateList, optionData, optionMap, repeatDataMap, updateVersionId, optionDataCases, oldCaseMap);
|
||||
}
|
||||
} else {
|
||||
//覆盖但不覆盖模块
|
||||
if (CollectionUtils.isNotEmpty(repeatApiDefinitionWithBLOBs)) {
|
||||
//过滤同一层级重复模块,导入文件没有新增接口无需创建接口模块
|
||||
moduleMap = judgeModuleMap(moduleMap, optionMap, repeatDataMap);
|
||||
startCover(toUpdateList, optionDatas, optionMap, repeatDataMap, updateVersionId, optionDataCases, oldCaseMap);
|
||||
startCover(toUpdateList, optionData, optionMap, repeatDataMap, updateVersionId, optionDataCases, oldCaseMap);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//不覆盖,同一接口不做更新;可能创建新版本,case也直接创建,
|
||||
if (CollectionUtils.isNotEmpty(repeatApiDefinitionWithBLOBs)) {
|
||||
removeSameData(repeatDataMap, optionMap, optionDatas, moduleMap, versionId, optionDataCases);
|
||||
removeSameData(repeatDataMap, optionMap, optionData, moduleMap, versionId, optionDataCases);
|
||||
}
|
||||
}
|
||||
//最后在整个体统内检查一遍(防止在有选择的模块时,未找到重复,直接创建的情况)
|
||||
if (CollectionUtils.isNotEmpty(repeatApiDefinitionWithBLOBs)) {
|
||||
repeatDataMap = repeatApiDefinitionWithBLOBs.stream().collect(Collectors.groupingBy(t -> t.getName().concat(t.getMethod()).concat(t.getPath()).concat(t.getModulePath())));
|
||||
optionMap = optionDatas.stream().collect(Collectors.toMap(t -> t.getName().concat(t.getMethod()).concat(t.getPath()).concat(t.getModulePath()), api -> api));
|
||||
optionMap = optionData.stream().collect(Collectors.toMap(t -> t.getName().concat(t.getMethod()).concat(t.getPath()).concat(t.getModulePath()), api -> api));
|
||||
if (fullCoverage) {
|
||||
startCover(toUpdateList, optionDatas, optionMap, repeatDataMap, updateVersionId, optionDataCases, oldCaseMap);
|
||||
startCover(toUpdateList, optionData, optionMap, repeatDataMap, updateVersionId, optionDataCases, oldCaseMap);
|
||||
} else {
|
||||
//不覆盖,同一接口不做更新
|
||||
if (CollectionUtils.isNotEmpty(repeatApiDefinitionWithBLOBs)) {
|
||||
removeSameData(repeatDataMap, optionMap, optionDatas, moduleMap, versionId, optionDataCases);
|
||||
removeSameData(repeatDataMap, optionMap, optionData, moduleMap, versionId, optionDataCases);
|
||||
}
|
||||
}
|
||||
}
|
||||
//将原来的case和更改的case组合在一起,为了同步的设置
|
||||
List<String> caseIds = optionDataCases.stream().map(ApiTestCase::getId).filter(StringUtils::isNotBlank).collect(Collectors.toList());
|
||||
buildCases(optionDataCases, oldCaseMap, caseIds);
|
||||
return optionDatas;
|
||||
return optionData;
|
||||
}
|
||||
|
||||
private void removeHttpChooseModuleRepeat(List<ApiDefinitionWithBLOBs> optionDatas, List<ApiDefinitionWithBLOBs> singleOptionDatas, String chooseModulePath) {
|
||||
LinkedHashMap<String, List<ApiDefinitionWithBLOBs>> methodPathMap = optionDatas.stream().collect(Collectors.groupingBy(t -> t.getName().concat(t.getMethod()).concat(t.getPath()).concat(chooseModulePath), LinkedHashMap::new, Collectors.toList()));
|
||||
methodPathMap.forEach((k, v) -> singleOptionDatas.add(v.get(v.size() - 1)));
|
||||
private void removeHttpChooseModuleRepeat(List<ApiDefinitionWithBLOBs> optionData, List<ApiDefinitionWithBLOBs> singleOptionData, String chooseModulePath) {
|
||||
LinkedHashMap<String, List<ApiDefinitionWithBLOBs>> methodPathMap = optionData.stream().collect(Collectors.groupingBy(t -> t.getName().concat(t.getMethod()).concat(t.getPath()).concat(chooseModulePath), LinkedHashMap::new, Collectors.toList()));
|
||||
methodPathMap.forEach((k, v) -> singleOptionData.add(v.get(v.size() - 1)));
|
||||
}
|
||||
|
||||
private void getChooseModuleUrlRepeatOptionMap(List<ApiDefinitionWithBLOBs> optionDatas, Map<String, ApiDefinitionWithBLOBs> optionMap, String chooseModulePath) {
|
||||
for (ApiDefinitionWithBLOBs optionDatum : optionDatas) {
|
||||
private void getChooseModuleUrlRepeatOptionMap(List<ApiDefinitionWithBLOBs> optionData, Map<String, ApiDefinitionWithBLOBs> optionMap, String chooseModulePath) {
|
||||
for (ApiDefinitionWithBLOBs optionDatum : optionData) {
|
||||
if (optionDatum.getModulePath() == null) {
|
||||
optionMap.put(optionDatum.getName().concat(optionDatum.getMethod()).concat(optionDatum.getPath()).concat(chooseModulePath), optionDatum);
|
||||
} else {
|
||||
@ -929,8 +929,8 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||
}
|
||||
}
|
||||
|
||||
private void getUrlRepeatOptionMap(List<ApiDefinitionWithBLOBs> optionDatas, Map<String, ApiDefinitionWithBLOBs> optionMap) {
|
||||
for (ApiDefinitionWithBLOBs optionDatum : optionDatas) {
|
||||
private void getUrlRepeatOptionMap(List<ApiDefinitionWithBLOBs> optionData, Map<String, ApiDefinitionWithBLOBs> optionMap) {
|
||||
for (ApiDefinitionWithBLOBs optionDatum : optionData) {
|
||||
if (optionDatum.getModulePath() == null) {
|
||||
optionMap.put(optionDatum.getName().concat(optionDatum.getMethod()).concat(optionDatum.getPath()), optionDatum);
|
||||
} else {
|
||||
@ -1002,23 +1002,23 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||
}
|
||||
|
||||
|
||||
private UpdateApiModuleDTO getUpdateApiModuleDTO(Map<String, ApiModule> moduleMap, List<ApiDefinitionWithBLOBs> toUpdateList, List<ApiDefinitionWithBLOBs> optionDatas, List<ApiTestCaseWithBLOBs> optionDataCases) {
|
||||
private UpdateApiModuleDTO getUpdateApiModuleDTO(Map<String, ApiModule> moduleMap, List<ApiDefinitionWithBLOBs> toUpdateList, List<ApiDefinitionWithBLOBs> optionData, List<ApiTestCaseWithBLOBs> optionDataCases) {
|
||||
UpdateApiModuleDTO updateApiModuleDTO = new UpdateApiModuleDTO();
|
||||
updateApiModuleDTO.setModuleList(new ArrayList<>(moduleMap.values()));
|
||||
updateApiModuleDTO.setNeedUpdateList(toUpdateList);
|
||||
updateApiModuleDTO.setDefinitionWithBLOBs(optionDatas);
|
||||
updateApiModuleDTO.setDefinitionWithBLOBs(optionData);
|
||||
updateApiModuleDTO.setCaseWithBLOBs(optionDataCases);
|
||||
return updateApiModuleDTO;
|
||||
}
|
||||
|
||||
private void removeRepeat(List<ApiDefinitionWithBLOBs> optionDatas, Map<String, ApiDefinitionWithBLOBs> nameModuleMap,
|
||||
private void removeRepeat(List<ApiDefinitionWithBLOBs> optionData, Map<String, ApiDefinitionWithBLOBs> nameModuleMap,
|
||||
Map<String, ApiDefinitionWithBLOBs> repeatDataMap, Map<String, ApiModule> moduleMap,
|
||||
String versionId,
|
||||
List<ApiTestCaseWithBLOBs> optionDataCases) {
|
||||
if (MapUtils.isEmpty(nameModuleMap) || MapUtils.isEmpty(repeatDataMap)) {
|
||||
return;
|
||||
}
|
||||
Map<String, List<ApiDefinitionWithBLOBs>> moduleOptionData = optionDatas.stream().collect(Collectors.groupingBy(ApiDefinition::getModulePath));
|
||||
Map<String, List<ApiDefinitionWithBLOBs>> moduleOptionData = optionData.stream().collect(Collectors.groupingBy(ApiDefinition::getModulePath));
|
||||
repeatDataMap.forEach((k, v) -> {
|
||||
ApiDefinitionWithBLOBs apiDefinitionWithBLOBs = nameModuleMap.get(k);
|
||||
if (apiDefinitionWithBLOBs == null){
|
||||
@ -1027,15 +1027,15 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||
Map<String, List<ApiTestCaseWithBLOBs>> definitionIdCaseMAp = optionDataCases.stream().collect(Collectors.groupingBy(ApiTestCase::getApiDefinitionId));
|
||||
List<ApiTestCaseWithBLOBs> distinctNameCases = definitionIdCaseMAp.get(apiDefinitionWithBLOBs.getId());
|
||||
String modulePath = apiDefinitionWithBLOBs.getModulePath();
|
||||
List<ApiDefinitionWithBLOBs> moduleDatas = moduleOptionData.get(modulePath);
|
||||
if (moduleDatas != null && moduleDatas.size() <= 1) {
|
||||
List<ApiDefinitionWithBLOBs> moduleData = moduleOptionData.get(modulePath);
|
||||
if (moduleData != null && moduleData.size() <= 1) {
|
||||
moduleMap.remove(modulePath);
|
||||
removeModulePath(moduleMap, moduleOptionData, modulePath);
|
||||
moduleDatas.remove(apiDefinitionWithBLOBs);
|
||||
moduleData.remove(apiDefinitionWithBLOBs);
|
||||
}
|
||||
//不覆盖选择版本,如果被选版本有同接口,不导入,否则创建新版本接口
|
||||
if (v.getVersionId().equals(versionId)) {
|
||||
optionDatas.remove(apiDefinitionWithBLOBs);
|
||||
optionData.remove(apiDefinitionWithBLOBs);
|
||||
if (CollectionUtils.isNotEmpty(distinctNameCases)) {
|
||||
distinctNameCases.forEach(optionDataCases::remove);
|
||||
}
|
||||
@ -1148,29 +1148,29 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||
});
|
||||
}
|
||||
|
||||
private void removeRepeatOrigin(List<ApiDefinitionWithBLOBs> data, Boolean fullCoverage, List<ApiDefinitionWithBLOBs> optionDatas) {
|
||||
private void removeRepeatOrigin(List<ApiDefinitionWithBLOBs> data, Boolean fullCoverage, List<ApiDefinitionWithBLOBs> optionData) {
|
||||
LinkedHashMap<String, List<ApiDefinitionWithBLOBs>> methodPathMap = data.stream().collect(Collectors.groupingBy(t -> t.getName() + (t.getModulePath() == null ? StringUtils.EMPTY : t.getModulePath()), LinkedHashMap::new, Collectors.toList()));
|
||||
if (fullCoverage) {
|
||||
methodPathMap.forEach((k, v) -> optionDatas.add(v.get(v.size() - 1)));
|
||||
methodPathMap.forEach((k, v) -> optionData.add(v.get(v.size() - 1)));
|
||||
} else {
|
||||
methodPathMap.forEach((k, v) -> optionDatas.add(v.get(0)));
|
||||
methodPathMap.forEach((k, v) -> optionData.add(v.get(0)));
|
||||
}
|
||||
}
|
||||
|
||||
private void removeHttpRepeat(List<ApiDefinitionWithBLOBs> data, Boolean fullCoverage, boolean urlRepeat, List<ApiDefinitionWithBLOBs> optionDatas) {
|
||||
private void removeHttpRepeat(List<ApiDefinitionWithBLOBs> data, Boolean fullCoverage, boolean urlRepeat, List<ApiDefinitionWithBLOBs> optionData) {
|
||||
if (urlRepeat) {
|
||||
LinkedHashMap<String, List<ApiDefinitionWithBLOBs>> methodPathMap = data.stream().collect(Collectors.groupingBy(t -> t.getName() + t.getMethod() + t.getPath() + (t.getModulePath() == null ? StringUtils.EMPTY : t.getModulePath()), LinkedHashMap::new, Collectors.toList()));
|
||||
if (fullCoverage) {
|
||||
methodPathMap.forEach((k, v) -> optionDatas.add(v.get(v.size() - 1)));
|
||||
methodPathMap.forEach((k, v) -> optionData.add(v.get(v.size() - 1)));
|
||||
} else {
|
||||
methodPathMap.forEach((k, v) -> optionDatas.add(v.get(0)));
|
||||
methodPathMap.forEach((k, v) -> optionData.add(v.get(0)));
|
||||
}
|
||||
} else {
|
||||
LinkedHashMap<String, List<ApiDefinitionWithBLOBs>> methodPathMap = data.stream().collect(Collectors.groupingBy(t -> t.getMethod().concat(t.getPath()), LinkedHashMap::new, Collectors.toList()));
|
||||
if (fullCoverage) {
|
||||
methodPathMap.forEach((k, v) -> optionDatas.add(v.get(v.size() - 1)));
|
||||
methodPathMap.forEach((k, v) -> optionData.add(v.get(v.size() - 1)));
|
||||
} else {
|
||||
methodPathMap.forEach((k, v) -> optionDatas.add(v.get(0)));
|
||||
methodPathMap.forEach((k, v) -> optionData.add(v.get(0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1196,26 +1196,26 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||
}
|
||||
|
||||
private void removeSameData(Map<String, List<ApiDefinitionWithBLOBs>> repeatDataMap, Map<String, ApiDefinitionWithBLOBs> methodPathMap,
|
||||
List<ApiDefinitionWithBLOBs> optionDatas, Map<String, ApiModule> moduleMap, String versionId,
|
||||
List<ApiDefinitionWithBLOBs> optionData, Map<String, ApiModule> moduleMap, String versionId,
|
||||
List<ApiTestCaseWithBLOBs> optionDataCases) {
|
||||
|
||||
Map<String, List<ApiDefinitionWithBLOBs>> moduleOptionData = optionDatas.stream().collect(Collectors.groupingBy(ApiDefinition::getModulePath));
|
||||
Map<String, List<ApiDefinitionWithBLOBs>> moduleOptionData = optionData.stream().collect(Collectors.groupingBy(ApiDefinition::getModulePath));
|
||||
repeatDataMap.forEach((k, v) -> {
|
||||
ApiDefinitionWithBLOBs apiDefinitionWithBLOBs = methodPathMap.get(k);
|
||||
if (apiDefinitionWithBLOBs != null) {
|
||||
Map<String, List<ApiTestCaseWithBLOBs>> definitionIdCaseMAp = optionDataCases.stream().collect(Collectors.groupingBy(ApiTestCase::getApiDefinitionId));
|
||||
List<ApiTestCaseWithBLOBs> distinctNameCases = definitionIdCaseMAp.get(apiDefinitionWithBLOBs.getId());
|
||||
String modulePath = apiDefinitionWithBLOBs.getModulePath();
|
||||
List<ApiDefinitionWithBLOBs> moduleDatas = moduleOptionData.get(modulePath);
|
||||
if (moduleDatas != null && moduleDatas.size() <= 1) {
|
||||
List<ApiDefinitionWithBLOBs> moduleData = moduleOptionData.get(modulePath);
|
||||
if (moduleData != null && moduleData.size() <= 1) {
|
||||
moduleMap.remove(modulePath);
|
||||
removeModulePath(moduleMap, moduleOptionData, modulePath);
|
||||
moduleDatas.remove(apiDefinitionWithBLOBs);
|
||||
moduleData.remove(apiDefinitionWithBLOBs);
|
||||
}
|
||||
//不覆盖选择版本,如果被选版本有同接口,不导入,否则创建新版本接口
|
||||
List<ApiDefinitionWithBLOBs> sameVersionList = v.stream().filter(t -> t.getVersionId().equals(versionId)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(sameVersionList)) {
|
||||
optionDatas.remove(apiDefinitionWithBLOBs);
|
||||
optionData.remove(apiDefinitionWithBLOBs);
|
||||
if (CollectionUtils.isNotEmpty(distinctNameCases)) {
|
||||
distinctNameCases.forEach(optionDataCases::remove);
|
||||
}
|
||||
@ -1253,7 +1253,7 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||
|
||||
}
|
||||
|
||||
private void startCoverModule(List<ApiDefinitionWithBLOBs> toUpdateList, List<ApiDefinitionWithBLOBs> optionDatas,
|
||||
private void startCoverModule(List<ApiDefinitionWithBLOBs> toUpdateList, List<ApiDefinitionWithBLOBs> optionData,
|
||||
Map<String, ApiDefinitionWithBLOBs> methodPathMap, Map<String, List<ApiDefinitionWithBLOBs>> repeatDataMap,
|
||||
String updateVersionId, List<ApiTestCaseWithBLOBs> optionDataCases,
|
||||
Map<String, List<ApiTestCaseWithBLOBs>> oldCaseMap) {
|
||||
@ -1290,11 +1290,11 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||
addNewVersionApi(apiDefinitionWithBLOBs, v.get(0), "update");
|
||||
|
||||
} else {
|
||||
optionDatas.remove(apiDefinitionWithBLOBs);
|
||||
optionData.remove(apiDefinitionWithBLOBs);
|
||||
}
|
||||
}
|
||||
});
|
||||
buildOtherParam(toUpdateList, optionDatas, coverApiList, updateApiList);
|
||||
buildOtherParam(toUpdateList, optionData, coverApiList, updateApiList);
|
||||
}
|
||||
|
||||
private void buildCaseList(Map<String, List<ApiTestCaseWithBLOBs>> oldCaseMap,
|
||||
@ -1365,7 +1365,7 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||
}
|
||||
}
|
||||
|
||||
private void startCover(List<ApiDefinitionWithBLOBs> toUpdateList, List<ApiDefinitionWithBLOBs> optionDatas,
|
||||
private void startCover(List<ApiDefinitionWithBLOBs> toUpdateList, List<ApiDefinitionWithBLOBs> optionData,
|
||||
Map<String, ApiDefinitionWithBLOBs> methodPathMap, Map<String, List<ApiDefinitionWithBLOBs>> repeatDataMap,
|
||||
String updateVersionId, List<ApiTestCaseWithBLOBs> optionDataCases,
|
||||
Map<String, List<ApiTestCaseWithBLOBs>> oldCaseMap) {
|
||||
@ -1402,11 +1402,11 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||
addNewVersionApi(apiDefinitionWithBLOBs, v.get(0), "update");
|
||||
|
||||
} else {
|
||||
optionDatas.remove(apiDefinitionWithBLOBs);
|
||||
optionData.remove(apiDefinitionWithBLOBs);
|
||||
}
|
||||
}
|
||||
});
|
||||
buildOtherParam(toUpdateList, optionDatas, coverApiList, updateApiList);
|
||||
buildOtherParam(toUpdateList, optionData, coverApiList, updateApiList);
|
||||
}
|
||||
|
||||
private Map<String, ApiModule> judgeModuleMap(Map<String, ApiModule> moduleMap, Map<String, ApiDefinitionWithBLOBs> methodPathMap, Map<String, List<ApiDefinitionWithBLOBs>> repeatDataMap) {
|
||||
@ -1422,8 +1422,8 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||
return moduleMap;
|
||||
}
|
||||
|
||||
private void buildOtherParam(List<ApiDefinitionWithBLOBs> toUpdateList, List<ApiDefinitionWithBLOBs> optionDatas, List<ApiDefinitionWithBLOBs> coverApiList, List<ApiDefinitionWithBLOBs> updateApiList) {
|
||||
optionDatas.addAll(coverApiList);
|
||||
private void buildOtherParam(List<ApiDefinitionWithBLOBs> toUpdateList, List<ApiDefinitionWithBLOBs> optionData, List<ApiDefinitionWithBLOBs> coverApiList, List<ApiDefinitionWithBLOBs> updateApiList) {
|
||||
optionData.addAll(coverApiList);
|
||||
toUpdateList.addAll(updateApiList);
|
||||
|
||||
}
|
||||
|
@ -211,12 +211,12 @@ public class ApiTestCaseService {
|
||||
* 初始化部分参数
|
||||
*
|
||||
* @param request
|
||||
* @param setDefultOrders
|
||||
* @param setDefaultOrders
|
||||
* @param checkThisWeekData
|
||||
* @return
|
||||
*/
|
||||
private ApiTestCaseRequest initRequest(ApiTestCaseRequest request, boolean setDefultOrders, boolean checkThisWeekData) {
|
||||
if (setDefultOrders) {
|
||||
private ApiTestCaseRequest initRequest(ApiTestCaseRequest request, boolean setDefaultOrders, boolean checkThisWeekData) {
|
||||
if (setDefaultOrders) {
|
||||
List<OrderRequest> orders = ServiceUtils.getDefaultSortOrder(request.getOrders());
|
||||
orders.forEach(i -> {
|
||||
if (i.getName().equals("path")) {
|
||||
@ -967,7 +967,7 @@ public class ApiTestCaseService {
|
||||
}
|
||||
}
|
||||
|
||||
public DeleteCheckResult checkDeleteDatas(ApiTestBatchRequest request) {
|
||||
public DeleteCheckResult checkDeleteData(ApiTestBatchRequest request) {
|
||||
List<String> deleteIds = request.getIds();
|
||||
if (request.isSelectAll()) {
|
||||
deleteIds = this.getAllApiCaseIdsByFrontedSelect(request.getFilters(), request.getModuleIds(), request.getName(), request.getProjectId(), request.getProtocol(), request.getUnSelectIds(), request.getStatus(), request.getApiDefinitionId(), request.getCombine());
|
||||
|
@ -160,7 +160,7 @@ public class EsbApiParamService {
|
||||
|
||||
public SaveApiDefinitionRequest updateEsbRequest(SaveApiDefinitionRequest request) {
|
||||
try {
|
||||
//修改reqeust.parameters
|
||||
//修改request.parameters
|
||||
//用户交互感受:ESB的发送数据以报文模板为主框架,同时前端不再有key-value的表格数据填充。
|
||||
//业务逻辑: 发送ESB接口数据时,使用报文模板中的数据,同时报文模板中的${取值}目的是为了拼接数据结构(比如xml的子节点)
|
||||
//代码实现: 此处打算解析前端传来的EsbDataStruct数据结构,将数据结构按照报文模板中的${取值}为最高优先级组装keyValue对象。这样Jmeter会自动拼装为合适的xml
|
||||
@ -180,7 +180,7 @@ public class EsbApiParamService {
|
||||
|
||||
public SaveApiDefinitionRequest handleEsbRequest(SaveApiDefinitionRequest request) {
|
||||
try {
|
||||
//修改reqeust.parameters
|
||||
//修改request.parameters
|
||||
//用户交互感受:ESB的发送数据以报文模板为主框架,同时前端不再有key-value的表格数据填充。
|
||||
//业务逻辑: 发送ESB接口数据时,使用报文模板中的数据,同时报文模板中的${取值}目的是为了拼接数据结构(比如xml的子节点)
|
||||
//代码实现: 此处打算解析前端传来的EsbDataStruct数据结构,将数据结构按照报文模板中的${取值}为最高优先级组装keyValue对象。这样Jmeter会自动拼装为合适的xml
|
||||
@ -200,7 +200,7 @@ public class EsbApiParamService {
|
||||
|
||||
// public RunDefinitionRequest handleEsbRequest(RunDefinitionRequest request) {
|
||||
// try {
|
||||
// //修改reqeust.parameters
|
||||
// //修改request.parameters
|
||||
// //用户交互感受:ESB的发送数据以报文模板为主框架,同时前端不再有key-value的表格数据填充。
|
||||
// //业务逻辑: 发送ESB接口数据时,使用报文模板中的数据,同时报文模板中的${取值}目的是为了拼接数据结构(比如xml的子节点)
|
||||
// //代码实现: 此处打算解析前端传来的EsbDataStruct数据结构,将数据结构按照报文模板中的${取值}为最高优先级组装keyValue对象。这样Jmeter会自动拼装为合适的xml
|
||||
@ -309,7 +309,7 @@ public class EsbApiParamService {
|
||||
|
||||
public SaveApiTestCaseRequest handleEsbRequest(SaveApiTestCaseRequest request) {
|
||||
try {
|
||||
//修改reqeust.parameters, 将树结构类型数据转化为表格类型数据,供执行时参数的提取
|
||||
//修改request.parameters, 将树结构类型数据转化为表格类型数据,供执行时参数的提取
|
||||
if (StringUtils.isNotEmpty(request.getEsbDataStruct())) {
|
||||
MsTCPSampler tcpSampler = (MsTCPSampler) request.getRequest();
|
||||
List<KeyValue> keyValueList = this.genKeyValueListByDataStruct(tcpSampler, request.getEsbDataStruct());
|
||||
@ -325,7 +325,7 @@ public class EsbApiParamService {
|
||||
|
||||
public void handleEsbRequest(MsTCPSampler tcpSampler) {
|
||||
try {
|
||||
//修改reqeust.parameters, 将树结构类型数据转化为表格类型数据,供执行时参数的提取
|
||||
//修改request.parameters, 将树结构类型数据转化为表格类型数据,供执行时参数的提取
|
||||
if (tcpSampler.getEsbDataStruct() != null) {
|
||||
List<KeyValue> keyValueList = this.genKeyValueListByDataStruct(tcpSampler, tcpSampler.getEsbDataStruct());
|
||||
tcpSampler.setParameters(keyValueList);
|
||||
|
@ -586,11 +586,11 @@ public class ApiScenarioModuleService extends NodeTreeService<ApiScenarioModuleD
|
||||
ApiScenarioWithBLOBs apiScenarioWithBLOBs = nameModuleMap.get(k);
|
||||
if (apiScenarioWithBLOBs != null) {
|
||||
String modulePath = apiScenarioWithBLOBs.getModulePath();
|
||||
List<ApiScenarioWithBLOBs> moduleDatas = moduleOptionData.get(modulePath);
|
||||
if (moduleDatas != null && moduleDatas.size() <= 1) {
|
||||
List<ApiScenarioWithBLOBs> moduleData = moduleOptionData.get(modulePath);
|
||||
if (moduleData != null && moduleData.size() <= 1) {
|
||||
moduleMap.remove(modulePath);
|
||||
removeModulePath(moduleMap, moduleOptionData, modulePath);
|
||||
moduleDatas.remove(apiScenarioWithBLOBs);
|
||||
moduleData.remove(apiScenarioWithBLOBs);
|
||||
}
|
||||
//不覆盖选择版本,如果被选版本有同接口,不导入,否则创建新版本接口
|
||||
if (v.getVersionId().equals(versionId)) {
|
||||
|
@ -1744,8 +1744,8 @@ public class ApiScenarioService {
|
||||
return coverage;
|
||||
}
|
||||
int urlContainsCount = this.getApiIdInScenario(projectId, scenarioUrlMap, apiList).size();
|
||||
coverage.setCoverate(urlContainsCount);
|
||||
coverage.setNotCoverate(apiList.size() - urlContainsCount);
|
||||
coverage.setCoverage(urlContainsCount);
|
||||
coverage.setNotCoverage(apiList.size() - urlContainsCount);
|
||||
float coverageRageNumber = (float) urlContainsCount * 100 / apiList.size();
|
||||
DecimalFormat df = new DecimalFormat("0.0");
|
||||
coverage.setRateOfCoverage(df.format(coverageRageNumber) + "%");
|
||||
|
@ -203,7 +203,7 @@ automation_versions_update=There are multiple versions of this scene, name modif
|
||||
automation_versions_create=The scene already exists, please create a new version at version
|
||||
#authsource
|
||||
authsource_name_already_exists=Authentication source name already exists
|
||||
custom_field_already=A feild already exists under this workspace:
|
||||
custom_field_already=A field already exists under this workspace:
|
||||
expect_name_exists=Expect name is exists
|
||||
ssl_password_error=The authentication password is wrong, please re-enter the password
|
||||
ssl_file_error=Failed to load the certification file, please check the certification file
|
||||
|
@ -127,7 +127,7 @@
|
||||
# Sample OS family LAF:
|
||||
#jmeter.laf.windows=com.sun.java.swing.plaf.windows.WindowsLookAndFeel
|
||||
|
||||
# Custom settings for Mac using System LAF if you don't want to use Darcula
|
||||
# Custom settings for Mac using System LAF if you don't want to use Dracula
|
||||
#jmeter.laf.mac=System
|
||||
|
||||
# Failing that, the JMeter default laf can be defined:
|
||||
@ -916,7 +916,7 @@ beanshell.server.file=../extras/startup.bsh
|
||||
#beanshell.init.file=
|
||||
|
||||
#
|
||||
# Define the intialisation files for BeanShell Sampler, Function and other BeanShell elements
|
||||
# Define the initialisation files for BeanShell Sampler, Function and other BeanShell elements
|
||||
# N.B. Beanshell test elements do not share interpreters.
|
||||
# Each element in each thread has its own interpreter.
|
||||
# This is retained between samples.
|
||||
@ -1176,7 +1176,7 @@ view.results.tree.renderers_order=.RenderAsText,.RenderAsRegexp,.RenderAsBoundar
|
||||
# Set to 0 to store all results (might consume a lot of memory)
|
||||
#view.results.tree.max_results=500
|
||||
|
||||
# Maximum size of Document that can be parsed by Tika engine; defaut=10 * 1024 * 1024 (10MB)
|
||||
# Maximum size of Document that can be parsed by Tika engine; default=10 * 1024 * 1024 (10MB)
|
||||
# Set to 0 to disable the size check
|
||||
#document.max_size=0
|
||||
|
||||
|
@ -57,7 +57,7 @@ export function updateExecuteInfo(params) {
|
||||
return post('/api/testcase/updateExecuteInfo', params);
|
||||
}
|
||||
|
||||
export function checkDeleteDatas(params) {
|
||||
export function checkDeleteData(params) {
|
||||
return post('/api/testcase/get-del-reference', params);
|
||||
}
|
||||
|
||||
|
@ -21,39 +21,39 @@
|
||||
</div>
|
||||
<el-divider/>
|
||||
<div class="request-middle">
|
||||
<api-report-reqest-header-item :title="$t('api_test.request.method')">
|
||||
<api-report-request-header-item :title="$t('api_test.request.method')">
|
||||
<span class="method"> {{ request.method }}</span>
|
||||
</api-report-reqest-header-item>
|
||||
</api-report-request-header-item>
|
||||
|
||||
<api-report-reqest-header-item :title="$t('api_report.response_time')">
|
||||
<api-report-request-header-item :title="$t('api_report.response_time')">
|
||||
{{ request.responseResult.responseTime }} ms
|
||||
</api-report-reqest-header-item>
|
||||
</api-report-request-header-item>
|
||||
|
||||
<api-report-reqest-header-item :title="$t('api_report.latency')">
|
||||
<api-report-request-header-item :title="$t('api_report.latency')">
|
||||
{{ request.responseResult.latency }} ms
|
||||
</api-report-reqest-header-item>
|
||||
</api-report-request-header-item>
|
||||
|
||||
<api-report-reqest-header-item :title="$t('api_report.request_size')">
|
||||
<api-report-request-header-item :title="$t('api_report.request_size')">
|
||||
{{ request.requestSize }} bytes
|
||||
</api-report-reqest-header-item>
|
||||
</api-report-request-header-item>
|
||||
|
||||
<api-report-reqest-header-item :title="$t('api_report.response_size')">
|
||||
<api-report-request-header-item :title="$t('api_report.response_size')">
|
||||
{{ request.responseResult.responseSize }} bytes
|
||||
</api-report-reqest-header-item>
|
||||
</api-report-request-header-item>
|
||||
|
||||
<api-report-reqest-header-item :title="$t('api_report.error')">
|
||||
<api-report-request-header-item :title="$t('api_report.error')">
|
||||
{{ request.error }}
|
||||
</api-report-reqest-header-item>
|
||||
</api-report-request-header-item>
|
||||
|
||||
<api-report-reqest-header-item :title="$t('api_report.assertions')">
|
||||
<api-report-request-header-item :title="$t('api_report.assertions')">
|
||||
{{ request.passAssertions + " / " + request.totalAssertions }}
|
||||
</api-report-reqest-header-item>
|
||||
</api-report-request-header-item>
|
||||
|
||||
<api-report-reqest-header-item :title="$t('api_report.response_code')">
|
||||
<api-report-request-header-item :title="$t('api_report.response_code')">
|
||||
{{ request.responseResult.responseCode }}
|
||||
</api-report-reqest-header-item>
|
||||
</api-report-request-header-item>
|
||||
|
||||
<api-report-reqest-header-item :title="$t('api_report.result')">
|
||||
<api-report-request-header-item :title="$t('api_report.result')">
|
||||
<el-tag v-if="request.unexecute">{{
|
||||
$t('api_test.home_page.detail_card.unexecute')
|
||||
}}
|
||||
@ -71,7 +71,7 @@
|
||||
<el-tag size="mini" type="danger" v-else>
|
||||
{{ $t('api_report.fail') }}
|
||||
</el-tag>
|
||||
</api-report-reqest-header-item>
|
||||
</api-report-request-header-item>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
@ -83,7 +83,7 @@
|
||||
<script>
|
||||
import MsScenarioResult from "./components/ScenarioResult";
|
||||
import MsRequestResultTail from "./components/RequestResultTail";
|
||||
import ApiReportReqestHeaderItem from "./ApiReportReqestHeaderItem";
|
||||
import ApiReportRequestHeaderItem from "./ApiReportRequestHeaderItem";
|
||||
import MsMetricChart from "./components/MetricChart";
|
||||
import MsReportTitle from "metersphere-frontend/src/components/report/MsReportTitle";
|
||||
import MsReportExportTemplate from "metersphere-frontend/src/components/report/MsReportExportTemplate";
|
||||
@ -93,7 +93,7 @@ export default {
|
||||
name: "MsApiReportExport",
|
||||
components: {
|
||||
MsReportExportTemplate,
|
||||
MsReportTitle, MsMetricChart, ApiReportReqestHeaderItem, MsRequestResultTail, MsScenarioResult, MsAssertionResults
|
||||
MsReportTitle, MsMetricChart, ApiReportRequestHeaderItem, MsRequestResultTail, MsScenarioResult, MsAssertionResults
|
||||
},
|
||||
props: {
|
||||
report: Object,
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "ApiReportReqestHeaderItem",
|
||||
name: "ApiReportRequestHeaderItem",
|
||||
props: {title: String}
|
||||
}
|
||||
</script>
|
@ -39,8 +39,8 @@
|
||||
if (!this.body) {
|
||||
return;
|
||||
}
|
||||
let rowArry = this.body.split("\n");
|
||||
this.getTableData(rowArry);
|
||||
let rowArray = this.body.split("\n");
|
||||
this.getTableData(rowArray);
|
||||
if (this.tables.length > 1) {
|
||||
for (let i = 0; i < this.tables.length; i++) {
|
||||
if (this.tables[i].titles.length === 1 && i < this.tables.length - 1) {
|
||||
@ -64,20 +64,20 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getTableData(rowArry) {
|
||||
getTableData(rowArray) {
|
||||
let titles;
|
||||
let result = [];
|
||||
for (let i = 0; i < rowArry.length; i++) {
|
||||
let colArray = rowArry[i].split("\t");
|
||||
for (let i = 0; i < rowArray.length; i++) {
|
||||
let colArray = rowArray[i].split("\t");
|
||||
if (i === 0) {
|
||||
titles = colArray;
|
||||
} else {
|
||||
if (colArray.length != titles.length) {
|
||||
// 创建新的表
|
||||
if (colArray.length === 1 && colArray[0] === '') {
|
||||
this.getTableData(rowArry.slice(i + 1));
|
||||
this.getTableData(rowArray.slice(i + 1));
|
||||
} else {
|
||||
this.getTableData(rowArry.slice(i));
|
||||
this.getTableData(rowArray.slice(i));
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
|
@ -13,7 +13,7 @@
|
||||
<el-button type="primary" @click="handleConfirm" size="small" :style="btnStyle" class="env-confirm">
|
||||
{{ $t('workspace.env_group.confirm') }}
|
||||
</el-button>
|
||||
<el-dialog :visible="visble" append-to-body :title="$t('workspace.env_group.name')" @close="visble = false"
|
||||
<el-dialog :visible="visible" append-to-body :title="$t('workspace.env_group.name')" @close="visible = false"
|
||||
style="height: 800px;">
|
||||
<template>
|
||||
<environment-group style="overflow-y: auto;"
|
||||
@ -36,7 +36,7 @@ export default {
|
||||
return {
|
||||
groups: [],
|
||||
envGroupId: this.groupId,
|
||||
visble: false
|
||||
visible: false
|
||||
}
|
||||
},
|
||||
props: {
|
||||
@ -73,7 +73,7 @@ export default {
|
||||
})
|
||||
},
|
||||
viewGroup() {
|
||||
this.visble = true;
|
||||
this.visible = true;
|
||||
},
|
||||
async handleConfirm() {
|
||||
const sign = await this.checkEnv();
|
||||
|
@ -22,7 +22,7 @@
|
||||
<el-button type="primary" @click="handleConfirm" size="small" class="env-confirm">
|
||||
{{ $t('workspace.env_group.confirm') }}
|
||||
</el-button>
|
||||
<el-dialog :visible="visble" append-to-body :title="$t('workspace.env_group.name')" @close="visble = false"
|
||||
<el-dialog :visible="visible" append-to-body :title="$t('workspace.env_group.name')" @close="visible = false"
|
||||
style="height: 800px;">
|
||||
<template>
|
||||
<environment-group style="overflow-y: auto;"
|
||||
@ -45,7 +45,7 @@ export default {
|
||||
return {
|
||||
groups: [],
|
||||
envGroupId: this.groupId,
|
||||
visble: false,
|
||||
visible: false,
|
||||
disabledGroups: [],
|
||||
notDisabledGroups: [],
|
||||
result: false
|
||||
@ -88,7 +88,7 @@ export default {
|
||||
})
|
||||
},
|
||||
viewGroup() {
|
||||
this.visble = true;
|
||||
this.visible = true;
|
||||
},
|
||||
async handleConfirm() {
|
||||
const sign = await this.checkEnv();
|
||||
|
@ -36,7 +36,7 @@ export default {
|
||||
placeholder: {
|
||||
type: String,
|
||||
},
|
||||
errorInfor: String,
|
||||
errorInfo: String,
|
||||
addTagOnKeys: {
|
||||
type: Array,
|
||||
default: () => [13, 188, 9]
|
||||
@ -119,8 +119,8 @@ export default {
|
||||
this.innerTags.push(tag)
|
||||
return true
|
||||
} else {
|
||||
if (tag !== "" && this.errorInfor) {
|
||||
this.$error(this.errorInfor);
|
||||
if (tag !== "" && this.errorInfo) {
|
||||
this.$error(this.errorInfo);
|
||||
}
|
||||
}
|
||||
return false
|
||||
|
@ -42,7 +42,7 @@
|
||||
:title="$t('commons.reference_settings')"
|
||||
:visible.sync="dialogVisible" width="400px">
|
||||
<ul>
|
||||
<el-tooltip :content="$t('commons.enable_scene_info')" placement="top" v-if='showEnableScence'>
|
||||
<el-tooltip :content="$t('commons.enable_scene_info')" placement="top" v-if='showEnableScenario'>
|
||||
<el-checkbox v-model="data.environmentEnable" @change="checkEnv" :disabled="data.disabled">
|
||||
{{ $t('commons.enable_scene') }}
|
||||
</el-checkbox>
|
||||
@ -74,7 +74,7 @@ export default {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
showEnableScence: {
|
||||
showEnableScenario: {
|
||||
type: Boolean,
|
||||
default() {
|
||||
return true;
|
||||
|
@ -403,14 +403,14 @@ export default {
|
||||
updateParameters(v) {
|
||||
this.editData = JSON.parse(JSON.stringify(v));
|
||||
this.updateFiles();
|
||||
let datas = [];
|
||||
let data = [];
|
||||
this.variables.forEach(item => {
|
||||
if (item.id === v.id) {
|
||||
item = v;
|
||||
}
|
||||
datas.push(item);
|
||||
data.push(item);
|
||||
});
|
||||
this.variables = datas;
|
||||
this.variables = data;
|
||||
},
|
||||
select(selection) {
|
||||
this.selection = selection.map(s => s.id);
|
||||
@ -572,7 +572,7 @@ export default {
|
||||
});
|
||||
},
|
||||
filter() {
|
||||
let datas = [];
|
||||
let data = [];
|
||||
this.variables.forEach(item => {
|
||||
if (this.searchType && this.searchType != "" && this.selectVariable && this.selectVariable != "") {
|
||||
if ((item.type && item.type.toLowerCase().indexOf(this.searchType.toLowerCase()) == -1 && this.searchType != 'ALL')
|
||||
@ -599,9 +599,9 @@ export default {
|
||||
if (this.searchType === 'ALL' && !((this.selectVariable && this.selectVariable != ""))) {
|
||||
item.hidden = undefined;
|
||||
}
|
||||
datas.push(item);
|
||||
data.push(item);
|
||||
});
|
||||
this.variables = datas;
|
||||
this.variables = data;
|
||||
},
|
||||
createFilter(queryString) {
|
||||
return item => {
|
||||
|
@ -81,7 +81,7 @@ class Convert {
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归函数,转换object对象为json schmea 格式
|
||||
* 递归函数,转换object对象为json schema 格式
|
||||
* @param {*} object 需要转换对象
|
||||
* @param {*} name $id值
|
||||
*/
|
||||
|
@ -357,7 +357,7 @@ export default {
|
||||
this.parentReloadItems();
|
||||
},
|
||||
_joinName() {
|
||||
return `feild_${this.deep}_${this.countAdd++}_${getUUID().substring(0, 5)}`
|
||||
return `field_${this.deep}_${this.countAdd++}_${getUUID().substring(0, 5)}`
|
||||
},
|
||||
onSetting() {
|
||||
this.modalVisible = true;
|
||||
|
@ -66,7 +66,7 @@
|
||||
</el-input>
|
||||
</el-col>
|
||||
|
||||
<el-col v-if="withMorSetting" class="item kv-setting">
|
||||
<el-col v-if="withMoreSetting" class="item kv-setting">
|
||||
<el-tooltip effect="dark" :content="$t('schema.adv_setting')" placement="top">
|
||||
<i class="el-icon-setting" @click="openApiVariableSetting(item)"/>
|
||||
</el-tooltip>
|
||||
@ -143,7 +143,7 @@ export default {
|
||||
default: true
|
||||
},
|
||||
suggestions: Array,
|
||||
withMorSetting: Boolean,
|
||||
withMoreSetting: Boolean,
|
||||
scenarioDefinition: Array,
|
||||
},
|
||||
data() {
|
||||
|
@ -611,7 +611,7 @@ export default {
|
||||
},
|
||||
// 自定义变量
|
||||
filter() {
|
||||
let datas = [];
|
||||
let data = [];
|
||||
this.variables.forEach(item => {
|
||||
if (this.searchType && this.searchType != "" && this.defineVariable && this.defineVariable != "") {
|
||||
if ((item.type && item.type.toLowerCase().indexOf(this.searchType.toLowerCase()) == -1) || (item.name && item.name.toLowerCase().indexOf(this.defineVariable.toLowerCase()) == -1)) {
|
||||
@ -634,9 +634,9 @@ export default {
|
||||
} else {
|
||||
item.hidden = undefined;
|
||||
}
|
||||
datas.push(item);
|
||||
data.push(item);
|
||||
});
|
||||
this.variables = datas;
|
||||
this.variables = data;
|
||||
},
|
||||
tableRowClassName(row) {
|
||||
if (row.row.hidden) {
|
||||
|
@ -71,7 +71,7 @@
|
||||
}
|
||||
},
|
||||
editorInit: function (editor) {
|
||||
require('brace/ext/language_tools') //language extension prerequsite...
|
||||
require('brace/ext/language_tools') //language extension prerequisite...
|
||||
this.modes.forEach(mode => {
|
||||
require('brace/mode/' + mode); //language
|
||||
});
|
||||
|
@ -30,7 +30,7 @@
|
||||
<el-link class="ms-el-link" @click="batchAdd"> {{ $t("commons.batch_add") }}</el-link>
|
||||
</el-row>
|
||||
<ms-api-variable
|
||||
:with-mor-setting="true"
|
||||
:with-more-setting="true"
|
||||
:is-read-only="isReadOnly"
|
||||
:parameters="body.kvs"
|
||||
:urlEncode="body.type == 'WWW_FORM'"
|
||||
|
@ -338,8 +338,8 @@ export default {
|
||||
this.appendDataWithDeepForeach(this.tableData, rowId, dataRow);
|
||||
}
|
||||
},
|
||||
appendDataWithDeepForeach(datas, rowId, appendData) {
|
||||
datas.forEach(row => {
|
||||
appendDataWithDeepForeach(data, rowId, appendData) {
|
||||
data.forEach(row => {
|
||||
if (row.uuid === rowId) {
|
||||
if (row.children == null) {
|
||||
row.children = [];
|
||||
|
@ -156,7 +156,7 @@ export default {
|
||||
urlParams: "无",
|
||||
requestBodyParamType: "无",
|
||||
requestBodyFormData: '[]',
|
||||
requestBodyStrutureData: "",
|
||||
requestBodyStructureData: "",
|
||||
sharePopoverVisible: false,
|
||||
jsonSchemaBody: {},
|
||||
JsonSchemaResponseBody: {},
|
||||
@ -164,13 +164,12 @@ export default {
|
||||
responseBody: "",
|
||||
responseBodyParamType: "无",
|
||||
responseBodyFormData: "无",
|
||||
responseBodyStrutureData: "无",
|
||||
responseCode: "无",
|
||||
},
|
||||
methodColorMap: new Map(API_METHOD_COLOUR),
|
||||
clientHeight: '',//浏览器高度,
|
||||
maxCompnentSize: 10, //浏览器最多渲染的api信息体数量
|
||||
needAsyncSelect: false, //是否需要异步查询api详细数据做展现。只有本次要展示的数据总量大于maxCompnentSize时为true
|
||||
maxComponentSize: 10, //浏览器最多渲染的api信息体数量
|
||||
needAsyncSelect: false, //是否需要异步查询api详细数据做展现。只有本次要展示的数据总量大于maxComponentSize时为true
|
||||
currentApiIndexInApiShowArray: 0,//当前主要展示的api信息在apiShowArray的索引
|
||||
clickStepFlag: false,
|
||||
pageSize: 10,
|
||||
@ -272,7 +271,7 @@ export default {
|
||||
selectApiInfoByParam(simpleRequest, this.currentPage, this.pageSize).then(response => {
|
||||
this.apiInfoArray = response.data.listObject;
|
||||
this.total = response.data.itemCount;
|
||||
if (response.data.length > this.maxCompnentSize) {
|
||||
if (response.data.length > this.maxComponentSize) {
|
||||
this.needAsyncSelect = true;
|
||||
} else {
|
||||
this.needAsyncSelect = false;
|
||||
@ -351,13 +350,13 @@ export default {
|
||||
let mainDivHeight = this.$refs.apiDocInfoDiv.clientHeight;
|
||||
|
||||
let apiDocDivScrollTop = scrollTopCount;
|
||||
let screenHight = mainDivHeight;
|
||||
let screenHeight = mainDivHeight;
|
||||
for (let index = 0; index < this.apiInfoArray.length; index++) {
|
||||
let itemHeight = this.$refs.apiDocInfoDivItem[index].getHeight() + 3;
|
||||
if (apiDocDivScrollTop > itemHeight) {
|
||||
this.changeApiStepNodeClass(apiNodeDoms[index], false);
|
||||
} else {
|
||||
if (screenHight + apiDocDivScrollTop > 0) {
|
||||
if (screenHeight + apiDocDivScrollTop > 0) {
|
||||
this.changeApiStepNodeClass(apiNodeDoms[index], true);
|
||||
} else {
|
||||
this.changeApiStepNodeClass(apiNodeDoms[index], false);
|
||||
|
@ -20,7 +20,7 @@
|
||||
</el-row>
|
||||
<el-collapse-transition>
|
||||
<div v-show="active">
|
||||
<div v-if="!showSlotCompnent">
|
||||
<div v-if="!showSlotComponent">
|
||||
<div v-if="isText">
|
||||
<div class="showDataDiv">
|
||||
<br/>
|
||||
@ -38,7 +38,7 @@
|
||||
<div v-else>
|
||||
<el-table border :show-header="true" row-key="id" :row-class-name="getRowClassName"
|
||||
:data="tableData" :class="getTableClass()" ref="expandTable">
|
||||
<el-table-column v-for="item in tableColoumArr" :key="item.id"
|
||||
<el-table-column v-for="item in tableColumnArr" :key="item.id"
|
||||
:prop="item.prop"
|
||||
:label="item.label"
|
||||
show-overflow-tooltip>
|
||||
@ -86,17 +86,17 @@ export default {
|
||||
tableData: [],
|
||||
tableExpandButtonId: "docTableExpandBtn" + getUUID(),
|
||||
expandTitle: this.$t("commons.expand_all"),
|
||||
tableColoumArr: [
|
||||
{id: 1, prop: "name", label: this.$t('api_test.definition.document.table_coloum.name')},
|
||||
{id: 2, prop: "isRequired", label: this.$t('api_test.definition.document.table_coloum.is_required')},
|
||||
{id: 3, prop: "value", label: this.$t('api_test.definition.document.table_coloum.value')},
|
||||
{id: 4, prop: "description", label: this.$t('api_test.definition.document.table_coloum.desc')},
|
||||
tableColumnArr: [
|
||||
{id: 1, prop: "name", label: this.$t('api_definition.document.name')},
|
||||
{id: 2, prop: "isRequired", label: this.$t('api_definition.document.is_required')},
|
||||
{id: 3, prop: "value", label: this.$t('api_definition.document.value')},
|
||||
{id: 4, prop: "description", label: this.$t('api_definition.document.desc')},
|
||||
],
|
||||
};
|
||||
},
|
||||
props: {
|
||||
title: String,
|
||||
tableColoumType: String,
|
||||
tableColumnType: String,
|
||||
remarks: String,
|
||||
isRequest: Boolean,
|
||||
isResponse: Boolean,
|
||||
@ -139,7 +139,7 @@ export default {
|
||||
this.tableData = this.getJsonArr(this.stringData);
|
||||
},
|
||||
computed: {
|
||||
showSlotCompnent() {
|
||||
showSlotComponent() {
|
||||
return this.isRequest || this.isResponse;
|
||||
}
|
||||
},
|
||||
|
@ -42,15 +42,15 @@
|
||||
</el-row>
|
||||
<!--api请求头-->
|
||||
<api-info-collapse :table-can-expand="false" v-if="isArrayHasData(apiInfo.requestHead)"
|
||||
table-coloum-type="nameAndValue"
|
||||
table-column-type="nameAndValue"
|
||||
:title="$t('api_test.definition.document.request_head')"
|
||||
:string-data="apiInfo.requestHead"/>
|
||||
<!--QUERY参数-->
|
||||
<api-info-collapse v-if="isArrayHasData(apiInfo.urlParams)" table-coloum-type="simple"
|
||||
<api-info-collapse v-if="isArrayHasData(apiInfo.urlParams)" table-column-type="simple"
|
||||
:title="'QUERY'+$t('api_test.definition.document.request_param')"
|
||||
:string-data="apiInfo.urlParams"/>
|
||||
<!--REST参数-->
|
||||
<api-info-collapse v-if="isArrayHasData(apiInfo.restParams)" table-coloum-type="simple"
|
||||
<api-info-collapse v-if="isArrayHasData(apiInfo.restParams)" table-column-type="simple"
|
||||
:title="'REST'+$t('api_test.definition.document.request_param')"
|
||||
:string-data="apiInfo.restParams"/>
|
||||
<!--api请求体 以及表格-->
|
||||
@ -61,7 +61,7 @@
|
||||
|
||||
<!--响应头-->
|
||||
<api-info-collapse :table-can-expand="false" v-if="isArrayHasData(apiInfo.responseHead)"
|
||||
table-coloum-type="nameAndValue"
|
||||
table-column-type="nameAndValue"
|
||||
:title="$t('api_test.definition.document.response_head')"
|
||||
:string-data="apiInfo.responseHead"/>
|
||||
<!--响应体-->
|
||||
@ -128,7 +128,6 @@ export default {
|
||||
restParams: "无",
|
||||
requestBodyParamType: "无",
|
||||
requestBodyFormData: '[]',
|
||||
requestBodyStrutureData: "",
|
||||
sharePopoverVisible: false,
|
||||
jsonSchemaBody: {},
|
||||
JsonSchemaResponseBody: {},
|
||||
@ -136,13 +135,13 @@ export default {
|
||||
responseBody: "",
|
||||
responseBodyParamType: "无",
|
||||
responseBodyFormData: "无",
|
||||
responseBodyStrutureData: "无",
|
||||
requestBodyStructureData: "无",
|
||||
responseCode: "无",
|
||||
},
|
||||
methodColorMap: new Map(API_METHOD_COLOUR),
|
||||
maxCompnentSize: 5, //浏览器最多渲染的api信息体数量
|
||||
maxComponentSize: 5, //浏览器最多渲染的api信息体数量
|
||||
apiShowArray: [],//浏览器要渲染的api信息集合
|
||||
needAsyncSelect: false, //是否需要异步查询api详细数据做展现。只有本次要展示的数据总量大于maxCompnentSize时为true
|
||||
needAsyncSelect: false, //是否需要异步查询api详细数据做展现。只有本次要展示的数据总量大于maxComponentSize时为true
|
||||
currentApiIndexInApiShowArray: 0,//当前主要展示的api信息在apiShowArray的索引
|
||||
clickStepFlag: false,
|
||||
};
|
||||
@ -186,7 +185,7 @@ export default {
|
||||
if (apiInfo.jsonSchemaBody && apiInfo.jsonSchemaBody !== '' && apiInfo.jsonSchemaBody !== '[]') {
|
||||
hasParams = true;
|
||||
}
|
||||
} else if (apiInfo.requestBodyStrutureData && apiInfo.requestBodyStrutureData !== '') {
|
||||
} else if (apiInfo.requestBodyStructureData && apiInfo.requestBodyStructureData !== '') {
|
||||
hasParams = true;
|
||||
}
|
||||
}
|
||||
@ -210,9 +209,9 @@ export default {
|
||||
if (apiInfo.jsonSchemaResponseBody && apiInfo.jsonSchemaResponseBody !== '' && apiInfo.jsonSchemaResponseBody !== '[]') {
|
||||
hasParams = true;
|
||||
}
|
||||
} else if (apiInfo.responseBodyStrutureData && apiInfo.responseBodyStrutureData !== '') {
|
||||
} else if (apiInfo.requestBodyStructureData && apiInfo.requestBodyStructureData !== '') {
|
||||
try {
|
||||
JSON.parse(apiInfo.responseBodyStrutureData);
|
||||
JSON.parse(apiInfo.requestBodyStructureData);
|
||||
hasParams = true;
|
||||
} catch (e) {
|
||||
hasParams = true;
|
||||
|
@ -6,24 +6,24 @@
|
||||
:row-class-name="getRowClassName"
|
||||
:data="tableData" :class="getTableClass()" ref="expandTable">
|
||||
<el-table-column prop="name"
|
||||
:label="$t('api_test.definition.document.table_coloum.name')"
|
||||
:label="$t('api_definition.document.name')"
|
||||
min-width="120px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="contentType"
|
||||
:label="$t('api_test.definition.document.table_coloum.type')"
|
||||
:label="$t('api_definition.document.type')"
|
||||
min-width="120px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="description"
|
||||
:label="$t('api_test.definition.document.table_coloum.desc')"
|
||||
:label="$t('api_definition.document.desc')"
|
||||
min-width="280px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="required"
|
||||
:label="$t('api_test.definition.document.table_coloum.is_required')"
|
||||
:label="$t('api_definition.document.is_required')"
|
||||
:formatter="formatBoolean"
|
||||
min-width="80px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="value"
|
||||
:label="$t('api_test.definition.document.table_coloum.default_value')"
|
||||
:label="$t('api_definition.document.default_value')"
|
||||
min-width="120px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column type="expand" :label="getCollapseOption()" width="80px">
|
||||
@ -47,7 +47,7 @@
|
||||
<div v-else class="showDataDiv">
|
||||
<br/>
|
||||
<p style="margin: 0px 20px;"
|
||||
v-html="formatRowData(apiInfo.requestBodyParamType,apiInfo.requestBodyStrutureData)">
|
||||
v-html="formatRowData(apiInfo.requestBodyParamType,apiInfo.requestBodyStructureData)">
|
||||
</p>
|
||||
<br/>
|
||||
</div>
|
||||
@ -235,18 +235,18 @@ export default {
|
||||
return returnJsonArr;
|
||||
},
|
||||
formatRowDataToJsonSchema(api, jsonType) {
|
||||
if (jsonType === 'request' && api.requestBodyStrutureData) {
|
||||
if (jsonType === 'request' && api.requestBodyStructureData) {
|
||||
try {
|
||||
let bodyStructData = JSON.parse(api.requestBodyStrutureData);
|
||||
let bodyStructData = JSON.parse(api.requestBodyStructureData);
|
||||
api.requestJsonSchema = {'raw': bodyStructData};
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
} else if (jsonType === 'response' && api.responseBodyStrutureData) {
|
||||
} else if (jsonType === 'response' && api.requestBodyStructureData) {
|
||||
try {
|
||||
JSON.parse(api.responseBodyStrutureData);
|
||||
api.responseJsonSchema = {'raw': api.responseBodyStrutureData};
|
||||
JSON.parse(api.requestBodyStructureData);
|
||||
api.responseJsonSchema = {'raw': api.requestBodyStructureData};
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
|
@ -6,24 +6,24 @@
|
||||
:data="getJsonArr(apiInfo.responseBodyFormData)"
|
||||
class="test-content document-table">
|
||||
<el-table-column prop="name"
|
||||
:label="$t('api_test.definition.document.table_coloum.name')"
|
||||
:label="$t('api_definition.document.name')"
|
||||
min-width="120px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="contentType"
|
||||
:label="$t('api_test.definition.document.table_coloum.type')"
|
||||
:label="$t('api_definition.document.type')"
|
||||
min-width="120px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="description"
|
||||
:label="$t('api_test.definition.document.table_coloum.desc')"
|
||||
:label="$t('api_definition.document.desc')"
|
||||
min-width="280px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="required"
|
||||
:label="$t('api_test.definition.document.table_coloum.is_required')"
|
||||
:label="$t('api_definition.document.is_required')"
|
||||
:formatter="formatBoolean"
|
||||
min-width="80px"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="value"
|
||||
:label="$t('api_test.definition.document.table_coloum.default_value')"
|
||||
:label="$t('api_definition.document.default_value')"
|
||||
min-width="120px"
|
||||
show-overflow-tooltip/>
|
||||
</el-table>
|
||||
@ -38,7 +38,7 @@
|
||||
<div v-else class="showDataDiv">
|
||||
<br/>
|
||||
<p style="margin: 0px 20px;"
|
||||
v-html="formatRowData(apiInfo.responseBodyParamType,apiInfo.responseBodyStrutureData)">
|
||||
v-html="formatRowData(apiInfo.responseBodyParamType,apiInfo.requestBodyStructureData)">
|
||||
</p>
|
||||
<br/>
|
||||
</div>
|
||||
@ -107,18 +107,18 @@ export default {
|
||||
return ret;
|
||||
},
|
||||
formatRowDataToJsonSchema(api, jsonType) {
|
||||
if (jsonType === 'request' && api.requestBodyStrutureData) {
|
||||
if (jsonType === 'request' && api.requestBodyStructureData) {
|
||||
try {
|
||||
let bodyStructData = JSON.parse(api.requestBodyStrutureData);
|
||||
let bodyStructData = JSON.parse(api.requestBodyStructureData);
|
||||
api.requestJsonSchema = {'raw': bodyStructData};
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
} else if (jsonType === 'response' && api.responseBodyStrutureData) {
|
||||
} else if (jsonType === 'response' && api.requestBodyStructureData) {
|
||||
try {
|
||||
JSON.parse(api.responseBodyStrutureData);
|
||||
api.responseJsonSchema = {'raw': api.responseBodyStrutureData};
|
||||
JSON.parse(api.requestBodyStructureData);
|
||||
api.responseJsonSchema = {'raw': api.requestBodyStructureData};
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
|
@ -257,7 +257,7 @@ export default {
|
||||
this.customing = false
|
||||
},
|
||||
_joinName() {
|
||||
return `feild_${this.deep}_${this.countAdd++}_${getUUID().substring(0, 5)}`
|
||||
return `field_${this.deep}_${this.countAdd++}_${getUUID().substring(0, 5)}`
|
||||
},
|
||||
editScenarioAdvance(data) {
|
||||
this.$emit('editScenarioAdvance', data);
|
||||
|
@ -249,8 +249,8 @@ export default {
|
||||
this.appendDataWithDeepForeach(this.tableData, rowId, dataRow);
|
||||
}
|
||||
},
|
||||
appendDataWithDeepForeach(datas, rowId, appendData) {
|
||||
datas.forEach(row => {
|
||||
appendDataWithDeepForeach(data, rowId, appendData) {
|
||||
data.forEach(row => {
|
||||
if (row.uuid === rowId) {
|
||||
if (row.children == null) {
|
||||
row.children = [];
|
||||
|
@ -13,7 +13,7 @@
|
||||
<div v-if="isActive">
|
||||
<el-divider></el-divider>
|
||||
<esb-response-result :show-options-button="showOptionsButton"
|
||||
:is-api-compnent="false" :show-metric="false" :response="response"
|
||||
:is-api-component="false" :show-metric="false" :response="response"
|
||||
:request="request"/>
|
||||
</div>
|
||||
</el-collapse-transition>
|
||||
|
@ -91,7 +91,7 @@
|
||||
<div style="margin-top: 10px">
|
||||
<span>{{ $t('api_test.definition.request.query_param') }}{{ $t('api_test.api_import.optional') }}:</span>
|
||||
</div>
|
||||
<ms-api-variable :with-mor-setting="true" :is-read-only="isReadOnly" :isShowEnable="isShowEnable"
|
||||
<ms-api-variable :with-more-setting="true" :is-read-only="isReadOnly" :isShowEnable="isShowEnable"
|
||||
:parameters="queryArguments"/>
|
||||
<!--认证配置-->
|
||||
<div style="margin-top: 10px">
|
||||
|
@ -54,7 +54,7 @@
|
||||
<div style="margin-top: 10px">
|
||||
<span>{{ $t('api_test.definition.request.query_param') }}{{ $t('api_test.api_import.optional') }}:</span>
|
||||
</div>
|
||||
<ms-api-variable :with-mor-setting="true" :is-read-only="isReadOnly" :isShowEnable="isShowEnable"
|
||||
<ms-api-variable :with-more-setting="true" :is-read-only="isReadOnly" :isShowEnable="isShowEnable"
|
||||
:parameters="queryArguments"/>
|
||||
<!--认证配置-->
|
||||
<div style="margin-top: 10px">
|
||||
|
@ -8,7 +8,7 @@
|
||||
height="300px">
|
||||
<el-table-column prop="index"
|
||||
width="60"
|
||||
:label="$t('api_test.home_page.running_task_list.table_coloum.index')"
|
||||
:label="$t('home.table.index')"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column
|
||||
prop="swaggerUrl"
|
||||
@ -21,7 +21,7 @@
|
||||
<el-table-column prop="rule" label="同步规则"
|
||||
min-width="140"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column width="100" :label="$t('api_test.home_page.running_task_list.table_coloum.task_status')">
|
||||
<el-table-column width="100" :label="$t('home.table.task_status')">
|
||||
<template v-slot:default="scope">
|
||||
<div>
|
||||
<el-switch
|
||||
@ -32,7 +32,7 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="170" :label="$t('api_test.home_page.running_task_list.table_coloum.next_execution_time')">
|
||||
<el-table-column width="170" :label="$t('home.table.next_execution_time')">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.nextExecutionTime | datetimeFormat }}</span>
|
||||
</template>
|
||||
|
@ -274,7 +274,7 @@
|
||||
|
||||
import {
|
||||
apiTestCasePage,
|
||||
checkDeleteDatas,
|
||||
checkDeleteData,
|
||||
delApiTestCase,
|
||||
delCaseBatchByParam,
|
||||
delCaseToGcByParam,
|
||||
@ -992,7 +992,7 @@ export default {
|
||||
obj.unSelectIds = this.unSelection;
|
||||
obj = Object.assign(obj, this.condition);
|
||||
obj.ids = Array.from(this.selectRows).map(row => row.id);
|
||||
checkDeleteDatas(obj).then(response => {
|
||||
checkDeleteData(obj).then(response => {
|
||||
let checkResult = response.data;
|
||||
let alertMsg = this.$t('api_test.definition.request.delete_case_confirm') + " ?";
|
||||
if (!checkResult.deleteFlag) {
|
||||
@ -1085,7 +1085,7 @@ export default {
|
||||
obj.selectAllDate = false;
|
||||
obj.ids = [apiCase.id];
|
||||
obj = Object.assign(obj, this.condition);
|
||||
checkDeleteDatas(obj).then(response => {
|
||||
checkDeleteData(obj).then(response => {
|
||||
let checkResult = response.data;
|
||||
let alertMsg = this.$t('api_test.definition.request.delete_case_confirm') + ' ' + apiCase.name + " ?";
|
||||
if (!checkResult.deleteFlag) {
|
||||
@ -1322,7 +1322,7 @@ export default {
|
||||
path: "/performance/test/create"
|
||||
});
|
||||
}
|
||||
}).catch(erro => {
|
||||
}).catch(error => {
|
||||
this.$emit('runRefresh', {});
|
||||
});
|
||||
},
|
||||
|
@ -644,11 +644,11 @@ export default {
|
||||
case 'thisWeekCount':
|
||||
this.condition.selectThisWeedData = true;
|
||||
break;
|
||||
case 'notCoverate':
|
||||
case 'notCoverage':
|
||||
this.condition.apiCoverage = 'uncoverage';
|
||||
this.condition.scenarioCoverage = null;
|
||||
break;
|
||||
case 'coverate':
|
||||
case 'coverage':
|
||||
this.condition.apiCoverage = 'coverage';
|
||||
this.condition.scenarioCoverage = null;
|
||||
break;
|
||||
|
@ -136,7 +136,6 @@ export default {
|
||||
default: true
|
||||
},
|
||||
suggestions: Array,
|
||||
withMorSetting: Boolean,
|
||||
disableVariableTip: Boolean
|
||||
},
|
||||
data() {
|
||||
|
@ -23,7 +23,6 @@
|
||||
<mock-api-variable ref="mockApiVariableComp"
|
||||
:append-dialog-to-body="true"
|
||||
:suggestions="suggestions"
|
||||
:with-mor-setting="true"
|
||||
:is-read-only="isReadOnly"
|
||||
:isShowEnable="isShowEnable"
|
||||
:disable-variable-tip="disableVariableTip"
|
||||
@ -87,9 +86,9 @@ export default {
|
||||
initFilterDiv() {
|
||||
if (this.parameters && this.parameters.length > 1) {
|
||||
this.lineDivHeight = 0;
|
||||
let itemHeigh = 32 + 10;
|
||||
let itemHeight = 32 + 10;
|
||||
|
||||
let optionTypeHeight = this.parameters.length * itemHeigh;
|
||||
let optionTypeHeight = this.parameters.length * itemHeight;
|
||||
let firstHeight = 32;
|
||||
let endHeight = 32;
|
||||
|
||||
|
@ -139,7 +139,7 @@ export default {
|
||||
path: "/performance/test/create"
|
||||
});
|
||||
}
|
||||
}, erro => {
|
||||
}, error => {
|
||||
this.$emit('runRefresh', {});
|
||||
});
|
||||
}
|
||||
|
@ -47,7 +47,7 @@
|
||||
<ms-api-variable
|
||||
@editScenarioAdvance="editScenarioAdvance"
|
||||
:scenario-definition="scenarioDefinition"
|
||||
:with-mor-setting="true"
|
||||
:with-more-setting="true"
|
||||
:is-read-only="isReadOnly"
|
||||
:isShowEnable="isShowEnable"
|
||||
:parameters="request.arguments"
|
||||
@ -74,7 +74,7 @@
|
||||
<ms-api-variable
|
||||
@editScenarioAdvance="editScenarioAdvance"
|
||||
:scenario-definition="scenarioDefinition"
|
||||
:with-mor-setting="true"
|
||||
:with-more-setting="true"
|
||||
:is-read-only="isReadOnly"
|
||||
:isShowEnable="isShowEnable"
|
||||
:parameters="request.rest"
|
||||
|
@ -21,7 +21,7 @@
|
||||
<template v-slot:default="scope">
|
||||
<div v-if="scope.row.details && scope.row.details.columns">
|
||||
<div v-for="detail in scope.row.details.columns" :key="detail.id">
|
||||
<div v-if="linkDatas.indexOf(detail.columnName)!== -1">
|
||||
<div v-if="linkData.indexOf(detail.columnName)!== -1">
|
||||
<el-link style="color: #409EFF" @click="openDetail(scope.row,detail)">{{
|
||||
$t('operating_log.info')
|
||||
}}
|
||||
@ -38,7 +38,7 @@
|
||||
<template v-slot:default="scope">
|
||||
<div v-if="scope.row.details && scope.row.details.columns">
|
||||
<div v-for="detail in scope.row.details.columns" :key="detail.id">
|
||||
<div v-if="linkDatas.indexOf(detail.columnName)!== -1">
|
||||
<div v-if="linkData.indexOf(detail.columnName)!== -1">
|
||||
<el-link style="color: #409EFF" @click="openDetail(scope.row,detail)">{{
|
||||
$t('operating_log.info')
|
||||
}}
|
||||
@ -83,7 +83,7 @@ export default {
|
||||
infoVisible: false,
|
||||
loading: false,
|
||||
details: [],
|
||||
linkDatas: ["prerequisite", "steps", "remark", "request", "config",
|
||||
linkData: ["prerequisite", "steps", "remark", "request", "config",
|
||||
"response", "scenarioDefinition", "tags", "loadConfiguration", "advancedConfiguration"],
|
||||
showChangeField: true,
|
||||
pageSize: 10,
|
||||
|
@ -289,7 +289,7 @@ export default {
|
||||
this.parentReloadItems();
|
||||
},
|
||||
_joinName() {
|
||||
return `feild_${this.deep}_${this.countAdd++}_${getUUID().substring(0, 5)}`
|
||||
return `field_${this.deep}_${this.countAdd++}_${getUUID().substring(0, 5)}`
|
||||
},
|
||||
onSetting() {
|
||||
this.modalVisible = true;
|
||||
|
@ -273,15 +273,15 @@ export default {
|
||||
countScenarioCoverageByProjectId(selectProjectId).then(response => {
|
||||
let respData = response.data;
|
||||
this.scenarioCoverage.rateOfCoverage = respData.rateOfCoverage;
|
||||
this.scenarioCoverage.coverate = respData.coverate;
|
||||
this.scenarioCoverage.notCoverate = respData.notCoverate;
|
||||
this.scenarioCoverage.coverage = respData.coverage;
|
||||
this.scenarioCoverage.notCoverage = respData.notCoverage;
|
||||
});
|
||||
|
||||
countApiCoverageByProjectId(selectProjectId).then(response => {
|
||||
let respData = response.data;
|
||||
this.apiCoverage.rateOfCoverage = respData.rateOfCoverage;
|
||||
this.apiCoverage.coverate = respData.coverate;
|
||||
this.apiCoverage.notCoverate = respData.notCoverate;
|
||||
this.apiCoverage.coverage = respData.coverage;
|
||||
this.apiCoverage.notCoverage = respData.notCoverage;
|
||||
});
|
||||
|
||||
apiCaseCountByProjectId(selectProjectId).then(response => {
|
||||
|
@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<div class="table-card" v-loading="result" body-style="padding:10px;">
|
||||
<el-table border :data="tableData" class="adjust-table table-content" height="300px">
|
||||
<el-table-column prop="sortIndex" :label="$t('api_test.home_page.failed_case_list.table_coloum.index')"
|
||||
<el-table-column prop="sortIndex" :label="$t('home.case.index')"
|
||||
width="100" show-overflow-tooltip/>
|
||||
<el-table-column prop="caseName" :label="$t('api_test.home_page.failed_case_list.table_coloum.case_name')"
|
||||
<el-table-column prop="caseName" :label="$t('home.case.case_name')"
|
||||
width="150">
|
||||
<template v-slot:default="{row}">
|
||||
<el-link type="info" @click="redirect(row.caseType,row)">
|
||||
@ -14,7 +14,7 @@
|
||||
<el-table-column
|
||||
prop="caseType"
|
||||
column-key="caseType"
|
||||
:label="$t('api_test.home_page.failed_case_list.table_coloum.case_type')"
|
||||
:label="$t('home.case.case_type')"
|
||||
width="150"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
@ -28,7 +28,7 @@
|
||||
:content="$t('api_test.home_page.failed_case_list.table_value.case_type.functional')"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="testPlan" :label="$t('api_test.home_page.failed_case_list.table_coloum.test_plan')">
|
||||
<el-table-column prop="testPlan" :label="$t('home.case.test_plan')">
|
||||
<template v-slot:default="{row}">
|
||||
<div>
|
||||
<el-link type="info" @click="redirect('testPlanEdit',row.testPlanId)">
|
||||
@ -37,7 +37,7 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="failureTimes" :label="$t('api_test.home_page.failed_case_list.table_coloum.failure_times')"
|
||||
<el-table-column prop="failureTimes" :label="$t('home.case.failure_times')"
|
||||
width="100" show-overflow-tooltip/>
|
||||
</el-table>
|
||||
</div>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="table-card" v-loading="result" body-style="padding:10px;">
|
||||
<el-table border :data="tableData" class="adjust-table table-content" height="260px">
|
||||
<el-table-column prop="num" :label="$t('api_test.home_page.new_case_list.table_coloum.index')" width="100"
|
||||
<el-table-column prop="num" :label="$t('home.new_case.index')" width="100"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="{row}">
|
||||
<span type="num" @click="redirect(row.apiType,row.id)">
|
||||
@ -9,7 +9,7 @@
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" :label="$t('api_test.home_page.new_case_list.table_coloum.api_name')"
|
||||
<el-table-column prop="name" :label="$t('home.new_case.api_name')"
|
||||
show-overflow-tooltip width="170">
|
||||
<template v-slot:default="{row}">
|
||||
<span type="name" @click="redirect(row.apiType,row.id)">
|
||||
@ -17,23 +17,23 @@
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="path" :label="$t('api_test.home_page.new_case_list.table_coloum.path')" width="170"
|
||||
<el-table-column prop="path" :label="$t('home.new_case.path')" width="170"
|
||||
show-overflow-tooltip>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" :label="$t('api_test.home_page.new_case_list.table_coloum.api_status')">
|
||||
<el-table-column prop="status" :label="$t('home.new_case.api_status')">
|
||||
<template v-slot:default="scope">
|
||||
<span class="el-dropdown-link">
|
||||
<api-status :value="scope.row.status"/>
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('api_test.home_page.new_case_list.table_coloum.update_time')" width="170">
|
||||
<el-table-column :label="$t('home.new_case.update_time')" width="170">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.updateTime | datetimeFormat }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="caseTotal" :label="$t('api_test.home_page.new_case_list.table_coloum.relation_case')"
|
||||
<el-table-column prop="caseTotal" :label="$t('home.new_case.relation_case')"
|
||||
width="100">
|
||||
<template v-slot:default="{row}">
|
||||
<el-link type="info" @click="redirect(row.caseType,row.id)">
|
||||
@ -42,7 +42,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="scenarioTotal"
|
||||
:label="$t('api_test.home_page.new_case_list.table_coloum.relation_scenario')"
|
||||
:label="$t('home.new_case.relation_scenario')"
|
||||
width="100">
|
||||
<template v-slot:default="{row}">
|
||||
<el-link type="info" @click="redirect(row.scenarioType,row.ids)">
|
||||
@ -143,48 +143,6 @@ export default {
|
||||
});
|
||||
}
|
||||
},
|
||||
genProtocalFilter(protocalType) {
|
||||
if (protocalType === "HTTP") {
|
||||
this.methodFilters = [
|
||||
{text: 'GET', value: 'GET'},
|
||||
{text: 'POST', value: 'POST'},
|
||||
{text: 'PUT', value: 'PUT'},
|
||||
{text: 'PATCH', value: 'PATCH'},
|
||||
{text: 'DELETE', value: 'DELETE'},
|
||||
{text: 'OPTIONS', value: 'OPTIONS'},
|
||||
{text: 'HEAD', value: 'HEAD'},
|
||||
{text: 'CONNECT', value: 'CONNECT'},
|
||||
];
|
||||
} else if (protocalType === "TCP") {
|
||||
this.methodFilters = [
|
||||
{text: 'TCP', value: 'TCP'},
|
||||
];
|
||||
} else if (protocalType === "SQL") {
|
||||
this.methodFilters = [
|
||||
{text: 'SQL', value: 'SQL'},
|
||||
];
|
||||
} else if (protocalType === "DUBBO") {
|
||||
this.methodFilters = [
|
||||
{text: 'DUBBO', value: 'DUBBO'},
|
||||
{text: 'dubbo://', value: 'dubbo://'},
|
||||
];
|
||||
} else {
|
||||
this.methodFilters = [
|
||||
{text: 'GET', value: 'GET'},
|
||||
{text: 'POST', value: 'POST'},
|
||||
{text: 'PUT', value: 'PUT'},
|
||||
{text: 'PATCH', value: 'PATCH'},
|
||||
{text: 'DELETE', value: 'DELETE'},
|
||||
{text: 'OPTIONS', value: 'OPTIONS'},
|
||||
{text: 'HEAD', value: 'HEAD'},
|
||||
{text: 'CONNECT', value: 'CONNECT'},
|
||||
{text: 'DUBBO', value: 'DUBBO'},
|
||||
{text: 'dubbo://', value: 'dubbo://'},
|
||||
{text: 'SQL', value: 'SQL'},
|
||||
{text: 'TCP', value: 'TCP'},
|
||||
];
|
||||
}
|
||||
},
|
||||
//判断是否只显示本周的数据。 从首页跳转过来的请求会带有相关参数
|
||||
getSelectDataRange() {
|
||||
let dataRange = this.$route.params.dataSelectRange;
|
||||
|
@ -7,7 +7,7 @@
|
||||
:data="tableData"
|
||||
@refresh="search"
|
||||
screen-height="300px">
|
||||
<el-table-column prop="index" :label="$t('api_test.home_page.running_task_list.table_coloum.index')" width="80"
|
||||
<el-table-column prop="index" :label="$t('home.table.index')" width="80"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="name" :label="$t('commons.name')" width="200">
|
||||
<template v-slot:default="{row}">
|
||||
@ -23,7 +23,7 @@
|
||||
<ms-table-column
|
||||
prop="taskType"
|
||||
:filters="typeFilters"
|
||||
:label="$t('api_test.home_page.running_task_list.table_coloum.task_type')" width="120">
|
||||
:label="$t('home.table.task_type')" width="120">
|
||||
<template v-slot:default="scope">
|
||||
<ms-tag v-if="scope.row.taskGroup == 'API_SCENARIO_TEST'" type="success" effect="plain"
|
||||
:content="$t('api_test.home_page.running_task_list.scenario_schedule')"/>
|
||||
@ -33,9 +33,9 @@
|
||||
:content="$t('api_test.home_page.running_task_list.swagger_schedule')"/>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
<el-table-column prop="rule" :label="$t('api_test.home_page.running_task_list.table_coloum.run_rule')" width="120"
|
||||
<el-table-column prop="rule" :label="$t('home.table.run_rule')" width="120"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column width="100" :label="$t('api_test.home_page.running_task_list.table_coloum.task_status')">
|
||||
<el-table-column width="100" :label="$t('home.table.task_status')">
|
||||
<template v-slot:default="scope">
|
||||
<div>
|
||||
<el-switch
|
||||
@ -49,14 +49,14 @@
|
||||
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column width="170" :label="$t('api_test.home_page.running_task_list.table_coloum.next_execution_time')">
|
||||
<el-table-column width="170" :label="$t('home.table.next_execution_time')">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.nextExecutionTime | datetimeFormat }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="creator" :label="$t('api_test.home_page.running_task_list.table_coloum.create_user')"
|
||||
<el-table-column prop="creator" :label="$t('home.table.create_user')"
|
||||
width="100" show-overflow-tooltip/>
|
||||
<el-table-column width="170" :label="$t('api_test.home_page.running_task_list.table_coloum.update_time')">
|
||||
<el-table-column width="170" :label="$t('home.table.update_time')">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.updateTime | datetimeFormat }}</span>
|
||||
</template>
|
||||
|
@ -6,9 +6,9 @@
|
||||
</span>
|
||||
</template>
|
||||
<el-table border :data="tableData" class="adjust-table table-content" height="300px">
|
||||
<el-table-column prop="sortIndex" :label="$t('api_test.home_page.failed_case_list.table_coloum.index')"
|
||||
<el-table-column prop="sortIndex" :label="$t('home.case.index')"
|
||||
width="100" show-overflow-tooltip/>
|
||||
<el-table-column prop="caseName" :label="$t('api_test.home_page.failed_case_list.table_coloum.case_name')"
|
||||
<el-table-column prop="caseName" :label="$t('home.case.case_name')"
|
||||
width="150">
|
||||
<template v-slot:default="{row}">
|
||||
<el-link type="info" @click="redirect(row.caseType,row.id)">
|
||||
@ -19,7 +19,7 @@
|
||||
<el-table-column
|
||||
prop="caseType"
|
||||
column-key="caseType"
|
||||
:label="$t('api_test.home_page.failed_case_list.table_coloum.case_type')"
|
||||
:label="$t('home.case.case_type')"
|
||||
width="150"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
@ -33,7 +33,7 @@
|
||||
:content="$t('api_test.home_page.failed_case_list.table_value.case_type.functional')"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="testPlan" :label="$t('api_test.home_page.failed_case_list.table_coloum.test_plan')">
|
||||
<el-table-column prop="testPlan" :label="$t('home.case.test_plan')">
|
||||
<template v-slot:default="{row}">
|
||||
<div>
|
||||
<el-link type="info" @click="redirect('testPlanEdit',row.testPlanId)">
|
||||
@ -42,7 +42,7 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="failureTimes" :label="$t('api_test.home_page.failed_case_list.table_coloum.failure_times')"
|
||||
<el-table-column prop="failureTimes" :label="$t('home.case.failure_times')"
|
||||
width="110" show-overflow-tooltip/>
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
@ -11,7 +11,7 @@
|
||||
:data="tableData"
|
||||
@refresh="search"
|
||||
screen-height="300px">
|
||||
<el-table-column prop="index" :label="$t('api_test.home_page.running_task_list.table_coloum.index')" width="80"
|
||||
<el-table-column prop="index" :label="$t('home.table.index')" width="80"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="name" :label="$t('commons.name')" width="200">
|
||||
<template v-slot:default="{row}">
|
||||
@ -27,7 +27,7 @@
|
||||
<ms-table-column
|
||||
prop="taskType"
|
||||
:filters="typeFilters"
|
||||
:label="$t('api_test.home_page.running_task_list.table_coloum.task_type')" width="120">
|
||||
:label="$t('home.table.task_type')" width="120">
|
||||
<template v-slot:default="scope">
|
||||
<ms-tag v-if="scope.row.taskGroup == 'API_SCENARIO_TEST'" type="success" effect="plain"
|
||||
:content="$t('api_test.home_page.running_task_list.scenario_schedule')"/>
|
||||
@ -37,9 +37,9 @@
|
||||
:content="$t('api_test.home_page.running_task_list.swagger_schedule')"/>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
<el-table-column prop="rule" :label="$t('api_test.home_page.running_task_list.table_coloum.run_rule')" width="120"
|
||||
<el-table-column prop="rule" :label="$t('home.table.run_rule')" width="120"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column width="100" :label="$t('api_test.home_page.running_task_list.table_coloum.task_status')">
|
||||
<el-table-column width="100" :label="$t('home.table.task_status')">
|
||||
<template v-slot:default="scope">
|
||||
<div>
|
||||
<el-switch
|
||||
@ -53,14 +53,14 @@
|
||||
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column width="170" :label="$t('api_test.home_page.running_task_list.table_coloum.next_execution_time')">
|
||||
<el-table-column width="170" :label="$t('home.table.next_execution_time')">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.nextExecutionTime | datetimeFormat }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="creator" :label="$t('api_test.home_page.running_task_list.table_coloum.create_user')"
|
||||
<el-table-column prop="creator" :label="$t('home.table.create_user')"
|
||||
width="100" show-overflow-tooltip/>
|
||||
<el-table-column width="170" :label="$t('api_test.home_page.running_task_list.table_coloum.update_time')">
|
||||
<el-table-column width="170" :label="$t('home.table.update_time')">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.updateTime | datetimeFormat }}</span>
|
||||
</template>
|
||||
|
@ -126,9 +126,9 @@
|
||||
<el-col :span="12">
|
||||
<span class="default-property">
|
||||
{{ $t('api_test.home_page.detail_card.uncoverage') }}
|
||||
<el-link class="rows-count-number" type="info" @click="redirectPage('notCoverate')" target="_blank">
|
||||
<el-link class="rows-count-number" type="info" @click="redirectPage('notCoverage')" target="_blank">
|
||||
<b>
|
||||
{{ apiCoverage.notCoverate }}
|
||||
{{ apiCoverage.notCoverage }}
|
||||
</b>
|
||||
</el-link>
|
||||
</span>
|
||||
@ -136,9 +136,9 @@
|
||||
<el-col :span="12">
|
||||
<span class="main-property" style="float: right">
|
||||
{{ $t('api_test.home_page.detail_card.coverage') }}
|
||||
<el-link class="rows-count-number" @click="redirectPage('coverate')" target="_blank">
|
||||
<el-link class="rows-count-number" @click="redirectPage('coverage')" target="_blank">
|
||||
<b>
|
||||
{{ apiCoverage.coverate }}
|
||||
{{ apiCoverage.coverage }}
|
||||
</b>
|
||||
</el-link>
|
||||
</span>
|
||||
|
@ -171,16 +171,16 @@
|
||||
<el-col :span="12">
|
||||
<span class="default-property">
|
||||
{{ $t('api_test.home_page.detail_card.uncoverage') }}
|
||||
<el-link type="info" class="rows-count-number" @click="redirectPage('notCoverate')" target="_blank">
|
||||
<b>{{ scenarioCoverage.notCoverate }}</b>
|
||||
<el-link type="info" class="rows-count-number" @click="redirectPage('notCoverage')" target="_blank">
|
||||
<b>{{ scenarioCoverage.notCoverage }}</b>
|
||||
</el-link>
|
||||
</span>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<span class="main-property" style="float: right">
|
||||
{{ $t('api_test.home_page.detail_card.coverage') }}
|
||||
<el-link class="rows-count-number" @click="redirectPage('coverate')" target="_blank">
|
||||
<b>{{ scenarioCoverage.coverate }}</b>
|
||||
<el-link class="rows-count-number" @click="redirectPage('coverage')" target="_blank">
|
||||
<b>{{ scenarioCoverage.coverage }}</b>
|
||||
</el-link>
|
||||
</span>
|
||||
</el-col>
|
||||
@ -214,9 +214,9 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
redirectPage(clickType) {
|
||||
if (clickType === "coverate") {
|
||||
if (clickType === "coverage") {
|
||||
this.$emit("redirectPage", "api", "api", "coverageScenario");
|
||||
} else if (clickType === "notCoverate") {
|
||||
} else if (clickType === "notCoverage") {
|
||||
this.$emit("redirectPage", "api", "api", "unCoverageScenario");
|
||||
} else {
|
||||
this.$emit("redirectPage", "scenario", "scenario", clickType);
|
||||
|
@ -5,6 +5,44 @@ import mf from "metersphere-frontend/src/i18n/lang/en-US"
|
||||
const message = {
|
||||
api_case: {
|
||||
please_add_api_case: "Please add api case",
|
||||
},
|
||||
api_definition: {
|
||||
document: {
|
||||
name: "name",
|
||||
value: "value",
|
||||
is_required: "Is it required",
|
||||
desc: "Description",
|
||||
type: "Type",
|
||||
default_value: "Default value"
|
||||
}
|
||||
},
|
||||
home:{
|
||||
table: {
|
||||
index: "Index",
|
||||
scenario: "Scenario",
|
||||
task_type: "Task Type",
|
||||
run_rule: "Rule",
|
||||
task_status: "Status",
|
||||
next_execution_time: "Next Execution Time",
|
||||
create_user: "Creator",
|
||||
update_time: "Update time",
|
||||
},
|
||||
case: {
|
||||
index: "Ranking",
|
||||
case_name: "Case Name",
|
||||
case_type: "Case Type",
|
||||
test_plan: "Test Plan",
|
||||
failure_times: "Failure times",
|
||||
},
|
||||
new_case: {
|
||||
index: "ID",
|
||||
api_name: "Api Name",
|
||||
path: "path",
|
||||
api_status: "Api status",
|
||||
update_time: "Update time",
|
||||
relation_case: "Relation CASE",
|
||||
relation_scenario: "Relation Scenario"
|
||||
},
|
||||
}
|
||||
}
|
||||
export default {
|
||||
|
@ -3,8 +3,46 @@ import fu from "fit2cloud-ui/src/locale/lang/zh-CN"; // 加载fit2cloud的内容
|
||||
import mf from "metersphere-frontend/src/i18n/lang/zh-CN"
|
||||
|
||||
const message = {
|
||||
api_case:{
|
||||
api_case: {
|
||||
please_add_api_case: "请先添加接口用例",
|
||||
},
|
||||
api_definition: {
|
||||
document: {
|
||||
name: "名称",
|
||||
value: "值",
|
||||
is_required: "是否必填",
|
||||
desc: "描述",
|
||||
type: "类型",
|
||||
default_value: "默认值",
|
||||
},
|
||||
},
|
||||
home: {
|
||||
table: {
|
||||
index: "序号",
|
||||
scenario: "场景名称",
|
||||
task_type: "任务类型",
|
||||
run_rule: "运行规则",
|
||||
task_status: "任务状态",
|
||||
next_execution_time: "下次执行时间",
|
||||
create_user: "创建人",
|
||||
update_time: "更新时间",
|
||||
},
|
||||
case: {
|
||||
index: "排名",
|
||||
case_name: "用例名称",
|
||||
case_type: "用例类型",
|
||||
test_plan: "所属测试计划",
|
||||
failure_times: "失败次数",
|
||||
},
|
||||
new_case: {
|
||||
index: "ID",
|
||||
api_name: "接口名称",
|
||||
path: "路径",
|
||||
api_status: "状态",
|
||||
update_time: "更新时间",
|
||||
relation_case: "关联CASE",
|
||||
relation_scenario: "关联场景"
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,44 @@ import mf from "metersphere-frontend/src/i18n/lang/zh-TW"
|
||||
const message = {
|
||||
api_case: {
|
||||
please_add_api_case: "请先添加接口用例",
|
||||
},
|
||||
api_definition: {
|
||||
document: {
|
||||
name: "名稱",
|
||||
value: "值",
|
||||
is_required: "是否必填",
|
||||
desc: "描述",
|
||||
type: "類型",
|
||||
default_value: "默認值",
|
||||
},
|
||||
},
|
||||
home: {
|
||||
table: {
|
||||
index: "序號",
|
||||
scenario: "場景名稱",
|
||||
task_type: "任務類型",
|
||||
run_rule: "運行規則",
|
||||
task_status: "任務狀態",
|
||||
next_execution_time: "下次執行時間",
|
||||
create_user: "創建人",
|
||||
update_time: "更新時間",
|
||||
},
|
||||
case: {
|
||||
index: "排名",
|
||||
case_name: "用例名稱",
|
||||
case_type: "用例類型",
|
||||
test_plan: "所屬測試計劃",
|
||||
failure_times: "失敗次數",
|
||||
},
|
||||
new_case: {
|
||||
index: "ID",
|
||||
api_name: "接口名稱",
|
||||
path: "路徑",
|
||||
api_status: "狀態",
|
||||
update_time: "更新時間",
|
||||
relation_case: "關聯CASE",
|
||||
relation_scenario: "關聯場景"
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ export default {
|
||||
}
|
||||
},
|
||||
editorInit: function (editor) {
|
||||
require('brace/ext/language_tools') //language extension prerequsite...
|
||||
require('brace/ext/language_tools') //language extension prerequisite...
|
||||
this.modes.forEach(mode => {
|
||||
require('brace/mode/' + mode); //language
|
||||
});
|
||||
|
@ -35,7 +35,7 @@
|
||||
<field-custom-data-table-item :scene="scene"/>
|
||||
|
||||
<ms-table-column
|
||||
:label="$t('api_test.definition.document.table_coloum.is_required')"
|
||||
:label="$t('api_definition.document.is_required')"
|
||||
width="80"
|
||||
prop="type">
|
||||
<template v-slot="scope">
|
||||
|
@ -19,7 +19,7 @@
|
||||
</ms-table-column>
|
||||
|
||||
<ms-table-column
|
||||
:label="$t('api_test.home_page.failed_case_list.table_coloum.case_name')"
|
||||
:label="$t('home.case.case_name')"
|
||||
:min-width="120"
|
||||
prop="caseName">
|
||||
</ms-table-column>
|
||||
|
@ -39,7 +39,7 @@
|
||||
<field-custom-data-table-item :scene="scene"/>
|
||||
|
||||
<ms-table-column
|
||||
:label="$t('api_test.definition.document.table_coloum.is_required')"
|
||||
:label="$t('api_definition.document.is_required')"
|
||||
width="80"
|
||||
prop="type">
|
||||
<template v-slot="scope">
|
||||
|
@ -15,7 +15,7 @@
|
||||
<el-select
|
||||
:disabled="isSystem"
|
||||
filterable v-model="form.platform"
|
||||
:placeholder="$t('api_test.home_page.failed_case_list.table_coloum.case_type')">
|
||||
:placeholder="$t('home.case.case_type')">
|
||||
<el-option
|
||||
v-for="item in platformOption"
|
||||
:key="item.value"
|
||||
|
@ -11,10 +11,10 @@
|
||||
ref="fieldTemplateEdit">
|
||||
|
||||
<template v-slot:base>
|
||||
<el-form-item :label="$t('api_test.home_page.failed_case_list.table_coloum.case_type')" prop="type"
|
||||
<el-form-item :label="$t('home.case.case_type')" prop="type"
|
||||
:label-width="labelWidth">
|
||||
<el-select :disabled="isSystem" filterable v-model="form.type"
|
||||
:placeholder="$t('api_test.home_page.failed_case_list.table_coloum.case_type')">
|
||||
:placeholder="$t('home.case.case_type')">
|
||||
<el-option
|
||||
v-for="item in caseTypeOption"
|
||||
:key="item.value"
|
||||
|
@ -33,7 +33,7 @@
|
||||
</ms-table-column>
|
||||
|
||||
<ms-table-column
|
||||
:label="$t('api_test.home_page.failed_case_list.table_coloum.case_type')"
|
||||
:label="$t('home.case.case_type')"
|
||||
:fields="fields"
|
||||
:filters="caseTypeFilters"
|
||||
prop="type">
|
||||
|
@ -60,7 +60,7 @@
|
||||
<span v-if="scope.row.scheduleStatus === 'OPEN'">
|
||||
<el-tooltip placement="bottom-start" effect="light">
|
||||
<div slot="content">
|
||||
{{ $t('api_test.home_page.running_task_list.table_coloum.run_rule') }}: {{
|
||||
{{ $t('home.table.run_rule') }}: {{
|
||||
scope.row.scheduleCorn
|
||||
}}<br/>
|
||||
{{ $t('test_track.plan.next_run_time') }}:<span>{{
|
||||
|
@ -6,9 +6,9 @@
|
||||
</span>
|
||||
</template>
|
||||
<el-table border :data="tableData" class="adjust-table table-content" height="300px">
|
||||
<el-table-column prop="sortIndex" :label="$t('api_test.home_page.failed_case_list.table_coloum.index')"
|
||||
<el-table-column prop="sortIndex" :label="$t('home.case.index')"
|
||||
width="100" show-overflow-tooltip/>
|
||||
<el-table-column prop="caseName" :label="$t('api_test.home_page.failed_case_list.table_coloum.case_name')"
|
||||
<el-table-column prop="caseName" :label="$t('home.case.case_name')"
|
||||
width="150">
|
||||
<template v-slot:default="{row}">
|
||||
<el-link type="info" @click="redirect(row.caseType,row.id)">
|
||||
@ -19,7 +19,7 @@
|
||||
<el-table-column
|
||||
prop="caseType"
|
||||
column-key="caseType"
|
||||
:label="$t('api_test.home_page.failed_case_list.table_coloum.case_type')"
|
||||
:label="$t('home.case.case_type')"
|
||||
width="150"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
@ -33,7 +33,7 @@
|
||||
:content="$t('api_test.home_page.failed_case_list.table_value.case_type.functional')"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="testPlan" :label="$t('api_test.home_page.failed_case_list.table_coloum.test_plan')">
|
||||
<el-table-column prop="testPlan" :label="$t('home.case.test_plan')">
|
||||
<template v-slot:default="{row}">
|
||||
<div>
|
||||
<el-link type="info" @click="redirect('testPlanEdit',row.testPlanId)">
|
||||
@ -42,7 +42,7 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="failureTimes" :label="$t('api_test.home_page.failed_case_list.table_coloum.failure_times')"
|
||||
<el-table-column prop="failureTimes" :label="$t('home.case.failure_times')"
|
||||
width="110" show-overflow-tooltip/>
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
@ -11,7 +11,7 @@
|
||||
:data="tableData"
|
||||
@refresh="search"
|
||||
screen-height="300px">
|
||||
<el-table-column prop="index" :label="$t('api_test.home_page.running_task_list.table_coloum.index')" width="80"
|
||||
<el-table-column prop="index" :label="$t('home.table.index')" width="80"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column prop="name" :label="$t('commons.name')" width="200">
|
||||
<template v-slot:default="{row}">
|
||||
@ -27,7 +27,7 @@
|
||||
<ms-table-column
|
||||
prop="taskType"
|
||||
:filters="typeFilters"
|
||||
:label="$t('api_test.home_page.running_task_list.table_coloum.task_type')" width="120">
|
||||
:label="$t('home.table.task_type')" width="120">
|
||||
<template v-slot:default="scope">
|
||||
<ms-tag v-if="scope.row.taskGroup == 'API_SCENARIO_TEST'" type="success" effect="plain"
|
||||
:content="$t('api_test.home_page.running_task_list.scenario_schedule')"/>
|
||||
@ -37,9 +37,9 @@
|
||||
:content="$t('api_test.home_page.running_task_list.swagger_schedule')"/>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
<el-table-column prop="rule" :label="$t('api_test.home_page.running_task_list.table_coloum.run_rule')" width="120"
|
||||
<el-table-column prop="rule" :label="$t('home.table.run_rule')" width="120"
|
||||
show-overflow-tooltip/>
|
||||
<el-table-column width="100" :label="$t('api_test.home_page.running_task_list.table_coloum.task_status')">
|
||||
<el-table-column width="100" :label="$t('home.table.task_status')">
|
||||
<template v-slot:default="scope">
|
||||
<div>
|
||||
<el-switch
|
||||
@ -53,14 +53,14 @@
|
||||
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column width="170" :label="$t('api_test.home_page.running_task_list.table_coloum.next_execution_time')">
|
||||
<el-table-column width="170" :label="$t('home.table.next_execution_time')">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.nextExecutionTime | datetimeFormat }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="creator" :label="$t('api_test.home_page.running_task_list.table_coloum.create_user')"
|
||||
<el-table-column prop="creator" :label="$t('home.table.create_user')"
|
||||
width="100" show-overflow-tooltip/>
|
||||
<el-table-column width="170" :label="$t('api_test.home_page.running_task_list.table_coloum.update_time')">
|
||||
<el-table-column width="170" :label="$t('home.table.update_time')">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.updateTime | datetimeFormat }}</span>
|
||||
</template>
|
||||
|
@ -104,7 +104,7 @@
|
||||
<span v-if="scope.row.scheduleStatus === 'OPEN'">
|
||||
<el-tooltip placement="bottom-start" effect="light">
|
||||
<div slot="content">
|
||||
{{ $t('api_test.home_page.running_task_list.table_coloum.run_rule') }}: {{
|
||||
{{ $t('home.table.run_rule') }}: {{
|
||||
scope.row.scheduleCorn
|
||||
}}<br/>
|
||||
{{ $t('test_track.plan.next_run_time') }}:<span>{{
|
||||
|
Loading…
Reference in New Issue
Block a user