Merge branch 'v1.8'
This commit is contained in:
commit
f18f2f2559
|
@ -276,18 +276,11 @@
|
|||
<artifactId>spring-boot-starter-data-ldap</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- swagger2 解析 -->
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-parser</artifactId>
|
||||
<version>1.0.51</version>
|
||||
</dependency>
|
||||
|
||||
<!-- swagger3 解析 最新版本会有swagger-core版本冲突 -->
|
||||
<!-- swagger 解析 -->
|
||||
<dependency>
|
||||
<groupId>io.swagger.parser.v3</groupId>
|
||||
<artifactId>swagger-parser</artifactId>
|
||||
<version>2.0.18</version>
|
||||
<version>2.0.22</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 执行 js 代码依赖 -->
|
||||
|
@ -674,4 +667,4 @@
|
|||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
|
|
@ -29,6 +29,7 @@ public class EsbDataStruct {
|
|||
private boolean required;
|
||||
private String description;
|
||||
private List<EsbDataStruct> children;
|
||||
private String status = "";
|
||||
|
||||
public void init(){
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
|
@ -127,6 +128,9 @@ public class EsbDataStruct {
|
|||
|
||||
if (element != null) {
|
||||
if (this.children == null || this.children.isEmpty()) {
|
||||
if(this.value == null ){
|
||||
this.value = "";
|
||||
}
|
||||
element.addText(this.value);
|
||||
} else {
|
||||
for (EsbDataStruct child : children) {
|
||||
|
|
|
@ -58,14 +58,16 @@ public class MsDefinitionParser extends MsAbstractParser<ApiDefinitionImport> {
|
|||
private ApiDefinitionImport parseMsFormat(String testStr, ApiTestImportRequest importRequest) {
|
||||
ApiDefinitionImport apiDefinitionImport = JSON.parseObject(testStr, ApiDefinitionImport.class);
|
||||
Map<String, List<ApiTestCaseWithBLOBs>> caseMap = new HashMap<>();
|
||||
apiDefinitionImport.getCases().forEach(item -> {
|
||||
List<ApiTestCaseWithBLOBs> caseList = caseMap.get(item.getApiDefinitionId());
|
||||
if (caseList == null) {
|
||||
caseList = new ArrayList<>();
|
||||
caseMap.put(item.getApiDefinitionId(), caseList);
|
||||
}
|
||||
caseList.add(item);
|
||||
});
|
||||
if (apiDefinitionImport.getCases() != null) {
|
||||
apiDefinitionImport.getCases().forEach(item -> {
|
||||
List<ApiTestCaseWithBLOBs> caseList = caseMap.get(item.getApiDefinitionId());
|
||||
if (caseList == null) {
|
||||
caseList = new ArrayList<>();
|
||||
caseMap.put(item.getApiDefinitionId(), caseList);
|
||||
}
|
||||
caseList.add(item);
|
||||
});
|
||||
}
|
||||
apiDefinitionImport.getData().forEach(apiDefinition -> {
|
||||
parseApiDefinition(apiDefinition, importRequest, caseMap);
|
||||
});
|
||||
|
|
|
@ -70,8 +70,9 @@ public class Swagger2Parser extends SwaggerAbstractParser {
|
|||
parseParameters(operation, request);
|
||||
addBodyHeader(request);
|
||||
if (StringUtils.isNotBlank(basePath)) {
|
||||
apiDefinition.setPath(basePath + apiDefinition.getPath());
|
||||
request.setPath(basePath + request.getPath());
|
||||
String pathStr = basePath + apiDefinition.getPath().replaceAll("//","/");
|
||||
apiDefinition.setPath(pathStr);
|
||||
request.setPath(pathStr);
|
||||
}
|
||||
apiDefinition.setRequest(JSON.toJSONString(request));
|
||||
apiDefinition.setResponse(JSON.toJSONString(parseResponse(operation, operation.getResponses())));
|
||||
|
|
|
@ -114,23 +114,26 @@ public class MsScenario extends MsTestElement {
|
|||
// 设置共享cookie
|
||||
config.setEnableCookieShare(enableCookieShare);
|
||||
Map<String, EnvironmentConfig> envConfig = new HashMap<>(16);
|
||||
// 兼容历史数据
|
||||
if (environmentMap == null || environmentMap.isEmpty()) {
|
||||
environmentMap = new HashMap<>(16);
|
||||
if (StringUtils.isNotBlank(environmentId)) {
|
||||
environmentMap.put(SessionUtils.getCurrentProjectId(), environmentId);
|
||||
}
|
||||
}
|
||||
if (environmentMap != null && !environmentMap.isEmpty()) {
|
||||
environmentMap.keySet().forEach(projectId -> {
|
||||
ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class);
|
||||
ApiTestEnvironmentWithBLOBs environment = environmentService.get(environmentMap.get(projectId));
|
||||
if (environment != null && environment.getConfig() != null) {
|
||||
EnvironmentConfig env = JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class);
|
||||
envConfig.put(projectId, env);
|
||||
if (config.getConfig() == null) {
|
||||
// 兼容历史数据
|
||||
if (this.environmentMap == null || this.environmentMap.isEmpty()) {
|
||||
this.environmentMap = new HashMap<>(16);
|
||||
if (StringUtils.isNotBlank(environmentId)) {
|
||||
// 兼容1.8之前 没有environmentMap但有environmentId的数据
|
||||
this.environmentMap.put("historyProjectID", environmentId);
|
||||
}
|
||||
});
|
||||
config.setConfig(envConfig);
|
||||
}
|
||||
if (this.environmentMap != null && !this.environmentMap.isEmpty()) {
|
||||
this.environmentMap.keySet().forEach(projectId -> {
|
||||
ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class);
|
||||
ApiTestEnvironmentWithBLOBs environment = environmentService.get(this.environmentMap.get(projectId));
|
||||
if (environment != null && environment.getConfig() != null) {
|
||||
EnvironmentConfig env = JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class);
|
||||
envConfig.put(projectId, env);
|
||||
}
|
||||
});
|
||||
config.setConfig(envConfig);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(this.getVariables())) {
|
||||
config.setVariables(this.variables);
|
||||
|
|
|
@ -129,6 +129,11 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
config.setConfig(getEnvironmentConfig(useEnvironment));
|
||||
}
|
||||
|
||||
// 1.8 之前历史数据
|
||||
if(StringUtils.isEmpty(this.getProjectId()) && config.getConfig()!= null && !config.getConfig().isEmpty()){
|
||||
this.setProjectId("historyProjectID");
|
||||
}
|
||||
|
||||
// 添加环境中的公共变量
|
||||
Arguments arguments = this.addArguments(config);
|
||||
if (arguments != null) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package io.metersphere.api.dto.definition.request.sampler;
|
|||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.alibaba.fastjson.annotation.JSONType;
|
||||
import io.metersphere.api.dto.automation.EsbDataStruct;
|
||||
import io.metersphere.api.dto.definition.request.MsTestElement;
|
||||
import io.metersphere.api.dto.definition.request.ParameterConfig;
|
||||
import io.metersphere.api.dto.definition.request.processors.pre.MsJSR223PreProcessor;
|
||||
|
@ -70,6 +71,12 @@ public class MsTCPSampler extends MsTestElement {
|
|||
@JSONField(ordinal = 39)
|
||||
private String projectId;
|
||||
|
||||
/**
|
||||
* 新加两个参数,场景保存/修改时需要的参数。不会传递JMeter,只是用于最后的保留。
|
||||
*/
|
||||
private List<EsbDataStruct> esbDataStruct;
|
||||
private List<EsbDataStruct> backEsbDataStruct;
|
||||
|
||||
@Override
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
// 非导出操作,且不是启用状态则跳过执行
|
||||
|
|
|
@ -90,6 +90,8 @@ public class ApiAutomationService {
|
|||
@Resource
|
||||
@Lazy
|
||||
private TestPlanScenarioCaseService testPlanScenarioCaseService;
|
||||
@Resource
|
||||
private EsbApiParamService esbApiParamService;
|
||||
|
||||
public List<ApiScenarioDTO> list(ApiScenarioRequest request) {
|
||||
request = this.initRequest(request, true, true);
|
||||
|
@ -184,6 +186,9 @@ public class ApiAutomationService {
|
|||
scenario.setCreateTime(System.currentTimeMillis());
|
||||
scenario.setNum(getNextNum(request.getProjectId()));
|
||||
|
||||
//检查场景的请求步骤。如果含有ESB请求步骤的话,要做参数计算处理。
|
||||
esbApiParamService.checkScenarioRequests(request);
|
||||
|
||||
apiScenarioMapper.insert(scenario);
|
||||
|
||||
List<String> bodyUploadIds = request.getBodyUploadIds();
|
||||
|
@ -205,6 +210,9 @@ public class ApiAutomationService {
|
|||
List<String> bodyUploadIds = request.getBodyUploadIds();
|
||||
FileUtils.createBodyFiles(bodyUploadIds, bodyFiles);
|
||||
|
||||
//检查场景的请求步骤。如果含有ESB请求步骤的话,要做参数计算处理。
|
||||
esbApiParamService.checkScenarioRequests(request);
|
||||
|
||||
final ApiScenarioWithBLOBs scenario = buildSaveScenario(request);
|
||||
apiScenarioMapper.updateByPrimaryKeySelective(scenario);
|
||||
extScheduleMapper.updateNameByResourceID(request.getId(), request.getName());// 修改场景name,同步到修改首页定时任务
|
||||
|
|
|
@ -3,10 +3,7 @@ package io.metersphere.api.service;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import io.metersphere.api.dto.datacount.ExecutedCaseInfoResult;
|
||||
import io.metersphere.api.jmeter.TestResult;
|
||||
import io.metersphere.base.domain.ApiDefinitionExecResult;
|
||||
import io.metersphere.base.domain.ApiDefinitionExecResultExample;
|
||||
import io.metersphere.base.domain.ApiTestCaseWithBLOBs;
|
||||
import io.metersphere.base.domain.TestPlanApiCase;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.ApiDefinitionExecResultMapper;
|
||||
import io.metersphere.base.mapper.ApiTestCaseMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtApiDefinitionExecResultMapper;
|
||||
|
@ -43,7 +40,7 @@ public class ApiDefinitionExecResultService {
|
|||
@Resource
|
||||
private ApiTestCaseMapper apiTestCaseMapper;
|
||||
@Resource
|
||||
private TestCaseReviewApiCaseService testCaseReviewApiCaseService;
|
||||
private TestCaseReviewApiCaseService testCaseReviewApiCaseService;
|
||||
|
||||
@Resource
|
||||
SqlSessionFactory sqlSessionFactory;
|
||||
|
@ -73,6 +70,13 @@ public class ApiDefinitionExecResultService {
|
|||
testCaseReviewApiCaseService.setExecResult(item.getName(), status);
|
||||
|
||||
}
|
||||
|
||||
// 清空上次执行结果的内容,只保留当前最新一条内容
|
||||
ApiDefinitionExecResult prevResult = extApiDefinitionExecResultMapper.selectMaxResultByResourceIdAndType(item.getName(), type);
|
||||
if (prevResult != null) {
|
||||
prevResult.setContent(null);
|
||||
definitionExecResultMapper.updateByPrimaryKeyWithBLOBs(prevResult);
|
||||
}
|
||||
// 更新用例最后执行结果
|
||||
ApiTestCaseWithBLOBs apiTestCaseWithBLOBs = new ApiTestCaseWithBLOBs();
|
||||
apiTestCaseWithBLOBs.setId(saveResult.getResourceId());
|
||||
|
@ -94,7 +98,7 @@ public class ApiDefinitionExecResultService {
|
|||
*/
|
||||
public void saveApiResultByScheduleTask(TestResult result, String type) {
|
||||
String saveResultType = type;
|
||||
if(StringUtils.equalsAny(ApiRunMode.SCHEDULE_API_PLAN.name(),saveResultType)){
|
||||
if (StringUtils.equalsAny(ApiRunMode.SCHEDULE_API_PLAN.name(), saveResultType)) {
|
||||
saveResultType = ApiRunMode.API_PLAN.name();
|
||||
}
|
||||
|
||||
|
@ -127,6 +131,12 @@ public class ApiDefinitionExecResultService {
|
|||
}
|
||||
|
||||
saveResult.setUserId(userID);
|
||||
// 前一条数据内容清空
|
||||
ApiDefinitionExecResult prevResult = extApiDefinitionExecResultMapper.selectMaxResultByResourceIdAndType(item.getName(), finalSaveResultType);
|
||||
if (prevResult != null) {
|
||||
prevResult.setContent(null);
|
||||
apiDefinitionExecResultMapper.updateByPrimaryKeyWithBLOBs(prevResult);
|
||||
}
|
||||
apiDefinitionExecResultMapper.insert(saveResult);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -517,7 +517,7 @@ public class ApiDefinitionService {
|
|||
}
|
||||
|
||||
public void addResult(TestResult res) {
|
||||
if (!res.getScenarios().isEmpty() && !res.getScenarios().get(0).getRequestResults().isEmpty()) {
|
||||
if (res != null && CollectionUtils.isNotEmpty(res.getScenarios()) && res.getScenarios().get(0) != null && CollectionUtils.isNotEmpty(res.getScenarios().get(0).getRequestResults())) {
|
||||
RequestResult result = res.getScenarios().get(0).getRequestResults().get(0);
|
||||
if (result.getName().indexOf("<->") != -1) {
|
||||
result.setName(result.getName().substring(0, result.getName().indexOf("<->")));
|
||||
|
|
|
@ -253,6 +253,13 @@ public class ApiScenarioReportService {
|
|||
String status = "Success";
|
||||
report.setStatus(status);
|
||||
scenarioReportMapper.updateByPrimaryKeySelective(report);
|
||||
// 把上一条调试的数据内容清空
|
||||
ApiScenarioReport prevResult = extApiScenarioReportMapper.selectPreviousReportByScenarioId(report.getScenarioId(), reportId);
|
||||
if (prevResult != null) {
|
||||
ApiScenarioReportDetailExample example = new ApiScenarioReportDetailExample();
|
||||
example.createCriteria().andReportIdEqualTo(prevResult.getId());
|
||||
apiScenarioReportDetailMapper.deleteByExample(example);
|
||||
}
|
||||
});
|
||||
sqlSession.flushStatements();
|
||||
}
|
||||
|
|
|
@ -3,11 +3,13 @@ package io.metersphere.api.service;
|
|||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.metersphere.api.dto.automation.EsbDataStruct;
|
||||
import io.metersphere.api.dto.automation.SaveApiScenarioRequest;
|
||||
import io.metersphere.api.dto.automation.parse.EsbDataParser;
|
||||
import io.metersphere.api.dto.definition.ApiDefinitionResult;
|
||||
import io.metersphere.api.dto.definition.ApiTestCaseResult;
|
||||
import io.metersphere.api.dto.definition.SaveApiDefinitionRequest;
|
||||
import io.metersphere.api.dto.definition.SaveApiTestCaseRequest;
|
||||
import io.metersphere.api.dto.definition.request.MsTestElement;
|
||||
import io.metersphere.api.dto.definition.request.sampler.MsTCPSampler;
|
||||
import io.metersphere.api.dto.scenario.KeyValue;
|
||||
import io.metersphere.base.domain.ApiTestCaseWithBLOBs;
|
||||
|
@ -313,6 +315,35 @@ public class EsbApiParamService {
|
|||
return keyValueList;
|
||||
}
|
||||
|
||||
private List<KeyValue> genKeyValueListByDataStruct(MsTCPSampler tcpSampler, List<EsbDataStruct> dataStructRequestList) {
|
||||
List<KeyValue> keyValueList = new ArrayList<>();
|
||||
String sendRequest = tcpSampler.getRequest();
|
||||
String paramRegexStr = "\\$\\{([^}]*)\\}";
|
||||
try {
|
||||
if (StringUtils.isNotEmpty(sendRequest)) {
|
||||
List<String> paramList = new ArrayList<>();
|
||||
Pattern regex = Pattern.compile(paramRegexStr);
|
||||
Matcher matcher = regex.matcher(sendRequest);
|
||||
while (matcher.find()) {
|
||||
paramList.add(matcher.group(1));
|
||||
}
|
||||
for (String param : paramList) {
|
||||
String value = this.genValueFromEsbDataStructByParam(dataStructRequestList, param);
|
||||
if (StringUtils.isNotEmpty(value)) {
|
||||
KeyValue kv = new KeyValue();
|
||||
kv.setName(param);
|
||||
kv.setValue(value);
|
||||
kv.setRequired(true);
|
||||
keyValueList.add(kv);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return keyValueList;
|
||||
}
|
||||
|
||||
//通过报文模版中的变量参数,解析报文数据结构,生成对应的xml数据
|
||||
private String genValueFromEsbDataStructByParam(List<EsbDataStruct> dataStructRequestList, String param) {
|
||||
String returnValue = "";
|
||||
|
@ -341,10 +372,32 @@ public class EsbApiParamService {
|
|||
return request;
|
||||
}
|
||||
|
||||
public void handleEsbRequest(MsTCPSampler tcpSampler) {
|
||||
try {
|
||||
//修改reqeust.parameters, 将树结构类型数据转化为表格类型数据,供执行时参数的提取
|
||||
if (tcpSampler.getEsbDataStruct() != null ) {
|
||||
List<KeyValue> keyValueList = this.genKeyValueListByDataStruct(tcpSampler, tcpSampler.getEsbDataStruct());
|
||||
tcpSampler.setParameters(keyValueList);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteByResourceIdIn(List<String> apiIds) {
|
||||
EsbApiParamsExample example = new EsbApiParamsExample();
|
||||
example.createCriteria().andResourceIdIn(apiIds);
|
||||
esbApiParamsMapper.deleteByExample(example);
|
||||
}
|
||||
|
||||
public void checkScenarioRequests(SaveApiScenarioRequest request) {
|
||||
if(request.getScenarioDefinition() != null ){
|
||||
List<MsTestElement> hashTreeList = request.getScenarioDefinition().getHashTree();
|
||||
for (MsTestElement testElement :hashTreeList) {
|
||||
if(testElement instanceof MsTCPSampler){
|
||||
this.handleEsbRequest((MsTCPSampler)testElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,12 +76,17 @@ public class HistoricalDataUpgradeService {
|
|||
return scenario;
|
||||
}
|
||||
|
||||
private MsScenario createScenario(Scenario oldScenario) {
|
||||
private MsScenario createScenario(Scenario oldScenario, String projectId) {
|
||||
MsScenario scenario = new MsScenario();
|
||||
scenario.setOldVariables(oldScenario.getVariables());
|
||||
scenario.setName(oldScenario.getName());
|
||||
scenario.setEnableCookieShare(oldScenario.isEnableCookieShare());
|
||||
scenario.setEnvironmentId(oldScenario.getEnvironmentId());
|
||||
if (StringUtils.isNotEmpty(oldScenario.getEnvironmentId())) {
|
||||
HashMap<String, String> envMap = new HashMap<>();
|
||||
envMap.put(projectId, oldScenario.getEnvironmentId());
|
||||
scenario.setEnvironmentMap(envMap);
|
||||
}
|
||||
scenario.setReferenced("Upgrade");
|
||||
scenario.setId(oldScenario.getId());
|
||||
scenario.setResourceId(UUID.randomUUID().toString());
|
||||
|
@ -397,6 +402,7 @@ public class HistoricalDataUpgradeService {
|
|||
MsScenario scenarioTest = createScenarioByTest(test);
|
||||
LinkedList<MsTestElement> listSteps = new LinkedList<>();
|
||||
List<Scenario> scenarios = JSON.parseArray(test.getScenarioDefinition(), Scenario.class);
|
||||
String envId = null;
|
||||
if (CollectionUtils.isNotEmpty(scenarios)) {
|
||||
// 批量处理
|
||||
for (Scenario scenario : scenarios) {
|
||||
|
@ -405,7 +411,7 @@ public class HistoricalDataUpgradeService {
|
|||
}
|
||||
scenario.setId(test.getId() + "=" + scenario.getId());
|
||||
scenario.setName(test.getName() + "_" + scenario.getName());
|
||||
MsScenario scenario1 = createScenario(scenario);
|
||||
MsScenario scenario1 = createScenario(scenario, saveHistoricalDataUpgrade.getProjectId());
|
||||
String scenarioDefinition = JSON.toJSONString(scenario1);
|
||||
num++;
|
||||
createApiScenarioWithBLOBs(saveHistoricalDataUpgrade, scenario.getId(), scenario.getName(), scenario.getRequests().size(), scenarioDefinition, mapper, num);
|
||||
|
@ -417,10 +423,20 @@ public class HistoricalDataUpgradeService {
|
|||
step.setResourceId(UUID.randomUUID().toString());
|
||||
step.setReferenced("REF");
|
||||
listSteps.add(step);
|
||||
if (StringUtils.isNotEmpty(scenario.getEnvironmentId())) {
|
||||
envId = scenario.getEnvironmentId();
|
||||
}
|
||||
}
|
||||
}
|
||||
num++;
|
||||
scenarioTest.setHashTree(listSteps);
|
||||
if (StringUtils.isNotEmpty(envId)) {
|
||||
HashMap<String, String> envMap = new HashMap<>();
|
||||
envMap.put(saveHistoricalDataUpgrade.getProjectId(), envId);
|
||||
scenarioTest.setEnvironmentMap(envMap);
|
||||
scenarioTest.setEnvironmentId(envId);
|
||||
}
|
||||
|
||||
String scenarioDefinition = JSON.toJSONString(scenarioTest);
|
||||
createApiScenarioWithBLOBs(saveHistoricalDataUpgrade, scenarioTest.getId(), scenarioTest.getName(), listSteps.size(), scenarioDefinition, mapper, num);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package io.metersphere.base.mapper.ext;
|
|||
import io.metersphere.api.dto.QueryAPIReportRequest;
|
||||
import io.metersphere.api.dto.automation.APIScenarioReportResult;
|
||||
import io.metersphere.api.dto.datacount.ApiDataCountResult;
|
||||
import io.metersphere.base.domain.ApiDefinitionExecResult;
|
||||
import io.metersphere.base.domain.ApiScenarioReport;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
@ -23,4 +24,7 @@ public interface ExtApiScenarioReportMapper {
|
|||
List<ApiDataCountResult> countByProjectIdGroupByExecuteResult(String projectId);
|
||||
|
||||
List<ApiScenarioReport> selectLastReportByIds(@Param("scenarioIdList") List<String> ids);
|
||||
|
||||
ApiScenarioReport selectPreviousReportByScenarioId(@Param("scenarioId") String scenarioId, @Param("nowId") String nowId);
|
||||
|
||||
}
|
|
@ -216,4 +216,9 @@
|
|||
) orderData ON orderData.id = report.id;
|
||||
</select>
|
||||
|
||||
<select id="selectPreviousReportByScenarioId" resultType="io.metersphere.base.domain.ApiScenarioReport">
|
||||
select * from api_scenario_report
|
||||
WHERE execute_type in ("Completed","Debug") and scenario_id=#{scenarioId} and id != #{nowId} ORDER BY create_time desc LIMIT 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -409,7 +409,7 @@ public class TestPlanService {
|
|||
|| StringUtils.equals(res, "success")
|
||||
|| StringUtils.equals(res, ScenarioStatus.Success.name())) {
|
||||
passNum++;
|
||||
} else if (res == null) {
|
||||
} else if (res == null || StringUtils.equals(TestPlanStatus.Prepare.name(), res)) {
|
||||
prepareNum++;
|
||||
} else {
|
||||
failNum++;
|
||||
|
|
|
@ -114,9 +114,7 @@
|
|||
</el-col>
|
||||
<el-col :span="6">
|
||||
<env-popover :env-map="projectEnvMap" :project-ids="projectIds" @setProjectEnvMap="setProjectEnvMap"
|
||||
:project-list="projectList" ref="envPopover"
|
||||
:disabled="scenarioDefinition.length < 1"
|
||||
:is-read-only="scenarioDefinition.length < 1"/>
|
||||
:project-list="projectList" ref="envPopover"/>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<el-button :disabled="scenarioDefinition.length < 1" size="mini" type="primary" v-prevent-re-click @click="runDebug">{{$t('api_test.request.debug')}}</el-button>
|
||||
|
@ -202,10 +200,7 @@
|
|||
</template>
|
||||
|
||||
<maximize-scenario :scenario-definition="scenarioDefinition" :envMap="projectEnvMap" :moduleOptions="moduleOptions"
|
||||
:currentScenario="currentScenario" :type="type" ref="maximizeScenario" @openScenario="openScenario"
|
||||
:isHaveExec.sync="isHaveExec" :isExecWithOutEnv.sync="isExecWithOutEnv" :projectList="projectList"
|
||||
:projectIds.sync="projectIds"
|
||||
/>
|
||||
:currentScenario="currentScenario" :type="type" ref="maximizeScenario" @openScenario="openScenario"/>
|
||||
</ms-drawer>
|
||||
|
||||
</div>
|
||||
|
@ -320,8 +315,6 @@
|
|||
projectList: [],
|
||||
debugResult: new Map,
|
||||
drawer: false,
|
||||
isHaveExec: false,
|
||||
isExecWithOutEnv: true
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
@ -596,25 +589,9 @@
|
|||
if (arr[i].type === ELEMENT_TYPE.LoopController && arr[i].loopType === "LOOP_COUNT" && arr[i].hashTree && arr[i].hashTree.length > 1) {
|
||||
arr[i].countController.proceed = true;
|
||||
}
|
||||
|
||||
let type = arr[i].type;
|
||||
const canExec = this.checkCanExec(type);
|
||||
if (!this.isHaveExec) {
|
||||
// 判断此步骤是否可执行
|
||||
this.isHaveExec = canExec;
|
||||
}
|
||||
if (canExec) {
|
||||
const execWithOutEnv = this.canExecWithOutEnv(type, arr[i].url);
|
||||
if (!execWithOutEnv) {
|
||||
if (!arr[i].projectId) {
|
||||
// 如果自身没有ID并且场景有ID则赋值场景ID,否则赋值当前项目ID
|
||||
arr[i].projectId = scenarioProjectId ? scenarioProjectId : this.projectId;
|
||||
}
|
||||
this.projectIds.add(arr[i].projectId);
|
||||
}
|
||||
}
|
||||
if (this.isExecWithOutEnv) {
|
||||
this.isExecWithOutEnv = this.canExecWithOutEnv(type, arr[i].url)
|
||||
if (!arr[i].projectId) {
|
||||
// 如果自身没有ID并且场景有ID则赋值场景ID,否则赋值当前项目ID
|
||||
arr[i].projectId = scenarioProjectId ? scenarioProjectId : this.projectId;
|
||||
}
|
||||
|
||||
if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) {
|
||||
|
@ -626,24 +603,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
canExecWithOutEnv(type, path) {
|
||||
if (type === ELEMENT_TYPE.HTTPSamplerProxy) {
|
||||
return this.isHTTPFullPath(path);
|
||||
}
|
||||
return type === ELEMENT_TYPE.JSR223Processor ? true : !this.checkCanExec(type);
|
||||
},
|
||||
isHTTPFullPath(path) {
|
||||
return path ? path.startsWith("http://") || path.startsWith("https://") : false;
|
||||
},
|
||||
checkCanExec(type) {
|
||||
const allCanExecType = ELEMENTS.get("AllCanExecType");
|
||||
const index = allCanExecType.indexOf(type);
|
||||
return index !== -1;
|
||||
},
|
||||
sort() {
|
||||
this.projectIds.clear();
|
||||
this.isHaveExec = false;
|
||||
this.isExecWithOutEnv = true;
|
||||
for (let i in this.scenarioDefinition) {
|
||||
// 排序
|
||||
this.scenarioDefinition[i].index = Number(i) + 1;
|
||||
|
@ -657,22 +617,6 @@
|
|||
this.scenarioDefinition[i].projectId = this.projectId;
|
||||
}
|
||||
|
||||
let type = this.scenarioDefinition[i].type;
|
||||
const canExec = this.checkCanExec(type);
|
||||
if (!this.isHaveExec) {
|
||||
// 判断此步骤是否可执行
|
||||
this.isHaveExec = canExec;
|
||||
}
|
||||
if (canExec) {
|
||||
const execWithOutEnv = this.canExecWithOutEnv(type, this.scenarioDefinition[i].url);
|
||||
if (!execWithOutEnv) {
|
||||
this.projectIds.add(this.scenarioDefinition[i].projectId);
|
||||
}
|
||||
}
|
||||
if (this.isExecWithOutEnv) {
|
||||
this.isExecWithOutEnv = this.canExecWithOutEnv(type, this.scenarioDefinition[i].url)
|
||||
}
|
||||
|
||||
if (this.scenarioDefinition[i].hashTree != undefined && this.scenarioDefinition[i].hashTree.length > 0) {
|
||||
this.recursiveSorting(this.scenarioDefinition[i].hashTree, this.scenarioDefinition[i].projectId);
|
||||
}
|
||||
|
@ -693,6 +637,7 @@
|
|||
this.customizeRequest = {};
|
||||
this.sort();
|
||||
this.reload();
|
||||
this.initProjectIds();
|
||||
},
|
||||
addScenario(arr) {
|
||||
if (arr && arr.length > 0) {
|
||||
|
@ -715,6 +660,7 @@
|
|||
this.isBtnHide = false;
|
||||
this.sort();
|
||||
this.reload();
|
||||
this.initProjectIds();
|
||||
},
|
||||
setApiParameter(item, refType, referenced) {
|
||||
let request = {};
|
||||
|
@ -756,6 +702,7 @@
|
|||
this.isBtnHide = false;
|
||||
this.sort();
|
||||
this.reload();
|
||||
this.initProjectIds();
|
||||
},
|
||||
getMaintainerOptions() {
|
||||
let workspaceId = localStorage.getItem(WORKSPACE_ID);
|
||||
|
@ -782,6 +729,7 @@
|
|||
hashTree.splice(index, 1);
|
||||
this.sort();
|
||||
this.reload();
|
||||
this.initProjectIds();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -812,19 +760,11 @@
|
|||
},
|
||||
runDebug() {
|
||||
/*触发执行操作*/
|
||||
if (!this.isHaveExec) {
|
||||
this.$warning("无可执行步骤!");
|
||||
let sign = this.$refs.envPopover.checkEnv();
|
||||
if (!sign) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 运行时是否需要检查环境
|
||||
if (!this.isExecWithOutEnv) {
|
||||
let sign = this.$refs.envPopover.checkEnv();
|
||||
if (!sign) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.$refs['currentScenario'].validate((valid) => {
|
||||
if (valid) {
|
||||
Promise.all([
|
||||
|
@ -1063,6 +1003,7 @@
|
|||
}
|
||||
}
|
||||
this.sort();
|
||||
this.initProjectIds();
|
||||
// this.getEnvironments();
|
||||
})
|
||||
}
|
||||
|
@ -1132,8 +1073,19 @@
|
|||
})
|
||||
},
|
||||
refReload() {
|
||||
this.initProjectIds();
|
||||
this.reload();
|
||||
},
|
||||
initProjectIds() {
|
||||
// 加载环境配置
|
||||
this.$nextTick(() => {
|
||||
this.projectIds.clear();
|
||||
this.scenarioDefinition.forEach(data => {
|
||||
let arr = jsonPath.query(data, "$..projectId");
|
||||
arr.forEach(a => this.projectIds.add(a));
|
||||
})
|
||||
})
|
||||
},
|
||||
detailRefresh(result) {
|
||||
// 把执行结果分发给各个请求
|
||||
this.debugResult = result;
|
||||
|
|
|
@ -101,25 +101,25 @@ export default {
|
|||
|
||||
let requestObj = JSON.parse(item.request);
|
||||
if(requestObj.esbDataStruct != null ){
|
||||
//ESB接口
|
||||
let param = {};
|
||||
param.request = requestObj;
|
||||
param.method = "ESB";
|
||||
param.esbDataStruct = JSON.stringify(requestObj.esbDataStruct);
|
||||
if(requestObj.backEsbDataStruct != null){
|
||||
param.backEsbDataStruct = JSON.stringify(requestObj.backEsbDataStruct);
|
||||
}else{
|
||||
param.backEsbDataStruct = "";
|
||||
}
|
||||
// //ESB接口
|
||||
// let param = {};
|
||||
// param.request = requestObj;
|
||||
// param.method = "ESB";
|
||||
// param.esbDataStruct = JSON.stringify(requestObj.esbDataStruct);
|
||||
// if(requestObj.backEsbDataStruct != null){
|
||||
// param.backEsbDataStruct = JSON.stringify(requestObj.backEsbDataStruct);
|
||||
// }else{
|
||||
// param.backEsbDataStruct = "";
|
||||
// }
|
||||
|
||||
this.$post("/api/definition/updateEsbRequest", param, response => {
|
||||
if(response.data!=null){
|
||||
if(response.data.request!=null){
|
||||
item.request = JSON.stringify(response.data.request);
|
||||
param.method = "TCP";
|
||||
}
|
||||
}
|
||||
})
|
||||
// this.$post("/api/definition/updateEsbRequest", param, response => {
|
||||
// if(response.data!=null){
|
||||
// if(response.data.request!=null){
|
||||
// item.request = JSON.stringify(response.data.request);
|
||||
// param.method = "TCP";
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
}
|
||||
});
|
||||
this.$emit('save', apiCases, 'CASE', reference);
|
||||
|
|
|
@ -50,39 +50,41 @@
|
|||
</div>
|
||||
</ms-aside-container>
|
||||
|
||||
<ms-main-container v-if="!loading">
|
||||
<!-- 第一层当前节点内容-->
|
||||
<ms-component-config
|
||||
:isMax="false"
|
||||
:showBtn="false"
|
||||
:type="selectedTreeNode.type"
|
||||
:scenario="selectedTreeNode"
|
||||
:response="response"
|
||||
:currentScenario="currentScenario"
|
||||
:currentEnvironmentId="currentEnvironmentId"
|
||||
:node="selectedNode"
|
||||
:project-list="projectList"
|
||||
:env-map="projectEnvMap"
|
||||
:draggable="false"
|
||||
@remove="remove" @copyRow="copyRow" @suggestClick="suggestClick" @refReload="refReload" @openScenario="openScenario"
|
||||
v-if="selectedTreeNode && selectedNode"/>
|
||||
<!-- 请求下还有的子步骤-->
|
||||
<div v-if="selectedTreeNode && selectedTreeNode.hashTree && showNode(selectedTreeNode)">
|
||||
<div v-for="item in selectedTreeNode.hashTree" :key="item.id" class="ms-col-one">
|
||||
<ms-component-config
|
||||
:showBtn="false"
|
||||
:isMax="false"
|
||||
:type="item.type"
|
||||
:scenario="item"
|
||||
:response="response"
|
||||
:currentScenario="currentScenario"
|
||||
:currentEnvironmentId="currentEnvironmentId"
|
||||
:project-list="projectList"
|
||||
:env-map="projectEnvMap"
|
||||
:draggable="false"
|
||||
@remove="remove" @copyRow="copyRow" @suggestClick="suggestClick"
|
||||
@refReload="refReload" @openScenario="openScenario"
|
||||
v-if="selectedTreeNode && selectedNode"/>
|
||||
<ms-main-container v-loading="loading">
|
||||
<div v-if="!loading">
|
||||
<!-- 第一层当前节点内容-->
|
||||
<ms-component-config
|
||||
:isMax="false"
|
||||
:showBtn="false"
|
||||
:type="selectedTreeNode.type"
|
||||
:scenario="selectedTreeNode"
|
||||
:response="response"
|
||||
:currentScenario="currentScenario"
|
||||
:currentEnvironmentId="currentEnvironmentId"
|
||||
:node="selectedNode"
|
||||
:project-list="projectList"
|
||||
:env-map="projectEnvMap"
|
||||
:draggable="false"
|
||||
@remove="remove" @copyRow="copyRow" @suggestClick="suggestClick" @refReload="refReload" @openScenario="openScenario"
|
||||
v-if="selectedTreeNode && selectedNode"/>
|
||||
<!-- 请求下还有的子步骤-->
|
||||
<div v-if="selectedTreeNode && selectedTreeNode.hashTree && showNode(selectedTreeNode)">
|
||||
<div v-for="item in selectedTreeNode.hashTree" :key="item.id" class="ms-col-one">
|
||||
<ms-component-config
|
||||
:showBtn="false"
|
||||
:isMax="false"
|
||||
:type="item.type"
|
||||
:scenario="item"
|
||||
:response="response"
|
||||
:currentScenario="currentScenario"
|
||||
:currentEnvironmentId="currentEnvironmentId"
|
||||
:project-list="projectList"
|
||||
:env-map="projectEnvMap"
|
||||
:draggable="false"
|
||||
@remove="remove" @copyRow="copyRow" @suggestClick="suggestClick"
|
||||
@refReload="refReload" @openScenario="openScenario"
|
||||
v-if="selectedTreeNode && selectedNode"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ms-main-container>
|
||||
|
@ -162,7 +164,6 @@
|
|||
type: String,
|
||||
scenarioDefinition: Array,
|
||||
envMap: Map,
|
||||
projectList: Array
|
||||
},
|
||||
components: {
|
||||
MsVariableList,
|
||||
|
@ -223,10 +224,8 @@
|
|||
response: {},
|
||||
projectIds: new Set,
|
||||
projectEnvMap: new Map,
|
||||
// projectList: [],
|
||||
projectList: [],
|
||||
debugResult: new Map,
|
||||
isHaveExec: false,
|
||||
isExecWithOutEnv: true
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
@ -477,6 +476,7 @@
|
|||
}
|
||||
this.selectedTreeNode = data;
|
||||
this.selectedNode = node;
|
||||
this.reload();
|
||||
},
|
||||
suggestClick(node) {
|
||||
this.response = {};
|
||||
|
@ -499,27 +499,8 @@
|
|||
if (arr[i].type === ELEMENT_TYPE.LoopController && arr[i].loopType === "LOOP_COUNT" && arr[i].hashTree && arr[i].hashTree.length > 1) {
|
||||
arr[i].countController.proceed = true;
|
||||
}
|
||||
let type = arr[i].type;
|
||||
const canExec = this.checkCanExec(type);
|
||||
if (!this.isHaveExec) {
|
||||
// 判断此步骤是否可执行
|
||||
this.isHaveExec = canExec;
|
||||
this.$emit("update:isHaveExec", canExec);
|
||||
}
|
||||
if (canExec) {
|
||||
const execWithOutEnv = this.canExecWithOutEnv(type, arr[i].url);
|
||||
if (!execWithOutEnv) {
|
||||
if (!arr[i].projectId) {
|
||||
// 如果自身没有ID并且场景有ID则赋值场景ID,否则赋值当前项目ID
|
||||
arr[i].projectId = scenarioProjectId ? scenarioProjectId : this.projectId;
|
||||
}
|
||||
this.projectIds.add(arr[i].projectId);
|
||||
this.$emit('update:projectIds', this.projectIds);
|
||||
}
|
||||
}
|
||||
if (this.isExecWithOutEnv) {
|
||||
this.isExecWithOutEnv = this.canExecWithOutEnv(type, arr[i].url);
|
||||
this.$emit('update:isExecWithOutEnv', this.canExecWithOutEnv(type, arr[i].url))
|
||||
if (!arr[i].projectId) {
|
||||
arr[i].projectId = scenarioProjectId ? scenarioProjectId : this.projectId;
|
||||
}
|
||||
if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) {
|
||||
this.recursiveSorting(arr[i].hashTree, arr[i].projectId);
|
||||
|
@ -530,27 +511,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
canExecWithOutEnv(type, path) {
|
||||
if (type === ELEMENT_TYPE.HTTPSamplerProxy) {
|
||||
return this.isHTTPFullPath(path);
|
||||
}
|
||||
return type === ELEMENT_TYPE.JSR223Processor ? true : !this.checkCanExec(type);
|
||||
},
|
||||
isHTTPFullPath(path) {
|
||||
return path ? path.startsWith("http://") || path.startsWith("https://") : false;
|
||||
},
|
||||
checkCanExec(type) {
|
||||
const allCanExecType = ELEMENTS.get("AllCanExecType");
|
||||
const index = allCanExecType.indexOf(type);
|
||||
return index !== -1;
|
||||
},
|
||||
sort() {
|
||||
this.projectIds.clear();
|
||||
this.$emit('update:projectIds', this.projectIds);
|
||||
this.isHaveExec = false;
|
||||
this.isExecWithOutEnv = true;
|
||||
this.$emit('update:isHaveExec', false);
|
||||
this.$emit('update:isExecWithOutEnv', true);
|
||||
for (let i in this.scenarioDefinition) {
|
||||
// 排序
|
||||
this.scenarioDefinition[i].index = Number(i) + 1;
|
||||
|
@ -564,25 +525,6 @@
|
|||
this.scenarioDefinition[i].projectId = this.projectId;
|
||||
}
|
||||
|
||||
let type = this.scenarioDefinition[i].type;
|
||||
const canExec = this.checkCanExec(type);
|
||||
if (!this.isHaveExec) {
|
||||
// 判断此步骤是否可执行
|
||||
this.isHaveExec = canExec;
|
||||
this.$emit('update:isHaveExec', canExec);
|
||||
}
|
||||
if (canExec) {
|
||||
const execWithOutEnv = this.canExecWithOutEnv(type, this.scenarioDefinition[i].url);
|
||||
if (!execWithOutEnv) {
|
||||
this.projectIds.add(this.scenarioDefinition[i].projectId);
|
||||
this.$emit('update:projectIds', this.projectIds);
|
||||
}
|
||||
}
|
||||
if (this.isExecWithOutEnv) {
|
||||
this.isExecWithOutEnv = this.canExecWithOutEnv(type, this.scenarioDefinition[i].url);
|
||||
this.$emit('update:isExecWithOutEnv', this.canExecWithOutEnv(type, this.scenarioDefinition[i].url));
|
||||
}
|
||||
|
||||
if (this.scenarioDefinition[i].hashTree != undefined && this.scenarioDefinition[i].hashTree.length > 0) {
|
||||
this.recursiveSorting(this.scenarioDefinition[i].hashTree, this.scenarioDefinition[i].projectId);
|
||||
}
|
||||
|
@ -603,6 +545,7 @@
|
|||
this.customizeRequest = {};
|
||||
this.sort();
|
||||
this.reload();
|
||||
this.initProjectIds();
|
||||
},
|
||||
addScenario(arr) {
|
||||
if (arr && arr.length > 0) {
|
||||
|
@ -620,6 +563,7 @@
|
|||
}
|
||||
this.sort();
|
||||
this.reload();
|
||||
this.initProjectIds();
|
||||
this.scenarioVisible = false;
|
||||
},
|
||||
setApiParameter(item, refType, referenced) {
|
||||
|
@ -661,6 +605,7 @@
|
|||
});
|
||||
this.sort();
|
||||
this.reload();
|
||||
this.initProjectIds();
|
||||
},
|
||||
openTagConfig() {
|
||||
if (!this.projectId) {
|
||||
|
@ -681,6 +626,7 @@
|
|||
hashTree.splice(index, 1);
|
||||
this.sort();
|
||||
this.reload();
|
||||
this.initProjectIds();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -977,8 +923,19 @@
|
|||
refReload(data, node) {
|
||||
this.selectedTreeNode = data;
|
||||
this.selectedNode = node;
|
||||
this.initProjectIds();
|
||||
this.reload();
|
||||
},
|
||||
initProjectIds() {
|
||||
// 加载环境配置
|
||||
this.$nextTick(() => {
|
||||
this.projectIds.clear();
|
||||
this.scenarioDefinition.forEach(data => {
|
||||
let arr = jsonPath.query(data, "$..projectId");
|
||||
arr.forEach(a => this.projectIds.add(a));
|
||||
})
|
||||
})
|
||||
},
|
||||
detailRefresh(result) {
|
||||
// 把执行结果分发给各个请求
|
||||
this.debugResult = result;
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
<el-checkbox v-model="cookieShare" @change="setCookieShare" style="margin-right: 20px">共享cookie</el-checkbox>
|
||||
|
||||
<env-popover :env-map="envMap" :project-ids="projectIds" @setProjectEnvMap="setProjectEnvMap"
|
||||
:disabled="scenarioDefinition.length < 1"
|
||||
:is-read-only="scenarioDefinition.length < 1"
|
||||
:project-list="projectList" ref="envPopover" class="ms-right"/>
|
||||
|
||||
<el-button :disabled="scenarioDefinition.length < 1" size="mini" type="primary" v-prevent-re-click @click="runDebug">{{$t('api_test.request.debug')}}</el-button>
|
||||
|
|
|
@ -68,8 +68,8 @@
|
|||
|
||||
let projectId = "";
|
||||
// 如果envMap不存在,是单接口调用
|
||||
if (!this.envMap) {
|
||||
projectId = getCurrentProjectID();
|
||||
if (!this.envMap || this.envMap.size === 0) {
|
||||
projectId = this.$store.state.projectId;
|
||||
} else {
|
||||
// 场景步骤下接口调用
|
||||
projectId = this.runData.projectId;
|
||||
|
|
|
@ -178,6 +178,10 @@
|
|||
<div v-else-if="apiInfo.requestBodyParamType == 'JSON-SCHEMA'" style="margin-left: 10px">
|
||||
<ms-json-code-edit :body="apiInfo.jsonSchemaBody" ref="jsonCodeEdit"/>
|
||||
</div>
|
||||
<!-- <div v-else-if="apiInfo.requestBodyParamType == 'XML'" style="margin-left: 10px">-->
|
||||
<!-- <ms-json-code-edit :body="apiInfo.jsonSchemaBody" ref="jsonCodeEdit"/>-->
|
||||
<!-- <editor v-model="formatData" :lang="mode" @init="editorInit" :theme="theme" :height="height"/>-->
|
||||
<!-- </div>-->
|
||||
<div v-else class="showDataDiv">
|
||||
<br/>
|
||||
<p style="margin: 0px 20px;"
|
||||
|
@ -423,7 +427,12 @@ export default {
|
|||
formatRowData(dataType, data) {
|
||||
var returnData = data;
|
||||
if (data) {
|
||||
returnData = data.replace(/\n/g, '<br>');
|
||||
|
||||
if(dataType === 'XML'){
|
||||
returnData = "<xmp>"+returnData+"</xmp>";
|
||||
}else{
|
||||
returnData = data.replace(/\n/g, '<br>');
|
||||
}
|
||||
}
|
||||
return returnData;
|
||||
},
|
||||
|
|
|
@ -52,6 +52,10 @@ export default {
|
|||
this.defaultCheckedKeys.push(i.id)
|
||||
}
|
||||
)
|
||||
if(this.type==='api_list'||this.type==='api_case_list'||this.type==='api_scenario_list'||this.type==='test_plan_function_test_case'
|
||||
||this.type==='test_plan_api_case'||this.type==='test_plan_load_case'||this.type==='test_plan_scenario_case'){
|
||||
this.fieldSelected=items
|
||||
}
|
||||
},
|
||||
saveHeader() {
|
||||
let param = {
|
||||
|
|
|
@ -81,7 +81,6 @@ export const Test_Case_Review_Case_List = [
|
|||
{id: 'name', label: i18n.t('commons.name')},
|
||||
{id: 'priority', label: i18n.t('test_track.case.priority')},
|
||||
{id: 'type', label: i18n.t('test_track.case.type')},
|
||||
{id: 'method', label: i18n.t('test_track.case.method')},
|
||||
{id: 'nodePath', label: i18n.t('test_track.case.module')},
|
||||
{id: 'projectName', label: i18n.t('test_track.review.review_project')},
|
||||
{id: 'reviewerName', label: i18n.t('test_track.review.reviewer')},
|
||||
|
@ -107,7 +106,7 @@ export const Test_Plan_Function_Test_Case = [
|
|||
//测试计划-api用例
|
||||
export const Test_Plan_Api_Case = [
|
||||
{id: 'num', label: i18n.t('commons.id')},
|
||||
{id: 'name', label: i18n.t('commons.name')},
|
||||
{id: 'name', label: i18n.t('api_test.definition.api_name')},
|
||||
{id: 'priority', label: i18n.t('test_track.case.priority')},
|
||||
{id: 'path', label: i18n.t('api_test.definition.api_path')},
|
||||
{id: 'createUser', label: '创建人'},
|
||||
|
@ -124,12 +123,12 @@ export const Test_Plan_Load_Case = [
|
|||
{id: 'createTime', label: i18n.t('commons.create_time')},
|
||||
{id: 'status', label: i18n.t('commons.status')},
|
||||
{id: 'caseStatus', label: i18n.t('test_track.plan.load_case.execution_status')},
|
||||
{id: 'loadReportId', label: i18n.t('test_track.plan.load_case.view_report')},
|
||||
{id: 'loadReportId', label: i18n.t('test_track.plan.load_case.report')},
|
||||
]
|
||||
//测试计划-场景用例
|
||||
export const Test_Plan_Scenario_Case = [
|
||||
{id: 'num', label: i18n.t('commons.id')},
|
||||
{id: 'name', label: i18n.t('commons.name')},
|
||||
{id: 'name', label: i18n.t('api_test.automation.scenario_name')},
|
||||
{id: 'level', label: i18n.t('api_test.automation.case_level')},
|
||||
{id: 'tagNames', label: i18n.t('api_test.automation.tag')},
|
||||
{id: 'userId', label: i18n.t('api_test.automation.creator')},
|
||||
|
|
|
@ -157,7 +157,7 @@ export default {
|
|||
for (let i = 0; i < rows.length; i++) {
|
||||
let row = rows[i];
|
||||
if (this.tableData.filter(f => f.name === row.name).length > 0) {
|
||||
this.$error(this.$t('load_test.delete_file'));
|
||||
this.$error(this.$t('load_test.delete_file') + ', name: ' + row.name);
|
||||
this.selectIds.clear();
|
||||
return;
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ export default {
|
|||
}
|
||||
|
||||
if (this.tableData.filter(f => f.name === file.name).length > 0) {
|
||||
this.$error(this.$t('load_test.delete_file'));
|
||||
this.$error(this.$t('load_test.delete_file') + ', name: ' + file.name);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
|
|
@ -121,7 +121,7 @@ export default {
|
|||
for (let i = 0; i < rows.length; i++) {
|
||||
let row = rows[i];
|
||||
if (this.tableData.filter(f => f.name === row.name + ".jmx").length > 0) {
|
||||
this.$error(this.$t('load_test.delete_file'));
|
||||
this.$error(this.$t('load_test.delete_file') + ', name: ' + row.name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,6 +118,7 @@
|
|||
<el-input-number
|
||||
:disabled="isReadOnly"
|
||||
:min="1"
|
||||
:max="threadGroup.duration"
|
||||
v-model="threadGroup.rampUpTime"
|
||||
@change="calculateTotalChart(threadGroup)"
|
||||
size="mini"/>
|
||||
|
|
|
@ -309,7 +309,7 @@ export default {
|
|||
sysList: [],//一级选择框的数据
|
||||
options: REVIEW_STATUS,
|
||||
statuOptions: API_STATUS,
|
||||
comments: [],
|
||||
comments: [],
|
||||
result: {},
|
||||
dialogFormVisible: false,
|
||||
form: {
|
||||
|
@ -406,6 +406,7 @@ export default {
|
|||
this.getSelectOptions();
|
||||
if (this.type === 'edit' || this.type === 'copy') {
|
||||
this.open(this.currentTestCaseInfo)
|
||||
this.getComments(this.currentTestCaseInfo)
|
||||
}
|
||||
// Cascader 级联选择器: 点击文本就让它自动点击前面的input就可以触发选择。
|
||||
setInterval(function () {
|
||||
|
@ -431,6 +432,7 @@ export default {
|
|||
created() {
|
||||
this.loadOptions();
|
||||
this.addListener(); // 添加 ctrl s 监听
|
||||
|
||||
},
|
||||
methods: {
|
||||
setModule(id,data) {
|
||||
|
@ -921,7 +923,7 @@ export default {
|
|||
}
|
||||
|
||||
if (this.tableData.filter(f => f.name === file.name).length > 0) {
|
||||
this.$error(this.$t('load_test.delete_file'));
|
||||
this.$error(this.$t('load_test.delete_file') + ', name: ' + file.name);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<el-table-column v-if="!isReadOnly" :label="$t('commons.operating')" align="center">
|
||||
<el-table-column v-if="!isReadOnly" :label="$t('commons.operating')" >
|
||||
<template slot="header">
|
||||
<header-label-operate @exec="customHeader"/>
|
||||
</template>
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<el-table-column v-if="!isReadOnly" :label="$t('commons.operating')" align="center">
|
||||
<el-table-column v-if="!isReadOnly" :label="$t('commons.operating')" >
|
||||
<template slot="header">
|
||||
<header-label-operate @exec="customHeader"/>
|
||||
</template>
|
||||
|
|
Loading…
Reference in New Issue