Merge branch 'master' of https://github.com/metersphere/metersphere
This commit is contained in:
commit
529a8b74ac
|
@ -9,25 +9,37 @@ import io.metersphere.api.dto.datacount.request.ScheduleInfoRequest;
|
||||||
import io.metersphere.api.dto.datacount.response.ApiDataCountDTO;
|
import io.metersphere.api.dto.datacount.response.ApiDataCountDTO;
|
||||||
import io.metersphere.api.dto.datacount.response.ExecutedCaseInfoDTO;
|
import io.metersphere.api.dto.datacount.response.ExecutedCaseInfoDTO;
|
||||||
import io.metersphere.api.dto.datacount.response.TaskInfoResult;
|
import io.metersphere.api.dto.datacount.response.TaskInfoResult;
|
||||||
|
import io.metersphere.api.dto.definition.RunDefinitionRequest;
|
||||||
|
import io.metersphere.api.dto.definition.request.MsTestElement;
|
||||||
import io.metersphere.api.dto.scenario.request.dubbo.RegistryCenter;
|
import io.metersphere.api.dto.scenario.request.dubbo.RegistryCenter;
|
||||||
import io.metersphere.api.service.*;
|
import io.metersphere.api.service.*;
|
||||||
import io.metersphere.base.domain.ApiTest;
|
import io.metersphere.base.domain.ApiTest;
|
||||||
|
import io.metersphere.base.domain.LoadTest;
|
||||||
import io.metersphere.base.domain.Schedule;
|
import io.metersphere.base.domain.Schedule;
|
||||||
|
import io.metersphere.commons.constants.PerformanceTestStatus;
|
||||||
import io.metersphere.commons.constants.RoleConstants;
|
import io.metersphere.commons.constants.RoleConstants;
|
||||||
|
import io.metersphere.commons.constants.ScheduleGroup;
|
||||||
import io.metersphere.commons.utils.CronUtils;
|
import io.metersphere.commons.utils.CronUtils;
|
||||||
import io.metersphere.commons.utils.PageUtils;
|
import io.metersphere.commons.utils.PageUtils;
|
||||||
import io.metersphere.commons.utils.Pager;
|
import io.metersphere.commons.utils.Pager;
|
||||||
import io.metersphere.commons.utils.SessionUtils;
|
import io.metersphere.commons.utils.SessionUtils;
|
||||||
import io.metersphere.controller.request.QueryScheduleRequest;
|
import io.metersphere.controller.request.QueryScheduleRequest;
|
||||||
import io.metersphere.dto.ScheduleDao;
|
import io.metersphere.dto.ScheduleDao;
|
||||||
|
import io.metersphere.performance.service.PerformanceTestService;
|
||||||
import io.metersphere.service.CheckPermissionService;
|
import io.metersphere.service.CheckPermissionService;
|
||||||
|
import io.metersphere.service.FileService;
|
||||||
import io.metersphere.service.ScheduleService;
|
import io.metersphere.service.ScheduleService;
|
||||||
|
import io.metersphere.track.request.testplan.SaveTestPlanRequest;
|
||||||
|
import org.apache.http.entity.ContentType;
|
||||||
|
import org.apache.jorphan.collections.HashTree;
|
||||||
import org.apache.shiro.authz.annotation.Logical;
|
import org.apache.shiro.authz.annotation.Logical;
|
||||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -58,6 +70,12 @@ public class APITestController {
|
||||||
@Resource
|
@Resource
|
||||||
private ScheduleService scheduleService;
|
private ScheduleService scheduleService;
|
||||||
@Resource
|
@Resource
|
||||||
|
private APIReportService apiReportService;
|
||||||
|
@Resource
|
||||||
|
private PerformanceTestService performanceTestService;
|
||||||
|
@Resource
|
||||||
|
private CheckPermissionService checkPermissionService;
|
||||||
|
@Resource
|
||||||
private HistoricalDataUpgradeService historicalDataUpgradeService;
|
private HistoricalDataUpgradeService historicalDataUpgradeService;
|
||||||
|
|
||||||
@GetMapping("recent/{count}")
|
@GetMapping("recent/{count}")
|
||||||
|
@ -108,6 +126,7 @@ public class APITestController {
|
||||||
public void mergeCreate(@RequestPart("request") SaveAPITestRequest request, @RequestPart(value = "file") MultipartFile file, @RequestPart(value = "selectIds") List<String> selectIds) {
|
public void mergeCreate(@RequestPart("request") SaveAPITestRequest request, @RequestPart(value = "file") MultipartFile file, @RequestPart(value = "selectIds") List<String> selectIds) {
|
||||||
apiTestService.mergeCreate(request, file, selectIds);
|
apiTestService.mergeCreate(request, file, selectIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "/update", consumes = {"multipart/form-data"})
|
@PostMapping(value = "/update", consumes = {"multipart/form-data"})
|
||||||
public void update(@RequestPart("request") SaveAPITestRequest request, @RequestPart(value = "file") MultipartFile file, @RequestPart(value = "files") List<MultipartFile> bodyFiles) {
|
public void update(@RequestPart("request") SaveAPITestRequest request, @RequestPart(value = "file") MultipartFile file, @RequestPart(value = "files") List<MultipartFile> bodyFiles) {
|
||||||
checkownerService.checkApiTestOwner(request.getId());
|
checkownerService.checkApiTestOwner(request.getId());
|
||||||
|
@ -262,15 +281,15 @@ public class APITestController {
|
||||||
List<ApiDataCountResult> countResultByRunResult = apiAutomationService.countRunResultByProjectID(projectId);
|
List<ApiDataCountResult> countResultByRunResult = apiAutomationService.countRunResultByProjectID(projectId);
|
||||||
apiCountResult.countRunResult(countResultByRunResult);
|
apiCountResult.countRunResult(countResultByRunResult);
|
||||||
|
|
||||||
long allCount = apiCountResult.getUnexecuteCount()+apiCountResult.getExecutionPassCount()+apiCountResult.getExecutionFailedCount();
|
long allCount = apiCountResult.getUnexecuteCount() + apiCountResult.getExecutionPassCount() + apiCountResult.getExecutionFailedCount();
|
||||||
|
|
||||||
if(allCount!=0){
|
if (allCount != 0) {
|
||||||
float coverageRageNumber =(float)apiCountResult.getExecutionPassCount()*100/allCount;
|
float coverageRageNumber = (float) apiCountResult.getExecutionPassCount() * 100 / allCount;
|
||||||
DecimalFormat df = new DecimalFormat("0.0");
|
DecimalFormat df = new DecimalFormat("0.0");
|
||||||
apiCountResult.setPassRage(df.format(coverageRageNumber)+"%");
|
apiCountResult.setPassRage(df.format(coverageRageNumber) + "%");
|
||||||
}
|
}
|
||||||
|
|
||||||
return apiCountResult;
|
return apiCountResult;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,4 +381,15 @@ public class APITestController {
|
||||||
public String historicalDataUpgrade(@RequestBody SaveHistoricalDataUpgrade request) {
|
public String historicalDataUpgrade(@RequestBody SaveHistoricalDataUpgrade request) {
|
||||||
return historicalDataUpgradeService.upgrade(request);
|
return historicalDataUpgradeService.upgrade(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/genPerformanceTestXml", consumes = {"multipart/form-data"})
|
||||||
|
public JmxInfoDTO genPerformanceTest(@RequestPart("request") RunDefinitionRequest runRequest, @RequestPart(value = "files") List<MultipartFile> bodyFiles) {
|
||||||
|
HashTree hashTree = runRequest.getTestElement().generateHashTree();
|
||||||
|
String jmxString = runRequest.getTestElement().getJmx(hashTree);
|
||||||
|
JmxInfoDTO dto = new JmxInfoDTO();
|
||||||
|
dto.setName(runRequest.getName()+".jmx");
|
||||||
|
dto.setXml(jmxString);
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,24 +2,40 @@ package io.metersphere.api.controller;
|
||||||
|
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import io.metersphere.api.dto.JmxInfoDTO;
|
||||||
import io.metersphere.api.dto.automation.*;
|
import io.metersphere.api.dto.automation.*;
|
||||||
import io.metersphere.api.dto.definition.RunDefinitionRequest;
|
import io.metersphere.api.dto.definition.RunDefinitionRequest;
|
||||||
|
import io.metersphere.api.dto.definition.request.*;
|
||||||
|
import io.metersphere.api.dto.scenario.KeyValue;
|
||||||
import io.metersphere.api.service.ApiAutomationService;
|
import io.metersphere.api.service.ApiAutomationService;
|
||||||
import io.metersphere.base.domain.ApiScenario;
|
import io.metersphere.base.domain.ApiScenario;
|
||||||
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
|
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
|
||||||
import io.metersphere.base.domain.Schedule;
|
import io.metersphere.base.domain.Schedule;
|
||||||
|
import io.metersphere.commons.constants.ReportTriggerMode;
|
||||||
import io.metersphere.commons.constants.RoleConstants;
|
import io.metersphere.commons.constants.RoleConstants;
|
||||||
|
import io.metersphere.commons.exception.MSException;
|
||||||
|
import io.metersphere.commons.utils.LogUtil;
|
||||||
import io.metersphere.commons.utils.PageUtils;
|
import io.metersphere.commons.utils.PageUtils;
|
||||||
import io.metersphere.commons.utils.Pager;
|
import io.metersphere.commons.utils.Pager;
|
||||||
import io.metersphere.commons.utils.SessionUtils;
|
import io.metersphere.commons.utils.SessionUtils;
|
||||||
|
import io.metersphere.i18n.Translator;
|
||||||
|
import io.metersphere.performance.service.PerformanceTestService;
|
||||||
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
|
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
|
||||||
|
import io.metersphere.track.request.testplan.SaveTestPlanRequest;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.jmeter.save.SaveService;
|
||||||
|
import org.apache.jorphan.collections.HashTree;
|
||||||
|
import org.apache.jorphan.collections.ListedHashTree;
|
||||||
import org.apache.shiro.authz.annotation.Logical;
|
import org.apache.shiro.authz.annotation.Logical;
|
||||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value = "/api/automation")
|
@RequestMapping(value = "/api/automation")
|
||||||
|
@ -28,6 +44,8 @@ public class ApiAutomationController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
ApiAutomationService apiAutomationService;
|
ApiAutomationService apiAutomationService;
|
||||||
|
@Resource
|
||||||
|
PerformanceTestService performanceTestService;
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/list/{goPage}/{pageSize}")
|
@PostMapping("/list/{goPage}/{pageSize}")
|
||||||
|
@ -122,5 +140,10 @@ public class ApiAutomationController {
|
||||||
apiAutomationService.createSchedule(request);
|
apiAutomationService.createSchedule(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/genPerformanceTestJmx")
|
||||||
|
public JmxInfoDTO genPerformanceTestJmx(@RequestBody RunScenarioRequest runRequest) {
|
||||||
|
runRequest.setExecuteType(ExecuteType.Completed.name());
|
||||||
|
return apiAutomationService.genPerformanceTestJmx(runRequest);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,19 @@ public class ApiTestCaseController {
|
||||||
return apiTestCaseService.list(request);
|
return apiTestCaseService.list(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/findById/{id}")
|
||||||
|
public ApiTestCaseResult single(@PathVariable String id ) {
|
||||||
|
ApiTestCaseRequest request = new ApiTestCaseRequest();
|
||||||
|
request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
|
||||||
|
request.setId(id);
|
||||||
|
List<ApiTestCaseResult> list = apiTestCaseService.list(request);
|
||||||
|
if(!list.isEmpty()){
|
||||||
|
return list.get(0);
|
||||||
|
}else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/list/{goPage}/{pageSize}")
|
@PostMapping("/list/{goPage}/{pageSize}")
|
||||||
public Pager<List<ApiTestCaseDTO>> listSimple(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiTestCaseRequest request) {
|
public Pager<List<ApiTestCaseDTO>> listSimple(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiTestCaseRequest request) {
|
||||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package io.metersphere.api.dto;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author song.tianyang
|
||||||
|
* @Date 2021/1/5 5:48 下午
|
||||||
|
* @Description
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class JmxInfoDTO {
|
||||||
|
private String name;
|
||||||
|
private String xml;
|
||||||
|
}
|
|
@ -6,6 +6,7 @@ import io.metersphere.base.domain.Schedule;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
|
@ -47,4 +48,6 @@ public class SaveApiDefinitionRequest {
|
||||||
private String triggerMode;
|
private String triggerMode;
|
||||||
|
|
||||||
private List<String> bodyUploadIds;
|
private List<String> bodyUploadIds;
|
||||||
|
|
||||||
|
private List<String> tags = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import io.metersphere.api.dto.definition.request.MsTestElement;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
|
@ -35,4 +36,6 @@ public class SaveApiTestCaseRequest {
|
||||||
private Long updateTime;
|
private Long updateTime;
|
||||||
|
|
||||||
private List<String> bodyUploadIds;
|
private List<String> bodyUploadIds;
|
||||||
|
|
||||||
|
private List<String> tags = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -265,7 +265,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
||||||
private Arguments httpArguments(List<KeyValue> list) {
|
private Arguments httpArguments(List<KeyValue> list) {
|
||||||
Arguments arguments = new Arguments();
|
Arguments arguments = new Arguments();
|
||||||
list.stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).forEach(keyValue -> {
|
list.stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).forEach(keyValue -> {
|
||||||
HTTPArgument httpArgument = new HTTPArgument(keyValue.getName(), keyValue.getValue() != null && keyValue.getValue().startsWith("@") ? ScriptEngineUtils.calculate(keyValue.getValue()) : keyValue.getValue());
|
HTTPArgument httpArgument = new HTTPArgument(keyValue.getName(), StringUtils.isNotEmpty(keyValue.getValue()) && keyValue.getValue().startsWith("@") ? ScriptEngineUtils.calculate(keyValue.getValue()) : keyValue.getValue());
|
||||||
httpArgument.setAlwaysEncoded(keyValue.isEncode());
|
httpArgument.setAlwaysEncoded(keyValue.isEncode());
|
||||||
if (StringUtils.isNotBlank(keyValue.getContentType())) {
|
if (StringUtils.isNotBlank(keyValue.getContentType())) {
|
||||||
httpArgument.setContentType(keyValue.getContentType());
|
httpArgument.setContentType(keyValue.getContentType());
|
||||||
|
|
|
@ -1,14 +1,21 @@
|
||||||
package io.metersphere.api.dto.definition.request.sampler;
|
package io.metersphere.api.dto.definition.request.sampler;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alibaba.fastjson.annotation.JSONField;
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
import com.alibaba.fastjson.annotation.JSONType;
|
import com.alibaba.fastjson.annotation.JSONType;
|
||||||
import io.metersphere.api.dto.definition.request.MsTestElement;
|
import io.metersphere.api.dto.definition.request.MsTestElement;
|
||||||
import io.metersphere.api.dto.definition.request.ParameterConfig;
|
import io.metersphere.api.dto.definition.request.ParameterConfig;
|
||||||
import io.metersphere.api.dto.scenario.DatabaseConfig;
|
import io.metersphere.api.dto.scenario.DatabaseConfig;
|
||||||
import io.metersphere.api.dto.scenario.KeyValue;
|
import io.metersphere.api.dto.scenario.KeyValue;
|
||||||
|
import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
|
||||||
|
import io.metersphere.api.service.ApiTestEnvironmentService;
|
||||||
|
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
|
||||||
|
import io.metersphere.commons.exception.MSException;
|
||||||
|
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.jmeter.config.Arguments;
|
import org.apache.jmeter.config.Arguments;
|
||||||
import org.apache.jmeter.protocol.jdbc.config.DataSourceElement;
|
import org.apache.jmeter.protocol.jdbc.config.DataSourceElement;
|
||||||
import org.apache.jmeter.protocol.jdbc.sampler.JDBCSampler;
|
import org.apache.jmeter.protocol.jdbc.sampler.JDBCSampler;
|
||||||
|
@ -17,6 +24,7 @@ import org.apache.jmeter.testelement.TestElement;
|
||||||
import org.apache.jorphan.collections.HashTree;
|
import org.apache.jorphan.collections.HashTree;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ -40,6 +48,8 @@ public class MsJDBCSampler extends MsTestElement {
|
||||||
private String environmentId;
|
private String environmentId;
|
||||||
@JSONField(ordinal = 27)
|
@JSONField(ordinal = 27)
|
||||||
private Object requestResult;
|
private Object requestResult;
|
||||||
|
@JSONField(ordinal = 28)
|
||||||
|
private String dataSourceId;
|
||||||
|
|
||||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||||
if (!this.isEnable()) {
|
if (!this.isEnable()) {
|
||||||
|
@ -48,6 +58,12 @@ public class MsJDBCSampler extends MsTestElement {
|
||||||
if (this.getReferenced() != null && this.getReferenced().equals("REF")) {
|
if (this.getReferenced() != null && this.getReferenced().equals("REF")) {
|
||||||
this.getRefElement(this);
|
this.getRefElement(this);
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isNotEmpty(dataSourceId)) {
|
||||||
|
initDataSource();
|
||||||
|
}
|
||||||
|
if (this.dataSource == null) {
|
||||||
|
MSException.throwException("数据源为空无法执行");
|
||||||
|
}
|
||||||
final HashTree samplerHashTree = tree.add(jdbcSampler());
|
final HashTree samplerHashTree = tree.add(jdbcSampler());
|
||||||
tree.add(jdbcDataSource());
|
tree.add(jdbcDataSource());
|
||||||
tree.add(arguments(this.getName() + " Variables", this.getVariables()));
|
tree.add(arguments(this.getName() + " Variables", this.getVariables()));
|
||||||
|
@ -58,6 +74,20 @@ public class MsJDBCSampler extends MsTestElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initDataSource() {
|
||||||
|
ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class);
|
||||||
|
ApiTestEnvironmentWithBLOBs environment = environmentService.get(this.dataSourceId);
|
||||||
|
if (environment != null && environment.getConfig() != null) {
|
||||||
|
EnvironmentConfig config = JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class);
|
||||||
|
if (CollectionUtils.isNotEmpty(config.getDatabaseConfigs())) {
|
||||||
|
List<DatabaseConfig> databaseConfigs = config.getDatabaseConfigs().stream().filter((DatabaseConfig d) -> this.dataSourceId.equals(d.getId())).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isNotEmpty(databaseConfigs)) {
|
||||||
|
this.dataSource = databaseConfigs.get(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Arguments arguments(String name, List<KeyValue> variables) {
|
private Arguments arguments(String name, List<KeyValue> variables) {
|
||||||
Arguments arguments = new Arguments();
|
Arguments arguments = new Arguments();
|
||||||
if (!variables.isEmpty()) {
|
if (!variables.isEmpty()) {
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class KeyValue {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
return (StringUtils.isNotBlank(name) || StringUtils.isNotBlank(value)) && !StringUtils.equalsIgnoreCase(type, "file");
|
return (StringUtils.isNotBlank(name) && StringUtils.isNotBlank(value)) && !StringUtils.equalsIgnoreCase(type, "file");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFile() {
|
public boolean isFile() {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import io.metersphere.api.dto.DeleteAPIReportRequest;
|
import io.metersphere.api.dto.DeleteAPIReportRequest;
|
||||||
|
import io.metersphere.api.dto.JmxInfoDTO;
|
||||||
import io.metersphere.api.dto.automation.*;
|
import io.metersphere.api.dto.automation.*;
|
||||||
import io.metersphere.api.dto.datacount.ApiDataCountResult;
|
import io.metersphere.api.dto.datacount.ApiDataCountResult;
|
||||||
import io.metersphere.api.dto.definition.RunDefinitionRequest;
|
import io.metersphere.api.dto.definition.RunDefinitionRequest;
|
||||||
|
@ -29,15 +30,18 @@ import io.metersphere.commons.utils.ServiceUtils;
|
||||||
import io.metersphere.commons.utils.SessionUtils;
|
import io.metersphere.commons.utils.SessionUtils;
|
||||||
import io.metersphere.i18n.Translator;
|
import io.metersphere.i18n.Translator;
|
||||||
import io.metersphere.job.sechedule.ApiScenarioTestJob;
|
import io.metersphere.job.sechedule.ApiScenarioTestJob;
|
||||||
|
import io.metersphere.performance.service.PerformanceTestService;
|
||||||
import io.metersphere.service.ScheduleService;
|
import io.metersphere.service.ScheduleService;
|
||||||
import io.metersphere.track.dto.TestPlanDTO;
|
import io.metersphere.track.dto.TestPlanDTO;
|
||||||
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
|
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
|
||||||
import io.metersphere.track.request.testcase.QueryTestPlanRequest;
|
import io.metersphere.track.request.testcase.QueryTestPlanRequest;
|
||||||
|
import io.metersphere.track.request.testplan.SaveTestPlanRequest;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.ibatis.session.ExecutorType;
|
import org.apache.ibatis.session.ExecutorType;
|
||||||
import org.apache.ibatis.session.SqlSession;
|
import org.apache.ibatis.session.SqlSession;
|
||||||
import org.apache.ibatis.session.SqlSessionFactory;
|
import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
|
import org.apache.jmeter.save.SaveService;
|
||||||
import org.apache.jorphan.collections.HashTree;
|
import org.apache.jorphan.collections.HashTree;
|
||||||
import org.apache.jorphan.collections.ListedHashTree;
|
import org.apache.jorphan.collections.ListedHashTree;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -45,6 +49,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -73,6 +78,8 @@ public class ApiAutomationService {
|
||||||
SqlSessionFactory sqlSessionFactory;
|
SqlSessionFactory sqlSessionFactory;
|
||||||
@Resource
|
@Resource
|
||||||
private ApiScenarioReportMapper apiScenarioReportMapper;
|
private ApiScenarioReportMapper apiScenarioReportMapper;
|
||||||
|
@Resource
|
||||||
|
private PerformanceTestService performanceTestService;
|
||||||
|
|
||||||
public List<ApiScenarioDTO> list(ApiScenarioRequest request) {
|
public List<ApiScenarioDTO> list(ApiScenarioRequest request) {
|
||||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||||
|
@ -528,15 +535,12 @@ public class ApiAutomationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createSchedule(Schedule request) {
|
public void createSchedule(Schedule request) {
|
||||||
|
|
||||||
Schedule schedule = scheduleService.buildApiTestSchedule(request);
|
Schedule schedule = scheduleService.buildApiTestSchedule(request);
|
||||||
schedule.setJob(ApiScenarioTestJob.class.getName());
|
schedule.setJob(ApiScenarioTestJob.class.getName());
|
||||||
schedule.setGroup(ScheduleGroup.API_SCENARIO_TEST.name());
|
schedule.setGroup(ScheduleGroup.API_SCENARIO_TEST.name());
|
||||||
schedule.setType(ScheduleType.CRON.name());
|
schedule.setType(ScheduleType.CRON.name());
|
||||||
|
|
||||||
scheduleService.addSchedule(schedule);
|
scheduleService.addSchedule(schedule);
|
||||||
this.addOrUpdateApiScenarioCronJob(request);
|
this.addOrUpdateApiScenarioCronJob(request);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateSchedule(Schedule request) {
|
public void updateSchedule(Schedule request) {
|
||||||
|
@ -548,4 +552,69 @@ public class ApiAutomationService {
|
||||||
scheduleService.addOrUpdateCronJob(
|
scheduleService.addOrUpdateCronJob(
|
||||||
request, ApiScenarioTestJob.getJobKey(request.getResourceId()), ApiScenarioTestJob.getTriggerKey(request.getResourceId()), ApiScenarioTestJob.class);
|
request, ApiScenarioTestJob.getJobKey(request.getResourceId()), ApiScenarioTestJob.getTriggerKey(request.getResourceId()), ApiScenarioTestJob.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public JmxInfoDTO genPerformanceTestJmx(RunScenarioRequest request) {
|
||||||
|
List<ApiScenarioWithBLOBs> apiScenarios = null;
|
||||||
|
List<String> ids = request.getScenarioIds();
|
||||||
|
if (request.isSelectAllDate()) {
|
||||||
|
ids = this.getAllScenarioIdsByFontedSelect(
|
||||||
|
request.getModuleIds(), request.getName(), request.getProjectId(), request.getFilters(), request.getUnSelectIds());
|
||||||
|
}
|
||||||
|
apiScenarios = extApiScenarioMapper.selectIds(ids);
|
||||||
|
MsTestPlan testPlan = new MsTestPlan();
|
||||||
|
testPlan.setHashTree(new LinkedList<>());
|
||||||
|
HashTree jmeterHashTree = new ListedHashTree();
|
||||||
|
try {
|
||||||
|
boolean isFirst = true;
|
||||||
|
for (ApiScenarioWithBLOBs item : apiScenarios) {
|
||||||
|
if (item.getStepTotal() == 0) {
|
||||||
|
MSException.throwException(item.getName() + "," + Translator.get("automation_exec_info"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
MsThreadGroup group = new MsThreadGroup();
|
||||||
|
group.setLabel(item.getName());
|
||||||
|
group.setName(UUID.randomUUID().toString());
|
||||||
|
// 批量执行的结果直接存储为报告
|
||||||
|
if (isFirst) {
|
||||||
|
group.setName(request.getId());
|
||||||
|
isFirst = false;
|
||||||
|
}
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
|
JSONObject element = JSON.parseObject(item.getScenarioDefinition());
|
||||||
|
MsScenario scenario = JSONObject.parseObject(item.getScenarioDefinition(), MsScenario.class);
|
||||||
|
|
||||||
|
// 多态JSON普通转换会丢失内容,需要通过 ObjectMapper 获取
|
||||||
|
if (element != null && StringUtils.isNotEmpty(element.getString("hashTree"))) {
|
||||||
|
LinkedList<MsTestElement> elements = mapper.readValue(element.getString("hashTree"),
|
||||||
|
new TypeReference<LinkedList<MsTestElement>>() {
|
||||||
|
});
|
||||||
|
scenario.setHashTree(elements);
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(element.getString("variables"))) {
|
||||||
|
LinkedList<KeyValue> variables = mapper.readValue(element.getString("variables"),
|
||||||
|
new TypeReference<LinkedList<KeyValue>>() {
|
||||||
|
});
|
||||||
|
scenario.setVariables(variables);
|
||||||
|
}
|
||||||
|
group.setEnableCookieShare(scenario.isEnableCookieShare());
|
||||||
|
LinkedList<MsTestElement> scenarios = new LinkedList<>();
|
||||||
|
scenarios.add(scenario);
|
||||||
|
group.setHashTree(scenarios);
|
||||||
|
testPlan.getHashTree().add(group);
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
MSException.throwException(ex.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
testPlan.toHashTree(jmeterHashTree, testPlan.getHashTree(), new ParameterConfig());
|
||||||
|
String jmx = testPlan.getJmx(jmeterHashTree);
|
||||||
|
String name = request.getName() + ".jmx";
|
||||||
|
|
||||||
|
JmxInfoDTO dto = new JmxInfoDTO();
|
||||||
|
dto.setName(name);
|
||||||
|
dto.setXml(jmx);
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,9 @@ package io.metersphere.api.service;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import io.metersphere.api.dto.APIReportResult;
|
import io.metersphere.api.dto.APIReportResult;
|
||||||
import io.metersphere.api.dto.ApiTestImportRequest;
|
import io.metersphere.api.dto.ApiTestImportRequest;
|
||||||
import io.metersphere.api.dto.automation.ApiScenarioRequest;
|
import io.metersphere.api.dto.automation.ApiScenarioRequest;
|
||||||
|
@ -9,6 +12,8 @@ import io.metersphere.api.dto.automation.ReferenceDTO;
|
||||||
import io.metersphere.api.dto.datacount.ApiDataCountResult;
|
import io.metersphere.api.dto.datacount.ApiDataCountResult;
|
||||||
import io.metersphere.api.dto.definition.*;
|
import io.metersphere.api.dto.definition.*;
|
||||||
import io.metersphere.api.dto.definition.parse.ApiDefinitionImport;
|
import io.metersphere.api.dto.definition.parse.ApiDefinitionImport;
|
||||||
|
import io.metersphere.api.dto.definition.request.*;
|
||||||
|
import io.metersphere.api.dto.scenario.KeyValue;
|
||||||
import io.metersphere.api.dto.scenario.request.RequestType;
|
import io.metersphere.api.dto.scenario.request.RequestType;
|
||||||
import io.metersphere.api.jmeter.JMeterService;
|
import io.metersphere.api.jmeter.JMeterService;
|
||||||
import io.metersphere.api.jmeter.TestResult;
|
import io.metersphere.api.jmeter.TestResult;
|
||||||
|
@ -24,6 +29,7 @@ import io.metersphere.base.mapper.ext.ExtApiScenarioMapper;
|
||||||
import io.metersphere.base.mapper.ext.ExtTestPlanMapper;
|
import io.metersphere.base.mapper.ext.ExtTestPlanMapper;
|
||||||
import io.metersphere.commons.constants.APITestStatus;
|
import io.metersphere.commons.constants.APITestStatus;
|
||||||
import io.metersphere.commons.constants.ApiRunMode;
|
import io.metersphere.commons.constants.ApiRunMode;
|
||||||
|
import io.metersphere.commons.constants.ReportTriggerMode;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.utils.*;
|
import io.metersphere.commons.utils.*;
|
||||||
import io.metersphere.i18n.Translator;
|
import io.metersphere.i18n.Translator;
|
||||||
|
@ -36,6 +42,7 @@ import org.apache.ibatis.session.ExecutorType;
|
||||||
import org.apache.ibatis.session.SqlSession;
|
import org.apache.ibatis.session.SqlSession;
|
||||||
import org.apache.ibatis.session.SqlSessionFactory;
|
import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
import org.apache.jorphan.collections.HashTree;
|
import org.apache.jorphan.collections.HashTree;
|
||||||
|
import org.apache.jorphan.collections.ListedHashTree;
|
||||||
import org.aspectj.util.FileUtil;
|
import org.aspectj.util.FileUtil;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
@ -82,10 +89,10 @@ public class ApiDefinitionService {
|
||||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||||
|
|
||||||
//判断是否查询本周数据
|
//判断是否查询本周数据
|
||||||
if(request.isSelectThisWeedData()){
|
if (request.isSelectThisWeedData()) {
|
||||||
Map<String, Date> weekFirstTimeAndLastTime = DateUtils.getWeedFirstTimeAndLastTime(new Date());
|
Map<String, Date> weekFirstTimeAndLastTime = DateUtils.getWeedFirstTimeAndLastTime(new Date());
|
||||||
Date weekFirstTime = weekFirstTimeAndLastTime.get("firstTime");
|
Date weekFirstTime = weekFirstTimeAndLastTime.get("firstTime");
|
||||||
if(weekFirstTime!=null){
|
if (weekFirstTime != null) {
|
||||||
request.setCreateTime(weekFirstTime.getTime());
|
request.setCreateTime(weekFirstTime.getTime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -228,6 +235,7 @@ public class ApiDefinitionService {
|
||||||
test.setResponse(JSONObject.toJSONString(request.getResponse()));
|
test.setResponse(JSONObject.toJSONString(request.getResponse()));
|
||||||
test.setEnvironmentId(request.getEnvironmentId());
|
test.setEnvironmentId(request.getEnvironmentId());
|
||||||
test.setUserId(request.getUserId());
|
test.setUserId(request.getUserId());
|
||||||
|
test.setTags(JSON.toJSONString(new HashSet<>(request.getTags())));
|
||||||
|
|
||||||
apiDefinitionMapper.updateByPrimaryKeySelective(test);
|
apiDefinitionMapper.updateByPrimaryKeySelective(test);
|
||||||
return test;
|
return test;
|
||||||
|
@ -258,6 +266,7 @@ public class ApiDefinitionService {
|
||||||
test.setUserId(request.getUserId());
|
test.setUserId(request.getUserId());
|
||||||
}
|
}
|
||||||
test.setDescription(request.getDescription());
|
test.setDescription(request.getDescription());
|
||||||
|
test.setTags(JSON.toJSONString(new HashSet<>(request.getTags())));
|
||||||
apiDefinitionMapper.insert(test);
|
apiDefinitionMapper.insert(test);
|
||||||
return test;
|
return test;
|
||||||
}
|
}
|
||||||
|
@ -331,6 +340,55 @@ public class ApiDefinitionService {
|
||||||
return request.getId();
|
return request.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内部构建HashTree 定时任务发起的执行
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String run(RunDefinitionRequest request,ApiTestCaseWithBLOBs item) {
|
||||||
|
MsTestPlan testPlan = new MsTestPlan();
|
||||||
|
testPlan.setHashTree(new LinkedList<>());
|
||||||
|
HashTree jmeterHashTree = new ListedHashTree();
|
||||||
|
try {
|
||||||
|
MsThreadGroup group = new MsThreadGroup();
|
||||||
|
group.setLabel(item.getName());
|
||||||
|
group.setName(UUID.randomUUID().toString());
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
|
|
||||||
|
JSONObject element = JSON.parseObject(item.getRequest());
|
||||||
|
MsScenario scenario = JSONObject.parseObject(item.getRequest(), MsScenario.class);
|
||||||
|
|
||||||
|
// 多态JSON普通转换会丢失内容,需要通过 ObjectMapper 获取
|
||||||
|
if (element != null && StringUtils.isNotEmpty(element.getString("hashTree"))) {
|
||||||
|
LinkedList<MsTestElement> elements = mapper.readValue(element.getString("hashTree"),
|
||||||
|
new TypeReference<LinkedList<MsTestElement>>() {});
|
||||||
|
scenario.setHashTree(elements);
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(element.getString("variables"))) {
|
||||||
|
LinkedList<KeyValue> variables = mapper.readValue(element.getString("variables"),
|
||||||
|
new TypeReference<LinkedList<KeyValue>>() {});
|
||||||
|
scenario.setVariables(variables);
|
||||||
|
}
|
||||||
|
group.setEnableCookieShare(scenario.isEnableCookieShare());
|
||||||
|
LinkedList<MsTestElement> scenarios = new LinkedList<>();
|
||||||
|
scenarios.add(scenario);
|
||||||
|
group.setHashTree(scenarios);
|
||||||
|
testPlan.getHashTree().add(group);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
MSException.throwException(ex.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
testPlan.toHashTree(jmeterHashTree, testPlan.getHashTree(), new ParameterConfig());
|
||||||
|
String runMode = ApiRunMode.DELIMIT.name();
|
||||||
|
if (StringUtils.isNotBlank(request.getType()) && StringUtils.equals(request.getType(), ApiRunMode.API_PLAN.name())) {
|
||||||
|
runMode = ApiRunMode.API_PLAN.name();
|
||||||
|
}
|
||||||
|
// 调用执行方法
|
||||||
|
jMeterService.runDefinition(request.getId(), jmeterHashTree, request.getReportId(), runMode);
|
||||||
|
return request.getId();
|
||||||
|
}
|
||||||
|
|
||||||
public void addResult(TestResult res) {
|
public void addResult(TestResult res) {
|
||||||
if (!res.getScenarios().isEmpty() && !res.getScenarios().get(0).getRequestResults().isEmpty()) {
|
if (!res.getScenarios().isEmpty() && !res.getScenarios().get(0).getRequestResults().isEmpty()) {
|
||||||
cache.put(res.getTestId(), res.getScenarios().get(0).getRequestResults().get(0));
|
cache.put(res.getTestId(), res.getScenarios().get(0).getRequestResults().get(0));
|
||||||
|
|
|
@ -222,6 +222,7 @@ public class ApiTestCaseService {
|
||||||
test.setPriority(request.getPriority());
|
test.setPriority(request.getPriority());
|
||||||
test.setUpdateTime(System.currentTimeMillis());
|
test.setUpdateTime(System.currentTimeMillis());
|
||||||
test.setDescription(request.getDescription());
|
test.setDescription(request.getDescription());
|
||||||
|
test.setTags(JSON.toJSONString(new HashSet<>(request.getTags())));
|
||||||
apiTestCaseMapper.updateByPrimaryKeySelective(test);
|
apiTestCaseMapper.updateByPrimaryKeySelective(test);
|
||||||
return test;
|
return test;
|
||||||
}
|
}
|
||||||
|
@ -243,6 +244,7 @@ public class ApiTestCaseService {
|
||||||
test.setUpdateTime(System.currentTimeMillis());
|
test.setUpdateTime(System.currentTimeMillis());
|
||||||
test.setDescription(request.getDescription());
|
test.setDescription(request.getDescription());
|
||||||
test.setNum(getNextNum(request.getApiDefinitionId()));
|
test.setNum(getNextNum(request.getApiDefinitionId()));
|
||||||
|
test.setTags(JSON.toJSONString(new HashSet<>(request.getTags())));
|
||||||
apiTestCaseMapper.insert(test);
|
apiTestCaseMapper.insert(test);
|
||||||
return test;
|
return test;
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,6 +134,7 @@ public class HistoricalDataUpgradeService {
|
||||||
EnvironmentDTO dto = environmentDTOMap.get(request1.getDataSource());
|
EnvironmentDTO dto = environmentDTOMap.get(request1.getDataSource());
|
||||||
if (dto != null) {
|
if (dto != null) {
|
||||||
((MsJDBCSampler) element).setEnvironmentId(dto.getEnvironmentId());
|
((MsJDBCSampler) element).setEnvironmentId(dto.getEnvironmentId());
|
||||||
|
((MsJDBCSampler) element).setDataSourceId(dto.getDatabaseConfig().getId());
|
||||||
((MsJDBCSampler) element).setDataSource(dto.getDatabaseConfig());
|
((MsJDBCSampler) element).setDataSource(dto.getDatabaseConfig());
|
||||||
}
|
}
|
||||||
element.setType("JDBCSampler");
|
element.setType("JDBCSampler");
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
package io.metersphere.base.domain;
|
package io.metersphere.base.domain;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class ApiDefinition implements Serializable {
|
public class ApiDefinition implements Serializable {
|
||||||
private String id;
|
private String id;
|
||||||
|
@ -35,5 +36,7 @@ public class ApiDefinition implements Serializable {
|
||||||
|
|
||||||
private Integer num;
|
private Integer num;
|
||||||
|
|
||||||
|
private String tags;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
|
@ -1123,6 +1123,76 @@ public class ApiDefinitionExample {
|
||||||
addCriterion("num not between", value1, value2, "num");
|
addCriterion("num not between", value1, value2, "num");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsIsNull() {
|
||||||
|
addCriterion("tags is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsIsNotNull() {
|
||||||
|
addCriterion("tags is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsEqualTo(String value) {
|
||||||
|
addCriterion("tags =", value, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsNotEqualTo(String value) {
|
||||||
|
addCriterion("tags <>", value, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsGreaterThan(String value) {
|
||||||
|
addCriterion("tags >", value, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsGreaterThanOrEqualTo(String value) {
|
||||||
|
addCriterion("tags >=", value, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsLessThan(String value) {
|
||||||
|
addCriterion("tags <", value, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsLessThanOrEqualTo(String value) {
|
||||||
|
addCriterion("tags <=", value, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsLike(String value) {
|
||||||
|
addCriterion("tags like", value, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsNotLike(String value) {
|
||||||
|
addCriterion("tags not like", value, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsIn(List<String> values) {
|
||||||
|
addCriterion("tags in", values, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsNotIn(List<String> values) {
|
||||||
|
addCriterion("tags not in", values, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsBetween(String value1, String value2) {
|
||||||
|
addCriterion("tags between", value1, value2, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsNotBetween(String value1, String value2) {
|
||||||
|
addCriterion("tags not between", value1, value2, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Criteria extends GeneratedCriteria {
|
public static class Criteria extends GeneratedCriteria {
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
package io.metersphere.base.domain;
|
package io.metersphere.base.domain;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class ApiTestCase implements Serializable {
|
public class ApiTestCase implements Serializable {
|
||||||
private String id;
|
private String id;
|
||||||
|
@ -25,5 +26,7 @@ public class ApiTestCase implements Serializable {
|
||||||
|
|
||||||
private Integer num;
|
private Integer num;
|
||||||
|
|
||||||
|
private String tags;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
|
@ -773,6 +773,76 @@ public class ApiTestCaseExample {
|
||||||
addCriterion("num not between", value1, value2, "num");
|
addCriterion("num not between", value1, value2, "num");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsIsNull() {
|
||||||
|
addCriterion("tags is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsIsNotNull() {
|
||||||
|
addCriterion("tags is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsEqualTo(String value) {
|
||||||
|
addCriterion("tags =", value, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsNotEqualTo(String value) {
|
||||||
|
addCriterion("tags <>", value, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsGreaterThan(String value) {
|
||||||
|
addCriterion("tags >", value, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsGreaterThanOrEqualTo(String value) {
|
||||||
|
addCriterion("tags >=", value, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsLessThan(String value) {
|
||||||
|
addCriterion("tags <", value, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsLessThanOrEqualTo(String value) {
|
||||||
|
addCriterion("tags <=", value, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsLike(String value) {
|
||||||
|
addCriterion("tags like", value, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsNotLike(String value) {
|
||||||
|
addCriterion("tags not like", value, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsIn(List<String> values) {
|
||||||
|
addCriterion("tags in", values, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsNotIn(List<String> values) {
|
||||||
|
addCriterion("tags not in", values, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsBetween(String value1, String value2) {
|
||||||
|
addCriterion("tags between", value1, value2, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsNotBetween(String value1, String value2) {
|
||||||
|
addCriterion("tags not between", value1, value2, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Criteria extends GeneratedCriteria {
|
public static class Criteria extends GeneratedCriteria {
|
||||||
|
|
|
@ -32,4 +32,7 @@ public class Schedule implements Serializable {
|
||||||
private String customData;
|
private String customData;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
//定时任务来源: 测试计划/测试场景
|
||||||
|
private String scheduleFrom;
|
||||||
}
|
}
|
|
@ -1,8 +1,9 @@
|
||||||
package io.metersphere.base.domain;
|
package io.metersphere.base.domain;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class TestCase implements Serializable {
|
public class TestCase implements Serializable {
|
||||||
private String id;
|
private String id;
|
||||||
|
@ -39,5 +40,7 @@ public class TestCase implements Serializable {
|
||||||
|
|
||||||
private String reviewStatus;
|
private String reviewStatus;
|
||||||
|
|
||||||
|
private String tags;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
|
@ -1253,6 +1253,76 @@ public class TestCaseExample {
|
||||||
addCriterion("review_status not between", value1, value2, "reviewStatus");
|
addCriterion("review_status not between", value1, value2, "reviewStatus");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsIsNull() {
|
||||||
|
addCriterion("tags is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsIsNotNull() {
|
||||||
|
addCriterion("tags is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsEqualTo(String value) {
|
||||||
|
addCriterion("tags =", value, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsNotEqualTo(String value) {
|
||||||
|
addCriterion("tags <>", value, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsGreaterThan(String value) {
|
||||||
|
addCriterion("tags >", value, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsGreaterThanOrEqualTo(String value) {
|
||||||
|
addCriterion("tags >=", value, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsLessThan(String value) {
|
||||||
|
addCriterion("tags <", value, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsLessThanOrEqualTo(String value) {
|
||||||
|
addCriterion("tags <=", value, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsLike(String value) {
|
||||||
|
addCriterion("tags like", value, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsNotLike(String value) {
|
||||||
|
addCriterion("tags not like", value, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsIn(List<String> values) {
|
||||||
|
addCriterion("tags in", values, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsNotIn(List<String> values) {
|
||||||
|
addCriterion("tags not in", values, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsBetween(String value1, String value2) {
|
||||||
|
addCriterion("tags between", value1, value2, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTagsNotBetween(String value1, String value2) {
|
||||||
|
addCriterion("tags not between", value1, value2, "tags");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Criteria extends GeneratedCriteria {
|
public static class Criteria extends GeneratedCriteria {
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
package io.metersphere.base.domain;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class TestPlanLoadCase implements Serializable {
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private String testPlanId;
|
||||||
|
|
||||||
|
private String loadCaseId;
|
||||||
|
|
||||||
|
private String loadReportId;
|
||||||
|
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
private Long createTime;
|
||||||
|
|
||||||
|
private Long updateTime;
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
|
@ -0,0 +1,670 @@
|
||||||
|
package io.metersphere.base.domain;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class TestPlanLoadCaseExample {
|
||||||
|
protected String orderByClause;
|
||||||
|
|
||||||
|
protected boolean distinct;
|
||||||
|
|
||||||
|
protected List<Criteria> oredCriteria;
|
||||||
|
|
||||||
|
public TestPlanLoadCaseExample() {
|
||||||
|
oredCriteria = new ArrayList<Criteria>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrderByClause(String orderByClause) {
|
||||||
|
this.orderByClause = orderByClause;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOrderByClause() {
|
||||||
|
return orderByClause;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDistinct(boolean distinct) {
|
||||||
|
this.distinct = distinct;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDistinct() {
|
||||||
|
return distinct;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Criteria> getOredCriteria() {
|
||||||
|
return oredCriteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void or(Criteria criteria) {
|
||||||
|
oredCriteria.add(criteria);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria or() {
|
||||||
|
Criteria criteria = createCriteriaInternal();
|
||||||
|
oredCriteria.add(criteria);
|
||||||
|
return criteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria createCriteria() {
|
||||||
|
Criteria criteria = createCriteriaInternal();
|
||||||
|
if (oredCriteria.size() == 0) {
|
||||||
|
oredCriteria.add(criteria);
|
||||||
|
}
|
||||||
|
return criteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Criteria createCriteriaInternal() {
|
||||||
|
Criteria criteria = new Criteria();
|
||||||
|
return criteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
oredCriteria.clear();
|
||||||
|
orderByClause = null;
|
||||||
|
distinct = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract static class GeneratedCriteria {
|
||||||
|
protected List<Criterion> criteria;
|
||||||
|
|
||||||
|
protected GeneratedCriteria() {
|
||||||
|
super();
|
||||||
|
criteria = new ArrayList<Criterion>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isValid() {
|
||||||
|
return criteria.size() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Criterion> getAllCriteria() {
|
||||||
|
return criteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Criterion> getCriteria() {
|
||||||
|
return criteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addCriterion(String condition) {
|
||||||
|
if (condition == null) {
|
||||||
|
throw new RuntimeException("Value for condition cannot be null");
|
||||||
|
}
|
||||||
|
criteria.add(new Criterion(condition));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addCriterion(String condition, Object value, String property) {
|
||||||
|
if (value == null) {
|
||||||
|
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||||
|
}
|
||||||
|
criteria.add(new Criterion(condition, value));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
||||||
|
if (value1 == null || value2 == null) {
|
||||||
|
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||||
|
}
|
||||||
|
criteria.add(new Criterion(condition, value1, value2));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdIsNull() {
|
||||||
|
addCriterion("id is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdIsNotNull() {
|
||||||
|
addCriterion("id is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdEqualTo(String value) {
|
||||||
|
addCriterion("id =", value, "id");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdNotEqualTo(String value) {
|
||||||
|
addCriterion("id <>", value, "id");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdGreaterThan(String value) {
|
||||||
|
addCriterion("id >", value, "id");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdGreaterThanOrEqualTo(String value) {
|
||||||
|
addCriterion("id >=", value, "id");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdLessThan(String value) {
|
||||||
|
addCriterion("id <", value, "id");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdLessThanOrEqualTo(String value) {
|
||||||
|
addCriterion("id <=", value, "id");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdLike(String value) {
|
||||||
|
addCriterion("id like", value, "id");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdNotLike(String value) {
|
||||||
|
addCriterion("id not like", value, "id");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdIn(List<String> values) {
|
||||||
|
addCriterion("id in", values, "id");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdNotIn(List<String> values) {
|
||||||
|
addCriterion("id not in", values, "id");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdBetween(String value1, String value2) {
|
||||||
|
addCriterion("id between", value1, value2, "id");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdNotBetween(String value1, String value2) {
|
||||||
|
addCriterion("id not between", value1, value2, "id");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdIsNull() {
|
||||||
|
addCriterion("test_plan_id is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdIsNotNull() {
|
||||||
|
addCriterion("test_plan_id is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdEqualTo(String value) {
|
||||||
|
addCriterion("test_plan_id =", value, "testPlanId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdNotEqualTo(String value) {
|
||||||
|
addCriterion("test_plan_id <>", value, "testPlanId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdGreaterThan(String value) {
|
||||||
|
addCriterion("test_plan_id >", value, "testPlanId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdGreaterThanOrEqualTo(String value) {
|
||||||
|
addCriterion("test_plan_id >=", value, "testPlanId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdLessThan(String value) {
|
||||||
|
addCriterion("test_plan_id <", value, "testPlanId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdLessThanOrEqualTo(String value) {
|
||||||
|
addCriterion("test_plan_id <=", value, "testPlanId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdLike(String value) {
|
||||||
|
addCriterion("test_plan_id like", value, "testPlanId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdNotLike(String value) {
|
||||||
|
addCriterion("test_plan_id not like", value, "testPlanId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdIn(List<String> values) {
|
||||||
|
addCriterion("test_plan_id in", values, "testPlanId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdNotIn(List<String> values) {
|
||||||
|
addCriterion("test_plan_id not in", values, "testPlanId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdBetween(String value1, String value2) {
|
||||||
|
addCriterion("test_plan_id between", value1, value2, "testPlanId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdNotBetween(String value1, String value2) {
|
||||||
|
addCriterion("test_plan_id not between", value1, value2, "testPlanId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadCaseIdIsNull() {
|
||||||
|
addCriterion("load_case_id is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadCaseIdIsNotNull() {
|
||||||
|
addCriterion("load_case_id is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadCaseIdEqualTo(String value) {
|
||||||
|
addCriterion("load_case_id =", value, "loadCaseId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadCaseIdNotEqualTo(String value) {
|
||||||
|
addCriterion("load_case_id <>", value, "loadCaseId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadCaseIdGreaterThan(String value) {
|
||||||
|
addCriterion("load_case_id >", value, "loadCaseId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadCaseIdGreaterThanOrEqualTo(String value) {
|
||||||
|
addCriterion("load_case_id >=", value, "loadCaseId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadCaseIdLessThan(String value) {
|
||||||
|
addCriterion("load_case_id <", value, "loadCaseId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadCaseIdLessThanOrEqualTo(String value) {
|
||||||
|
addCriterion("load_case_id <=", value, "loadCaseId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadCaseIdLike(String value) {
|
||||||
|
addCriterion("load_case_id like", value, "loadCaseId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadCaseIdNotLike(String value) {
|
||||||
|
addCriterion("load_case_id not like", value, "loadCaseId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadCaseIdIn(List<String> values) {
|
||||||
|
addCriterion("load_case_id in", values, "loadCaseId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadCaseIdNotIn(List<String> values) {
|
||||||
|
addCriterion("load_case_id not in", values, "loadCaseId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadCaseIdBetween(String value1, String value2) {
|
||||||
|
addCriterion("load_case_id between", value1, value2, "loadCaseId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadCaseIdNotBetween(String value1, String value2) {
|
||||||
|
addCriterion("load_case_id not between", value1, value2, "loadCaseId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadReportIdIsNull() {
|
||||||
|
addCriterion("load_report_id is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadReportIdIsNotNull() {
|
||||||
|
addCriterion("load_report_id is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadReportIdEqualTo(String value) {
|
||||||
|
addCriterion("load_report_id =", value, "loadReportId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadReportIdNotEqualTo(String value) {
|
||||||
|
addCriterion("load_report_id <>", value, "loadReportId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadReportIdGreaterThan(String value) {
|
||||||
|
addCriterion("load_report_id >", value, "loadReportId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadReportIdGreaterThanOrEqualTo(String value) {
|
||||||
|
addCriterion("load_report_id >=", value, "loadReportId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadReportIdLessThan(String value) {
|
||||||
|
addCriterion("load_report_id <", value, "loadReportId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadReportIdLessThanOrEqualTo(String value) {
|
||||||
|
addCriterion("load_report_id <=", value, "loadReportId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadReportIdLike(String value) {
|
||||||
|
addCriterion("load_report_id like", value, "loadReportId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadReportIdNotLike(String value) {
|
||||||
|
addCriterion("load_report_id not like", value, "loadReportId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadReportIdIn(List<String> values) {
|
||||||
|
addCriterion("load_report_id in", values, "loadReportId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadReportIdNotIn(List<String> values) {
|
||||||
|
addCriterion("load_report_id not in", values, "loadReportId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadReportIdBetween(String value1, String value2) {
|
||||||
|
addCriterion("load_report_id between", value1, value2, "loadReportId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLoadReportIdNotBetween(String value1, String value2) {
|
||||||
|
addCriterion("load_report_id not between", value1, value2, "loadReportId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andStatusIsNull() {
|
||||||
|
addCriterion("`status` is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andStatusIsNotNull() {
|
||||||
|
addCriterion("`status` is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andStatusEqualTo(String value) {
|
||||||
|
addCriterion("`status` =", value, "status");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andStatusNotEqualTo(String value) {
|
||||||
|
addCriterion("`status` <>", value, "status");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andStatusGreaterThan(String value) {
|
||||||
|
addCriterion("`status` >", value, "status");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andStatusGreaterThanOrEqualTo(String value) {
|
||||||
|
addCriterion("`status` >=", value, "status");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andStatusLessThan(String value) {
|
||||||
|
addCriterion("`status` <", value, "status");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andStatusLessThanOrEqualTo(String value) {
|
||||||
|
addCriterion("`status` <=", value, "status");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andStatusLike(String value) {
|
||||||
|
addCriterion("`status` like", value, "status");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andStatusNotLike(String value) {
|
||||||
|
addCriterion("`status` not like", value, "status");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andStatusIn(List<String> values) {
|
||||||
|
addCriterion("`status` in", values, "status");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andStatusNotIn(List<String> values) {
|
||||||
|
addCriterion("`status` not in", values, "status");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andStatusBetween(String value1, String value2) {
|
||||||
|
addCriterion("`status` between", value1, value2, "status");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andStatusNotBetween(String value1, String value2) {
|
||||||
|
addCriterion("`status` not between", value1, value2, "status");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreateTimeIsNull() {
|
||||||
|
addCriterion("create_time is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreateTimeIsNotNull() {
|
||||||
|
addCriterion("create_time is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreateTimeEqualTo(Long value) {
|
||||||
|
addCriterion("create_time =", value, "createTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreateTimeNotEqualTo(Long value) {
|
||||||
|
addCriterion("create_time <>", value, "createTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreateTimeGreaterThan(Long value) {
|
||||||
|
addCriterion("create_time >", value, "createTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) {
|
||||||
|
addCriterion("create_time >=", value, "createTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreateTimeLessThan(Long value) {
|
||||||
|
addCriterion("create_time <", value, "createTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreateTimeLessThanOrEqualTo(Long value) {
|
||||||
|
addCriterion("create_time <=", value, "createTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreateTimeIn(List<Long> values) {
|
||||||
|
addCriterion("create_time in", values, "createTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreateTimeNotIn(List<Long> values) {
|
||||||
|
addCriterion("create_time not in", values, "createTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreateTimeBetween(Long value1, Long value2) {
|
||||||
|
addCriterion("create_time between", value1, value2, "createTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreateTimeNotBetween(Long value1, Long value2) {
|
||||||
|
addCriterion("create_time not between", value1, value2, "createTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUpdateTimeIsNull() {
|
||||||
|
addCriterion("update_time is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUpdateTimeIsNotNull() {
|
||||||
|
addCriterion("update_time is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUpdateTimeEqualTo(Long value) {
|
||||||
|
addCriterion("update_time =", value, "updateTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUpdateTimeNotEqualTo(Long value) {
|
||||||
|
addCriterion("update_time <>", value, "updateTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUpdateTimeGreaterThan(Long value) {
|
||||||
|
addCriterion("update_time >", value, "updateTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUpdateTimeGreaterThanOrEqualTo(Long value) {
|
||||||
|
addCriterion("update_time >=", value, "updateTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUpdateTimeLessThan(Long value) {
|
||||||
|
addCriterion("update_time <", value, "updateTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUpdateTimeLessThanOrEqualTo(Long value) {
|
||||||
|
addCriterion("update_time <=", value, "updateTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUpdateTimeIn(List<Long> values) {
|
||||||
|
addCriterion("update_time in", values, "updateTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUpdateTimeNotIn(List<Long> values) {
|
||||||
|
addCriterion("update_time not in", values, "updateTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUpdateTimeBetween(Long value1, Long value2) {
|
||||||
|
addCriterion("update_time between", value1, value2, "updateTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andUpdateTimeNotBetween(Long value1, Long value2) {
|
||||||
|
addCriterion("update_time not between", value1, value2, "updateTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Criteria extends GeneratedCriteria {
|
||||||
|
|
||||||
|
protected Criteria() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Criterion {
|
||||||
|
private String condition;
|
||||||
|
|
||||||
|
private Object value;
|
||||||
|
|
||||||
|
private Object secondValue;
|
||||||
|
|
||||||
|
private boolean noValue;
|
||||||
|
|
||||||
|
private boolean singleValue;
|
||||||
|
|
||||||
|
private boolean betweenValue;
|
||||||
|
|
||||||
|
private boolean listValue;
|
||||||
|
|
||||||
|
private String typeHandler;
|
||||||
|
|
||||||
|
public String getCondition() {
|
||||||
|
return condition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getSecondValue() {
|
||||||
|
return secondValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNoValue() {
|
||||||
|
return noValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSingleValue() {
|
||||||
|
return singleValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isBetweenValue() {
|
||||||
|
return betweenValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isListValue() {
|
||||||
|
return listValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTypeHandler() {
|
||||||
|
return typeHandler;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Criterion(String condition) {
|
||||||
|
super();
|
||||||
|
this.condition = condition;
|
||||||
|
this.typeHandler = null;
|
||||||
|
this.noValue = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Criterion(String condition, Object value, String typeHandler) {
|
||||||
|
super();
|
||||||
|
this.condition = condition;
|
||||||
|
this.value = value;
|
||||||
|
this.typeHandler = typeHandler;
|
||||||
|
if (value instanceof List<?>) {
|
||||||
|
this.listValue = true;
|
||||||
|
} else {
|
||||||
|
this.singleValue = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Criterion(String condition, Object value) {
|
||||||
|
this(condition, value, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
||||||
|
super();
|
||||||
|
this.condition = condition;
|
||||||
|
this.value = value;
|
||||||
|
this.secondValue = secondValue;
|
||||||
|
this.typeHandler = typeHandler;
|
||||||
|
this.betweenValue = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Criterion(String condition, Object value, Object secondValue) {
|
||||||
|
this(condition, value, secondValue, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,6 +17,7 @@
|
||||||
<result column="protocol" jdbcType="VARCHAR" property="protocol" />
|
<result column="protocol" jdbcType="VARCHAR" property="protocol" />
|
||||||
<result column="path" jdbcType="VARCHAR" property="path" />
|
<result column="path" jdbcType="VARCHAR" property="path" />
|
||||||
<result column="num" jdbcType="INTEGER" property="num" />
|
<result column="num" jdbcType="INTEGER" property="num" />
|
||||||
|
<result column="tags" jdbcType="VARCHAR" property="tags" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiDefinitionWithBLOBs">
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiDefinitionWithBLOBs">
|
||||||
<result column="description" jdbcType="LONGVARCHAR" property="description" />
|
<result column="description" jdbcType="LONGVARCHAR" property="description" />
|
||||||
|
@ -83,7 +84,7 @@
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, project_id, `name`, `method`, module_path, environment_id, schedule, `status`,
|
id, project_id, `name`, `method`, module_path, environment_id, schedule, `status`,
|
||||||
module_id, user_id, create_time, update_time, protocol, `path`, num
|
module_id, user_id, create_time, update_time, protocol, `path`, num, tags
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Blob_Column_List">
|
<sql id="Blob_Column_List">
|
||||||
description, request, response
|
description, request, response
|
||||||
|
@ -142,15 +143,15 @@
|
||||||
schedule, `status`, module_id,
|
schedule, `status`, module_id,
|
||||||
user_id, create_time, update_time,
|
user_id, create_time, update_time,
|
||||||
protocol, `path`, num,
|
protocol, `path`, num,
|
||||||
description, request, response
|
tags, description, request,
|
||||||
)
|
response)
|
||||||
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
||||||
#{method,jdbcType=VARCHAR}, #{modulePath,jdbcType=VARCHAR}, #{environmentId,jdbcType=VARCHAR},
|
#{method,jdbcType=VARCHAR}, #{modulePath,jdbcType=VARCHAR}, #{environmentId,jdbcType=VARCHAR},
|
||||||
#{schedule,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{moduleId,jdbcType=VARCHAR},
|
#{schedule,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{moduleId,jdbcType=VARCHAR},
|
||||||
#{userId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
#{userId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||||
#{protocol,jdbcType=VARCHAR}, #{path,jdbcType=VARCHAR}, #{num,jdbcType=INTEGER},
|
#{protocol,jdbcType=VARCHAR}, #{path,jdbcType=VARCHAR}, #{num,jdbcType=INTEGER},
|
||||||
#{description,jdbcType=LONGVARCHAR}, #{request,jdbcType=LONGVARCHAR}, #{response,jdbcType=LONGVARCHAR}
|
#{tags,jdbcType=VARCHAR}, #{description,jdbcType=LONGVARCHAR}, #{request,jdbcType=LONGVARCHAR},
|
||||||
)
|
#{response,jdbcType=LONGVARCHAR})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiDefinitionWithBLOBs">
|
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiDefinitionWithBLOBs">
|
||||||
insert into api_definition
|
insert into api_definition
|
||||||
|
@ -200,6 +201,9 @@
|
||||||
<if test="num != null">
|
<if test="num != null">
|
||||||
num,
|
num,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="tags != null">
|
||||||
|
tags,
|
||||||
|
</if>
|
||||||
<if test="description != null">
|
<if test="description != null">
|
||||||
description,
|
description,
|
||||||
</if>
|
</if>
|
||||||
|
@ -256,6 +260,9 @@
|
||||||
<if test="num != null">
|
<if test="num != null">
|
||||||
#{num,jdbcType=INTEGER},
|
#{num,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="tags != null">
|
||||||
|
#{tags,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="description != null">
|
<if test="description != null">
|
||||||
#{description,jdbcType=LONGVARCHAR},
|
#{description,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -321,6 +328,9 @@
|
||||||
<if test="record.num != null">
|
<if test="record.num != null">
|
||||||
num = #{record.num,jdbcType=INTEGER},
|
num = #{record.num,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="record.tags != null">
|
||||||
|
tags = #{record.tags,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="record.description != null">
|
<if test="record.description != null">
|
||||||
description = #{record.description,jdbcType=LONGVARCHAR},
|
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -352,6 +362,7 @@
|
||||||
protocol = #{record.protocol,jdbcType=VARCHAR},
|
protocol = #{record.protocol,jdbcType=VARCHAR},
|
||||||
`path` = #{record.path,jdbcType=VARCHAR},
|
`path` = #{record.path,jdbcType=VARCHAR},
|
||||||
num = #{record.num,jdbcType=INTEGER},
|
num = #{record.num,jdbcType=INTEGER},
|
||||||
|
tags = #{record.tags,jdbcType=VARCHAR},
|
||||||
description = #{record.description,jdbcType=LONGVARCHAR},
|
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||||
request = #{record.request,jdbcType=LONGVARCHAR},
|
request = #{record.request,jdbcType=LONGVARCHAR},
|
||||||
response = #{record.response,jdbcType=LONGVARCHAR}
|
response = #{record.response,jdbcType=LONGVARCHAR}
|
||||||
|
@ -375,7 +386,8 @@
|
||||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||||
protocol = #{record.protocol,jdbcType=VARCHAR},
|
protocol = #{record.protocol,jdbcType=VARCHAR},
|
||||||
`path` = #{record.path,jdbcType=VARCHAR},
|
`path` = #{record.path,jdbcType=VARCHAR},
|
||||||
num = #{record.num,jdbcType=INTEGER}
|
num = #{record.num,jdbcType=INTEGER},
|
||||||
|
tags = #{record.tags,jdbcType=VARCHAR}
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
|
@ -425,6 +437,9 @@
|
||||||
<if test="num != null">
|
<if test="num != null">
|
||||||
num = #{num,jdbcType=INTEGER},
|
num = #{num,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="tags != null">
|
||||||
|
tags = #{tags,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="description != null">
|
<if test="description != null">
|
||||||
description = #{description,jdbcType=LONGVARCHAR},
|
description = #{description,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -453,6 +468,7 @@
|
||||||
protocol = #{protocol,jdbcType=VARCHAR},
|
protocol = #{protocol,jdbcType=VARCHAR},
|
||||||
`path` = #{path,jdbcType=VARCHAR},
|
`path` = #{path,jdbcType=VARCHAR},
|
||||||
num = #{num,jdbcType=INTEGER},
|
num = #{num,jdbcType=INTEGER},
|
||||||
|
tags = #{tags,jdbcType=VARCHAR},
|
||||||
description = #{description,jdbcType=LONGVARCHAR},
|
description = #{description,jdbcType=LONGVARCHAR},
|
||||||
request = #{request,jdbcType=LONGVARCHAR},
|
request = #{request,jdbcType=LONGVARCHAR},
|
||||||
response = #{response,jdbcType=LONGVARCHAR}
|
response = #{response,jdbcType=LONGVARCHAR}
|
||||||
|
@ -473,7 +489,8 @@
|
||||||
update_time = #{updateTime,jdbcType=BIGINT},
|
update_time = #{updateTime,jdbcType=BIGINT},
|
||||||
protocol = #{protocol,jdbcType=VARCHAR},
|
protocol = #{protocol,jdbcType=VARCHAR},
|
||||||
`path` = #{path,jdbcType=VARCHAR},
|
`path` = #{path,jdbcType=VARCHAR},
|
||||||
num = #{num,jdbcType=INTEGER}
|
num = #{num,jdbcType=INTEGER},
|
||||||
|
tags = #{tags,jdbcType=VARCHAR}
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
|
@ -12,6 +12,7 @@
|
||||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||||
<result column="num" jdbcType="INTEGER" property="num" />
|
<result column="num" jdbcType="INTEGER" property="num" />
|
||||||
|
<result column="tags" jdbcType="VARCHAR" property="tags" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
|
||||||
<result column="description" jdbcType="LONGVARCHAR" property="description" />
|
<result column="description" jdbcType="LONGVARCHAR" property="description" />
|
||||||
|
@ -78,7 +79,7 @@
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, project_id, `name`, priority, api_definition_id, create_user_id, update_user_id,
|
id, project_id, `name`, priority, api_definition_id, create_user_id, update_user_id,
|
||||||
create_time, update_time, num
|
create_time, update_time, num, tags
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Blob_Column_List">
|
<sql id="Blob_Column_List">
|
||||||
description, request, response
|
description, request, response
|
||||||
|
@ -135,13 +136,13 @@
|
||||||
insert into api_test_case (id, project_id, `name`,
|
insert into api_test_case (id, project_id, `name`,
|
||||||
priority, api_definition_id, create_user_id,
|
priority, api_definition_id, create_user_id,
|
||||||
update_user_id, create_time, update_time,
|
update_user_id, create_time, update_time,
|
||||||
num, description, request,
|
num, tags, description,
|
||||||
response)
|
request, response)
|
||||||
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
||||||
#{priority,jdbcType=VARCHAR}, #{apiDefinitionId,jdbcType=VARCHAR}, #{createUserId,jdbcType=VARCHAR},
|
#{priority,jdbcType=VARCHAR}, #{apiDefinitionId,jdbcType=VARCHAR}, #{createUserId,jdbcType=VARCHAR},
|
||||||
#{updateUserId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
#{updateUserId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||||
#{num,jdbcType=INTEGER}, #{description,jdbcType=LONGVARCHAR}, #{request,jdbcType=LONGVARCHAR},
|
#{num,jdbcType=INTEGER}, #{tags,jdbcType=VARCHAR}, #{description,jdbcType=LONGVARCHAR},
|
||||||
#{response,jdbcType=LONGVARCHAR})
|
#{request,jdbcType=LONGVARCHAR}, #{response,jdbcType=LONGVARCHAR})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
|
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
|
||||||
insert into api_test_case
|
insert into api_test_case
|
||||||
|
@ -176,6 +177,9 @@
|
||||||
<if test="num != null">
|
<if test="num != null">
|
||||||
num,
|
num,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="tags != null">
|
||||||
|
tags,
|
||||||
|
</if>
|
||||||
<if test="description != null">
|
<if test="description != null">
|
||||||
description,
|
description,
|
||||||
</if>
|
</if>
|
||||||
|
@ -217,6 +221,9 @@
|
||||||
<if test="num != null">
|
<if test="num != null">
|
||||||
#{num,jdbcType=INTEGER},
|
#{num,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="tags != null">
|
||||||
|
#{tags,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="description != null">
|
<if test="description != null">
|
||||||
#{description,jdbcType=LONGVARCHAR},
|
#{description,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -267,6 +274,9 @@
|
||||||
<if test="record.num != null">
|
<if test="record.num != null">
|
||||||
num = #{record.num,jdbcType=INTEGER},
|
num = #{record.num,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="record.tags != null">
|
||||||
|
tags = #{record.tags,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="record.description != null">
|
<if test="record.description != null">
|
||||||
description = #{record.description,jdbcType=LONGVARCHAR},
|
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -293,6 +303,7 @@
|
||||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||||
num = #{record.num,jdbcType=INTEGER},
|
num = #{record.num,jdbcType=INTEGER},
|
||||||
|
tags = #{record.tags,jdbcType=VARCHAR},
|
||||||
description = #{record.description,jdbcType=LONGVARCHAR},
|
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||||
request = #{record.request,jdbcType=LONGVARCHAR},
|
request = #{record.request,jdbcType=LONGVARCHAR},
|
||||||
response = #{record.response,jdbcType=LONGVARCHAR}
|
response = #{record.response,jdbcType=LONGVARCHAR}
|
||||||
|
@ -311,7 +322,8 @@
|
||||||
update_user_id = #{record.updateUserId,jdbcType=VARCHAR},
|
update_user_id = #{record.updateUserId,jdbcType=VARCHAR},
|
||||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||||
num = #{record.num,jdbcType=INTEGER}
|
num = #{record.num,jdbcType=INTEGER},
|
||||||
|
tags = #{record.tags,jdbcType=VARCHAR}
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
|
@ -346,6 +358,9 @@
|
||||||
<if test="num != null">
|
<if test="num != null">
|
||||||
num = #{num,jdbcType=INTEGER},
|
num = #{num,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="tags != null">
|
||||||
|
tags = #{tags,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="description != null">
|
<if test="description != null">
|
||||||
description = #{description,jdbcType=LONGVARCHAR},
|
description = #{description,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -369,6 +384,7 @@
|
||||||
create_time = #{createTime,jdbcType=BIGINT},
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
update_time = #{updateTime,jdbcType=BIGINT},
|
update_time = #{updateTime,jdbcType=BIGINT},
|
||||||
num = #{num,jdbcType=INTEGER},
|
num = #{num,jdbcType=INTEGER},
|
||||||
|
tags = #{tags,jdbcType=VARCHAR},
|
||||||
description = #{description,jdbcType=LONGVARCHAR},
|
description = #{description,jdbcType=LONGVARCHAR},
|
||||||
request = #{request,jdbcType=LONGVARCHAR},
|
request = #{request,jdbcType=LONGVARCHAR},
|
||||||
response = #{response,jdbcType=LONGVARCHAR}
|
response = #{response,jdbcType=LONGVARCHAR}
|
||||||
|
@ -384,7 +400,8 @@
|
||||||
update_user_id = #{updateUserId,jdbcType=VARCHAR},
|
update_user_id = #{updateUserId,jdbcType=VARCHAR},
|
||||||
create_time = #{createTime,jdbcType=BIGINT},
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
update_time = #{updateTime,jdbcType=BIGINT},
|
update_time = #{updateTime,jdbcType=BIGINT},
|
||||||
num = #{num,jdbcType=INTEGER}
|
num = #{num,jdbcType=INTEGER},
|
||||||
|
tags = #{tags,jdbcType=VARCHAR}
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
|
@ -19,6 +19,7 @@
|
||||||
<result column="num" jdbcType="INTEGER" property="num" />
|
<result column="num" jdbcType="INTEGER" property="num" />
|
||||||
<result column="other_test_name" jdbcType="VARCHAR" property="otherTestName" />
|
<result column="other_test_name" jdbcType="VARCHAR" property="otherTestName" />
|
||||||
<result column="review_status" jdbcType="VARCHAR" property="reviewStatus" />
|
<result column="review_status" jdbcType="VARCHAR" property="reviewStatus" />
|
||||||
|
<result column="tags" jdbcType="VARCHAR" property="tags" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestCaseWithBLOBs">
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestCaseWithBLOBs">
|
||||||
<result column="remark" jdbcType="LONGVARCHAR" property="remark" />
|
<result column="remark" jdbcType="LONGVARCHAR" property="remark" />
|
||||||
|
@ -84,7 +85,8 @@
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, node_id, node_path, project_id, `name`, `type`, maintainer, priority, `method`,
|
id, node_id, node_path, project_id, `name`, `type`, maintainer, priority, `method`,
|
||||||
prerequisite, create_time, update_time, test_id, sort, num, other_test_name, review_status
|
prerequisite, create_time, update_time, test_id, sort, num, other_test_name, review_status,
|
||||||
|
tags
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Blob_Column_List">
|
<sql id="Blob_Column_List">
|
||||||
remark, steps
|
remark, steps
|
||||||
|
@ -143,15 +145,15 @@
|
||||||
maintainer, priority, `method`,
|
maintainer, priority, `method`,
|
||||||
prerequisite, create_time, update_time,
|
prerequisite, create_time, update_time,
|
||||||
test_id, sort, num,
|
test_id, sort, num,
|
||||||
other_test_name, review_status, remark,
|
other_test_name, review_status, tags,
|
||||||
steps)
|
remark, steps)
|
||||||
values (#{id,jdbcType=VARCHAR}, #{nodeId,jdbcType=VARCHAR}, #{nodePath,jdbcType=VARCHAR},
|
values (#{id,jdbcType=VARCHAR}, #{nodeId,jdbcType=VARCHAR}, #{nodePath,jdbcType=VARCHAR},
|
||||||
#{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
|
#{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
|
||||||
#{maintainer,jdbcType=VARCHAR}, #{priority,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR},
|
#{maintainer,jdbcType=VARCHAR}, #{priority,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR},
|
||||||
#{prerequisite,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
#{prerequisite,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||||
#{testId,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, #{num,jdbcType=INTEGER},
|
#{testId,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, #{num,jdbcType=INTEGER},
|
||||||
#{otherTestName,jdbcType=VARCHAR}, #{reviewStatus,jdbcType=VARCHAR}, #{remark,jdbcType=LONGVARCHAR},
|
#{otherTestName,jdbcType=VARCHAR}, #{reviewStatus,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR},
|
||||||
#{steps,jdbcType=LONGVARCHAR})
|
#{remark,jdbcType=LONGVARCHAR}, #{steps,jdbcType=LONGVARCHAR})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseWithBLOBs">
|
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseWithBLOBs">
|
||||||
insert into test_case
|
insert into test_case
|
||||||
|
@ -207,6 +209,9 @@
|
||||||
<if test="reviewStatus != null">
|
<if test="reviewStatus != null">
|
||||||
review_status,
|
review_status,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="tags != null">
|
||||||
|
tags,
|
||||||
|
</if>
|
||||||
<if test="remark != null">
|
<if test="remark != null">
|
||||||
remark,
|
remark,
|
||||||
</if>
|
</if>
|
||||||
|
@ -266,6 +271,9 @@
|
||||||
<if test="reviewStatus != null">
|
<if test="reviewStatus != null">
|
||||||
#{reviewStatus,jdbcType=VARCHAR},
|
#{reviewStatus,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="tags != null">
|
||||||
|
#{tags,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="remark != null">
|
<if test="remark != null">
|
||||||
#{remark,jdbcType=LONGVARCHAR},
|
#{remark,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -334,6 +342,9 @@
|
||||||
<if test="record.reviewStatus != null">
|
<if test="record.reviewStatus != null">
|
||||||
review_status = #{record.reviewStatus,jdbcType=VARCHAR},
|
review_status = #{record.reviewStatus,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="record.tags != null">
|
||||||
|
tags = #{record.tags,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="record.remark != null">
|
<if test="record.remark != null">
|
||||||
remark = #{record.remark,jdbcType=LONGVARCHAR},
|
remark = #{record.remark,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -364,6 +375,7 @@
|
||||||
num = #{record.num,jdbcType=INTEGER},
|
num = #{record.num,jdbcType=INTEGER},
|
||||||
other_test_name = #{record.otherTestName,jdbcType=VARCHAR},
|
other_test_name = #{record.otherTestName,jdbcType=VARCHAR},
|
||||||
review_status = #{record.reviewStatus,jdbcType=VARCHAR},
|
review_status = #{record.reviewStatus,jdbcType=VARCHAR},
|
||||||
|
tags = #{record.tags,jdbcType=VARCHAR},
|
||||||
remark = #{record.remark,jdbcType=LONGVARCHAR},
|
remark = #{record.remark,jdbcType=LONGVARCHAR},
|
||||||
steps = #{record.steps,jdbcType=LONGVARCHAR}
|
steps = #{record.steps,jdbcType=LONGVARCHAR}
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
|
@ -388,7 +400,8 @@
|
||||||
sort = #{record.sort,jdbcType=INTEGER},
|
sort = #{record.sort,jdbcType=INTEGER},
|
||||||
num = #{record.num,jdbcType=INTEGER},
|
num = #{record.num,jdbcType=INTEGER},
|
||||||
other_test_name = #{record.otherTestName,jdbcType=VARCHAR},
|
other_test_name = #{record.otherTestName,jdbcType=VARCHAR},
|
||||||
review_status = #{record.reviewStatus,jdbcType=VARCHAR}
|
review_status = #{record.reviewStatus,jdbcType=VARCHAR},
|
||||||
|
tags = #{record.tags,jdbcType=VARCHAR}
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
|
@ -444,6 +457,9 @@
|
||||||
<if test="reviewStatus != null">
|
<if test="reviewStatus != null">
|
||||||
review_status = #{reviewStatus,jdbcType=VARCHAR},
|
review_status = #{reviewStatus,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="tags != null">
|
||||||
|
tags = #{tags,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="remark != null">
|
<if test="remark != null">
|
||||||
remark = #{remark,jdbcType=LONGVARCHAR},
|
remark = #{remark,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -471,6 +487,7 @@
|
||||||
num = #{num,jdbcType=INTEGER},
|
num = #{num,jdbcType=INTEGER},
|
||||||
other_test_name = #{otherTestName,jdbcType=VARCHAR},
|
other_test_name = #{otherTestName,jdbcType=VARCHAR},
|
||||||
review_status = #{reviewStatus,jdbcType=VARCHAR},
|
review_status = #{reviewStatus,jdbcType=VARCHAR},
|
||||||
|
tags = #{tags,jdbcType=VARCHAR},
|
||||||
remark = #{remark,jdbcType=LONGVARCHAR},
|
remark = #{remark,jdbcType=LONGVARCHAR},
|
||||||
steps = #{steps,jdbcType=LONGVARCHAR}
|
steps = #{steps,jdbcType=LONGVARCHAR}
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
|
@ -492,7 +509,8 @@
|
||||||
sort = #{sort,jdbcType=INTEGER},
|
sort = #{sort,jdbcType=INTEGER},
|
||||||
num = #{num,jdbcType=INTEGER},
|
num = #{num,jdbcType=INTEGER},
|
||||||
other_test_name = #{otherTestName,jdbcType=VARCHAR},
|
other_test_name = #{otherTestName,jdbcType=VARCHAR},
|
||||||
review_status = #{reviewStatus,jdbcType=VARCHAR}
|
review_status = #{reviewStatus,jdbcType=VARCHAR},
|
||||||
|
tags = #{tags,jdbcType=VARCHAR}
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
|
@ -0,0 +1,30 @@
|
||||||
|
package io.metersphere.base.mapper;
|
||||||
|
|
||||||
|
import io.metersphere.base.domain.TestPlanLoadCase;
|
||||||
|
import io.metersphere.base.domain.TestPlanLoadCaseExample;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
public interface TestPlanLoadCaseMapper {
|
||||||
|
long countByExample(TestPlanLoadCaseExample example);
|
||||||
|
|
||||||
|
int deleteByExample(TestPlanLoadCaseExample example);
|
||||||
|
|
||||||
|
int deleteByPrimaryKey(String id);
|
||||||
|
|
||||||
|
int insert(TestPlanLoadCase record);
|
||||||
|
|
||||||
|
int insertSelective(TestPlanLoadCase record);
|
||||||
|
|
||||||
|
List<TestPlanLoadCase> selectByExample(TestPlanLoadCaseExample example);
|
||||||
|
|
||||||
|
TestPlanLoadCase selectByPrimaryKey(String id);
|
||||||
|
|
||||||
|
int updateByExampleSelective(@Param("record") TestPlanLoadCase record, @Param("example") TestPlanLoadCaseExample example);
|
||||||
|
|
||||||
|
int updateByExample(@Param("record") TestPlanLoadCase record, @Param("example") TestPlanLoadCaseExample example);
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(TestPlanLoadCase record);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(TestPlanLoadCase record);
|
||||||
|
}
|
|
@ -0,0 +1,243 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="io.metersphere.base.mapper.TestPlanLoadCaseMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.TestPlanLoadCase">
|
||||||
|
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||||
|
<result column="test_plan_id" jdbcType="VARCHAR" property="testPlanId" />
|
||||||
|
<result column="load_case_id" jdbcType="VARCHAR" property="loadCaseId" />
|
||||||
|
<result column="load_report_id" jdbcType="VARCHAR" property="loadReportId" />
|
||||||
|
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||||
|
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||||
|
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Example_Where_Clause">
|
||||||
|
<where>
|
||||||
|
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||||
|
<if test="criteria.valid">
|
||||||
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||||
|
<foreach collection="criteria.criteria" item="criterion">
|
||||||
|
<choose>
|
||||||
|
<when test="criterion.noValue">
|
||||||
|
and ${criterion.condition}
|
||||||
|
</when>
|
||||||
|
<when test="criterion.singleValue">
|
||||||
|
and ${criterion.condition} #{criterion.value}
|
||||||
|
</when>
|
||||||
|
<when test="criterion.betweenValue">
|
||||||
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||||
|
</when>
|
||||||
|
<when test="criterion.listValue">
|
||||||
|
and ${criterion.condition}
|
||||||
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||||
|
#{listItem}
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</foreach>
|
||||||
|
</trim>
|
||||||
|
</if>
|
||||||
|
</foreach>
|
||||||
|
</where>
|
||||||
|
</sql>
|
||||||
|
<sql id="Update_By_Example_Where_Clause">
|
||||||
|
<where>
|
||||||
|
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
||||||
|
<if test="criteria.valid">
|
||||||
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||||
|
<foreach collection="criteria.criteria" item="criterion">
|
||||||
|
<choose>
|
||||||
|
<when test="criterion.noValue">
|
||||||
|
and ${criterion.condition}
|
||||||
|
</when>
|
||||||
|
<when test="criterion.singleValue">
|
||||||
|
and ${criterion.condition} #{criterion.value}
|
||||||
|
</when>
|
||||||
|
<when test="criterion.betweenValue">
|
||||||
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||||
|
</when>
|
||||||
|
<when test="criterion.listValue">
|
||||||
|
and ${criterion.condition}
|
||||||
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||||
|
#{listItem}
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</foreach>
|
||||||
|
</trim>
|
||||||
|
</if>
|
||||||
|
</foreach>
|
||||||
|
</where>
|
||||||
|
</sql>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, test_plan_id, load_case_id, load_report_id, `status`, create_time, update_time
|
||||||
|
</sql>
|
||||||
|
<select id="selectByExample" parameterType="io.metersphere.base.domain.TestPlanLoadCaseExample" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<if test="distinct">
|
||||||
|
distinct
|
||||||
|
</if>
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from test_plan_load_case
|
||||||
|
<if test="_parameter != null">
|
||||||
|
<include refid="Example_Where_Clause" />
|
||||||
|
</if>
|
||||||
|
<if test="orderByClause != null">
|
||||||
|
order by ${orderByClause}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from test_plan_load_case
|
||||||
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
|
</select>
|
||||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||||
|
delete from test_plan_load_case
|
||||||
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
|
</delete>
|
||||||
|
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.TestPlanLoadCaseExample">
|
||||||
|
delete from test_plan_load_case
|
||||||
|
<if test="_parameter != null">
|
||||||
|
<include refid="Example_Where_Clause" />
|
||||||
|
</if>
|
||||||
|
</delete>
|
||||||
|
<insert id="insert" parameterType="io.metersphere.base.domain.TestPlanLoadCase">
|
||||||
|
insert into test_plan_load_case (id, test_plan_id, load_case_id,
|
||||||
|
load_report_id, `status`, create_time,
|
||||||
|
update_time)
|
||||||
|
values (#{id,jdbcType=VARCHAR}, #{testPlanId,jdbcType=VARCHAR}, #{loadCaseId,jdbcType=VARCHAR},
|
||||||
|
#{loadReportId,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
|
||||||
|
#{updateTime,jdbcType=BIGINT})
|
||||||
|
</insert>
|
||||||
|
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlanLoadCase">
|
||||||
|
insert into test_plan_load_case
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">
|
||||||
|
id,
|
||||||
|
</if>
|
||||||
|
<if test="testPlanId != null">
|
||||||
|
test_plan_id,
|
||||||
|
</if>
|
||||||
|
<if test="loadCaseId != null">
|
||||||
|
load_case_id,
|
||||||
|
</if>
|
||||||
|
<if test="loadReportId != null">
|
||||||
|
load_report_id,
|
||||||
|
</if>
|
||||||
|
<if test="status != null">
|
||||||
|
`status`,
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time,
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
update_time,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">
|
||||||
|
#{id,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="testPlanId != null">
|
||||||
|
#{testPlanId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="loadCaseId != null">
|
||||||
|
#{loadCaseId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="loadReportId != null">
|
||||||
|
#{loadReportId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="status != null">
|
||||||
|
#{status,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
#{createTime,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
#{updateTime,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<select id="countByExample" parameterType="io.metersphere.base.domain.TestPlanLoadCaseExample" resultType="java.lang.Long">
|
||||||
|
select count(*) from test_plan_load_case
|
||||||
|
<if test="_parameter != null">
|
||||||
|
<include refid="Example_Where_Clause" />
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
<update id="updateByExampleSelective" parameterType="map">
|
||||||
|
update test_plan_load_case
|
||||||
|
<set>
|
||||||
|
<if test="record.id != null">
|
||||||
|
id = #{record.id,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="record.testPlanId != null">
|
||||||
|
test_plan_id = #{record.testPlanId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="record.loadCaseId != null">
|
||||||
|
load_case_id = #{record.loadCaseId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="record.loadReportId != null">
|
||||||
|
load_report_id = #{record.loadReportId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="record.status != null">
|
||||||
|
`status` = #{record.status,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="record.createTime != null">
|
||||||
|
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="record.updateTime != null">
|
||||||
|
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
<if test="_parameter != null">
|
||||||
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
|
</if>
|
||||||
|
</update>
|
||||||
|
<update id="updateByExample" parameterType="map">
|
||||||
|
update test_plan_load_case
|
||||||
|
set id = #{record.id,jdbcType=VARCHAR},
|
||||||
|
test_plan_id = #{record.testPlanId,jdbcType=VARCHAR},
|
||||||
|
load_case_id = #{record.loadCaseId,jdbcType=VARCHAR},
|
||||||
|
load_report_id = #{record.loadReportId,jdbcType=VARCHAR},
|
||||||
|
`status` = #{record.status,jdbcType=VARCHAR},
|
||||||
|
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||||
|
update_time = #{record.updateTime,jdbcType=BIGINT}
|
||||||
|
<if test="_parameter != null">
|
||||||
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
|
</if>
|
||||||
|
</update>
|
||||||
|
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.TestPlanLoadCase">
|
||||||
|
update test_plan_load_case
|
||||||
|
<set>
|
||||||
|
<if test="testPlanId != null">
|
||||||
|
test_plan_id = #{testPlanId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="loadCaseId != null">
|
||||||
|
load_case_id = #{loadCaseId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="loadReportId != null">
|
||||||
|
load_report_id = #{loadReportId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="status != null">
|
||||||
|
`status` = #{status,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
update_time = #{updateTime,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
|
</update>
|
||||||
|
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestPlanLoadCase">
|
||||||
|
update test_plan_load_case
|
||||||
|
set test_plan_id = #{testPlanId,jdbcType=VARCHAR},
|
||||||
|
load_case_id = #{loadCaseId,jdbcType=VARCHAR},
|
||||||
|
load_report_id = #{loadReportId,jdbcType=VARCHAR},
|
||||||
|
`status` = #{status,jdbcType=VARCHAR},
|
||||||
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
|
update_time = #{updateTime,jdbcType=BIGINT}
|
||||||
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
|
</update>
|
||||||
|
</mapper>
|
|
@ -194,7 +194,7 @@
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="list" resultType="io.metersphere.api.dto.definition.ApiDefinitionResult">
|
<select id="list" resultType="io.metersphere.api.dto.definition.ApiDefinitionResult">
|
||||||
select api_definition.id, api_definition.project_id, api_definition.num,
|
select api_definition.id, api_definition.project_id, api_definition.num, api_definition.tags,
|
||||||
api_definition.name,api_definition.protocol,api_definition.path,api_definition.module_id,api_definition.module_path,api_definition.method,
|
api_definition.name,api_definition.protocol,api_definition.path,api_definition.module_id,api_definition.module_path,api_definition.method,
|
||||||
api_definition.description,api_definition.request,api_definition.response,api_definition.environment_id,
|
api_definition.description,api_definition.request,api_definition.response,api_definition.environment_id,
|
||||||
api_definition.status, api_definition.user_id, api_definition.create_time, api_definition.update_time, project.name as
|
api_definition.status, api_definition.user_id, api_definition.create_time, api_definition.update_time, project.name as
|
||||||
|
|
|
@ -162,6 +162,7 @@
|
||||||
atc.update_user_id,
|
atc.update_user_id,
|
||||||
atc.update_time,
|
atc.update_time,
|
||||||
atc.num,
|
atc.num,
|
||||||
|
atc.tags,
|
||||||
ader.status execResult,
|
ader.status execResult,
|
||||||
ader.create_time execTime
|
ader.create_time execTime
|
||||||
from
|
from
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<select id="list" resultType="io.metersphere.api.dto.definition.TestPlanApiCaseDTO">
|
<select id="list" resultType="io.metersphere.api.dto.definition.TestPlanApiCaseDTO">
|
||||||
select
|
select
|
||||||
t.id, t.environment_id, t.create_time, t.update_time,
|
t.id, t.environment_id, t.create_time, t.update_time,
|
||||||
c.id as case_id, c.project_id, c.name, c.api_definition_id, c.priority, c.description, c.create_user_id, c.update_user_id, c.num,
|
c.id as case_id, c.project_id, c.name, c.api_definition_id, c.priority, c.description, c.create_user_id, c.update_user_id, c.num, c.tags,
|
||||||
a.module_id, a.path, a.protocol, t.status execResult
|
a.module_id, a.path, a.protocol, t.status execResult
|
||||||
from
|
from
|
||||||
test_plan_api_case t
|
test_plan_api_case t
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package io.metersphere.base.mapper.ext;
|
||||||
|
|
||||||
|
import io.metersphere.track.dto.TestPlanLoadCaseDTO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ExtTestPlanLoadCaseMapper {
|
||||||
|
|
||||||
|
List<String> selectIdsNotInPlan(@Param("projectId") String projectId, @Param("planId") String planId);
|
||||||
|
List<TestPlanLoadCaseDTO> selectTestPlanLoadCaseList(@Param("planId") String planId);
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="io.metersphere.base.mapper.ext.ExtTestPlanLoadCaseMapper">
|
||||||
|
|
||||||
|
<select id="selectIdsNotInPlan" resultType="java.lang.String">
|
||||||
|
select load_test.id
|
||||||
|
from load_test
|
||||||
|
where load_test.project_id = #{projectId}
|
||||||
|
and load_test.id not in (
|
||||||
|
select tplc.load_case_id from test_plan_load_case tplc where tplc.test_plan_id = #{planId}
|
||||||
|
)
|
||||||
|
</select>
|
||||||
|
<select id="selectTestPlanLoadCaseList" resultType="io.metersphere.track.dto.TestPlanLoadCaseDTO">
|
||||||
|
select tplc.id, u.name as userName, tplc.create_time, tplc.update_time, tplc.test_plan_id, tplc.load_case_id,
|
||||||
|
lt.status, lt.name as caseName, tplc.load_report_id
|
||||||
|
from test_plan_load_case tplc
|
||||||
|
inner join load_test lt on tplc.load_case_id = lt.id
|
||||||
|
inner join user u on lt.user_id = u.id
|
||||||
|
where tplc.test_plan_id = #{planId}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
|
@ -1,5 +1,5 @@
|
||||||
package io.metersphere.commons.constants;
|
package io.metersphere.commons.constants;
|
||||||
|
|
||||||
public enum ScheduleGroup {
|
public enum ScheduleGroup {
|
||||||
API_TEST, PERFORMANCE_TEST, API_SCENARIO_TEST
|
API_TEST, PERFORMANCE_TEST, API_SCENARIO_TEST,TEST_PLAN_TEST
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package io.metersphere.controller;
|
||||||
|
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import io.metersphere.api.service.ApiAutomationService;
|
||||||
import io.metersphere.base.domain.Schedule;
|
import io.metersphere.base.domain.Schedule;
|
||||||
import io.metersphere.controller.request.QueryScheduleRequest;
|
import io.metersphere.controller.request.QueryScheduleRequest;
|
||||||
import io.metersphere.dto.ScheduleDao;
|
import io.metersphere.dto.ScheduleDao;
|
||||||
|
@ -16,6 +17,8 @@ import java.util.List;
|
||||||
public class ScheduleController {
|
public class ScheduleController {
|
||||||
@Resource
|
@Resource
|
||||||
private ScheduleService scheduleService;
|
private ScheduleService scheduleService;
|
||||||
|
@Resource
|
||||||
|
private ApiAutomationService apiAutomationService;
|
||||||
|
|
||||||
@PostMapping("/list/{goPage}/{pageSize}")
|
@PostMapping("/list/{goPage}/{pageSize}")
|
||||||
public List<ScheduleDao> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryScheduleRequest request) {
|
public List<ScheduleDao> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryScheduleRequest request) {
|
||||||
|
@ -28,4 +31,19 @@ public class ScheduleController {
|
||||||
Schedule schedule = scheduleService.getScheduleByResource(testId,group);
|
Schedule schedule = scheduleService.getScheduleByResource(testId,group);
|
||||||
return schedule;
|
return schedule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/update")
|
||||||
|
public void updateSchedule(@RequestBody Schedule request) {
|
||||||
|
scheduleService.updateSchedule(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/create")
|
||||||
|
public void createSchedule(@RequestBody Schedule request) {
|
||||||
|
scheduleService.createSchedule(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = "/getTaskInfo")
|
||||||
|
public Object getTaskInfo() {
|
||||||
|
return scheduleService.getCurrentlyExecutingJobs();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,9 @@ import org.quartz.*;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
@ -296,4 +298,21 @@ public class ScheduleManager {
|
||||||
return jobDataMap;
|
return jobDataMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object getCurrentlyExecutingJobs(){
|
||||||
|
Map<String, String> returnMap = new HashMap<>();
|
||||||
|
try {
|
||||||
|
List<JobExecutionContext> currentJobs = scheduler.getCurrentlyExecutingJobs();
|
||||||
|
for (JobExecutionContext jobCtx : currentJobs) {
|
||||||
|
String jobName = jobCtx.getJobDetail().getKey().getName();
|
||||||
|
String groupName = jobCtx.getJobDetail().getJobClass().getName();
|
||||||
|
|
||||||
|
returnMap.put("jobName", jobName);
|
||||||
|
returnMap.put("groupName", groupName);
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnMap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,130 @@
|
||||||
|
package io.metersphere.job.sechedule;
|
||||||
|
|
||||||
|
import io.metersphere.api.dto.automation.ExecuteType;
|
||||||
|
import io.metersphere.api.dto.automation.RunScenarioRequest;
|
||||||
|
import io.metersphere.api.dto.definition.RunDefinitionRequest;
|
||||||
|
import io.metersphere.api.service.ApiAutomationService;
|
||||||
|
import io.metersphere.api.service.ApiDefinitionService;
|
||||||
|
import io.metersphere.api.service.ApiTestCaseService;
|
||||||
|
import io.metersphere.base.domain.ApiTestCaseWithBLOBs;
|
||||||
|
import io.metersphere.base.domain.TestPlanApiCase;
|
||||||
|
import io.metersphere.base.domain.TestPlanApiScenario;
|
||||||
|
import io.metersphere.commons.constants.ApiRunMode;
|
||||||
|
import io.metersphere.commons.constants.ReportTriggerMode;
|
||||||
|
import io.metersphere.commons.constants.ScheduleGroup;
|
||||||
|
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||||
|
import io.metersphere.commons.utils.LogUtil;
|
||||||
|
import io.metersphere.performance.service.PerformanceTestService;
|
||||||
|
import io.metersphere.track.request.testplan.RunTestPlanRequest;
|
||||||
|
import io.metersphere.track.service.TestPlanApiCaseService;
|
||||||
|
import io.metersphere.track.service.TestPlanScenarioCaseService;
|
||||||
|
import org.quartz.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 情景测试Job
|
||||||
|
* @author song.tianyang
|
||||||
|
* @Date 2020/12/22 2:59 下午
|
||||||
|
* @Description
|
||||||
|
*/
|
||||||
|
public class TestPlanTestJob extends MsScheduleJob {
|
||||||
|
private String projectID;
|
||||||
|
private List<String> scenarioIds;
|
||||||
|
private List<String> apiTestCaseIds;
|
||||||
|
private List<String> performanceIds;
|
||||||
|
|
||||||
|
private ApiAutomationService apiAutomationService;
|
||||||
|
private PerformanceTestService performanceTestService;
|
||||||
|
private TestPlanScenarioCaseService testPlanScenarioCaseService;
|
||||||
|
private TestPlanApiCaseService testPlanApiCaseService;
|
||||||
|
private ApiTestCaseService apiTestCaseService;
|
||||||
|
private ApiDefinitionService apiDefinitionService;
|
||||||
|
|
||||||
|
public TestPlanTestJob() {
|
||||||
|
this.apiAutomationService = CommonBeanFactory.getBean(ApiAutomationService.class);
|
||||||
|
this.performanceTestService = CommonBeanFactory.getBean(PerformanceTestService.class);
|
||||||
|
this.testPlanScenarioCaseService = CommonBeanFactory.getBean(TestPlanScenarioCaseService.class);
|
||||||
|
this.testPlanApiCaseService = CommonBeanFactory.getBean(TestPlanApiCaseService.class);
|
||||||
|
this.apiTestCaseService = CommonBeanFactory.getBean(ApiTestCaseService.class);
|
||||||
|
apiDefinitionService = CommonBeanFactory.getBean(ApiDefinitionService.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 情景部分的准备工作
|
||||||
|
* @param context
|
||||||
|
* @throws JobExecutionException
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||||
|
JobKey jobKey = context.getTrigger().getJobKey();
|
||||||
|
JobDataMap jobDataMap = context.getJobDetail().getJobDataMap();
|
||||||
|
|
||||||
|
this.userId = jobDataMap.getString("userId");
|
||||||
|
this.expression = jobDataMap.getString("expression");
|
||||||
|
this.projectID = jobDataMap.getString("projectId");
|
||||||
|
scenarioIds = new ArrayList<>();
|
||||||
|
|
||||||
|
String testPlanID = jobDataMap.getString("resourceId");
|
||||||
|
List<TestPlanApiScenario> testPlanApiScenarioList = testPlanScenarioCaseService.getCasesByPlanId(testPlanID);
|
||||||
|
for (TestPlanApiScenario model:
|
||||||
|
testPlanApiScenarioList) {
|
||||||
|
scenarioIds.add(model.getApiScenarioId());
|
||||||
|
}
|
||||||
|
List<TestPlanApiCase> testPlanApiCaseList = testPlanApiCaseService.getCasesByPlanId(testPlanID);
|
||||||
|
for (TestPlanApiCase model :
|
||||||
|
testPlanApiCaseList) {
|
||||||
|
apiTestCaseIds.add(model.getApiCaseId());
|
||||||
|
}
|
||||||
|
|
||||||
|
businessExecute(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void businessExecute(JobExecutionContext context) {
|
||||||
|
LogUtil.info("-------------- start testplan schedule ----------");
|
||||||
|
//执行接口案例任务
|
||||||
|
for (String apiCaseID:apiTestCaseIds) {
|
||||||
|
ApiTestCaseWithBLOBs blobs = apiTestCaseService.get(apiCaseID);
|
||||||
|
String caseReportID = UUID.randomUUID().toString();
|
||||||
|
RunDefinitionRequest apiCaseReqeust = new RunDefinitionRequest();
|
||||||
|
apiCaseReqeust.setId(apiCaseID);
|
||||||
|
apiCaseReqeust.setReportId(caseReportID);
|
||||||
|
apiCaseReqeust.setProjectId(projectID);
|
||||||
|
apiCaseReqeust.setExecuteType(ExecuteType.Saved.name());
|
||||||
|
apiCaseReqeust.setType(ApiRunMode.API_PLAN.name());
|
||||||
|
apiDefinitionService.run(apiCaseReqeust,blobs);
|
||||||
|
}
|
||||||
|
LogUtil.info("-------------- testplan schedule ---------- api case over -----------------");
|
||||||
|
//执行场景执行任务
|
||||||
|
RunScenarioRequest scenarioRequest = new RunScenarioRequest();
|
||||||
|
String senarionReportID = UUID.randomUUID().toString();
|
||||||
|
scenarioRequest.setId(senarionReportID);
|
||||||
|
scenarioRequest.setReportId(senarionReportID);
|
||||||
|
scenarioRequest.setProjectId(projectID);
|
||||||
|
scenarioRequest.setTriggerMode(ReportTriggerMode.SCHEDULE.name());
|
||||||
|
scenarioRequest.setExecuteType(ExecuteType.Saved.name());
|
||||||
|
scenarioRequest.setScenarioIds(this.scenarioIds);
|
||||||
|
scenarioRequest.setReportUserID(this.userId);
|
||||||
|
scenarioRequest.setRunMode(ApiRunMode.SCENARIO_PLAN.name());
|
||||||
|
String reportID = apiAutomationService.run(scenarioRequest);
|
||||||
|
LogUtil.info("-------------- testplan schedule ---------- scenario case over -----------------");
|
||||||
|
|
||||||
|
//执行性能测试任务 --- 保留,待功能实现后再继续
|
||||||
|
// RunTestPlanRequest performanceRequest = new RunTestPlanRequest();
|
||||||
|
// performanceRequest.setId(resourceId);
|
||||||
|
// performanceRequest.setUserId(userId);
|
||||||
|
// performanceRequest.setTriggerMode(ReportTriggerMode.SCHEDULE.name());
|
||||||
|
// performanceTestService.run(performanceRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JobKey getJobKey(String testId) {
|
||||||
|
return new JobKey(testId, ScheduleGroup.TEST_PLAN_TEST.name());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TriggerKey getTriggerKey(String testId) {
|
||||||
|
return new TriggerKey(testId, ScheduleGroup.TEST_PLAN_TEST.name());
|
||||||
|
}
|
||||||
|
}
|
|
@ -127,9 +127,7 @@ public class PerformanceTestService {
|
||||||
if (files == null) {
|
if (files == null) {
|
||||||
throw new IllegalArgumentException(Translator.get("file_cannot_be_null"));
|
throw new IllegalArgumentException(Translator.get("file_cannot_be_null"));
|
||||||
}
|
}
|
||||||
|
|
||||||
checkQuota(request, true);
|
checkQuota(request, true);
|
||||||
|
|
||||||
final LoadTestWithBLOBs loadTest = saveLoadTest(request);
|
final LoadTestWithBLOBs loadTest = saveLoadTest(request);
|
||||||
files.forEach(file -> {
|
files.forEach(file -> {
|
||||||
final FileMetadata fileMetadata = fileService.saveFile(file);
|
final FileMetadata fileMetadata = fileService.saveFile(file);
|
||||||
|
@ -481,4 +479,14 @@ public class PerformanceTestService {
|
||||||
quotaService.checkLoadTestQuota(request, create);
|
quotaService.checkLoadTestQuota(request, create);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<LoadTest> getLoadTestListByIds(List<String> ids) {
|
||||||
|
if (CollectionUtils.isEmpty(ids)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
LoadTestExample loadTestExample = new LoadTestExample();
|
||||||
|
loadTestExample.createCriteria().andIdIn(ids);
|
||||||
|
List<LoadTest> loadTests = loadTestMapper.selectByExample(loadTestExample);
|
||||||
|
return Optional.ofNullable(loadTests).orElse(new ArrayList<>());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,6 +107,25 @@ public class FileService {
|
||||||
return fileMetadata;
|
return fileMetadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FileMetadata saveFile(byte[] fileByte,String fileName,Long fileSize) {
|
||||||
|
final FileMetadata fileMetadata = new FileMetadata();
|
||||||
|
fileMetadata.setId(UUID.randomUUID().toString());
|
||||||
|
fileMetadata.setName(fileName);
|
||||||
|
fileMetadata.setSize(fileSize);
|
||||||
|
fileMetadata.setCreateTime(System.currentTimeMillis());
|
||||||
|
fileMetadata.setUpdateTime(System.currentTimeMillis());
|
||||||
|
FileType fileType = getFileType(fileMetadata.getName());
|
||||||
|
fileMetadata.setType(fileType.name());
|
||||||
|
fileMetadataMapper.insert(fileMetadata);
|
||||||
|
|
||||||
|
FileContent fileContent = new FileContent();
|
||||||
|
fileContent.setFileId(fileMetadata.getId());
|
||||||
|
fileContent.setFile(fileByte);
|
||||||
|
fileContentMapper.insert(fileContent);
|
||||||
|
|
||||||
|
return fileMetadata;
|
||||||
|
}
|
||||||
|
|
||||||
public FileMetadata copyFile(String fileId) {
|
public FileMetadata copyFile(String fileId) {
|
||||||
FileMetadata fileMetadata = fileMetadataMapper.selectByPrimaryKey(fileId);
|
FileMetadata fileMetadata = fileMetadataMapper.selectByPrimaryKey(fileId);
|
||||||
FileContent fileContent = getFileContent(fileId);
|
FileContent fileContent = getFileContent(fileId);
|
||||||
|
|
|
@ -9,6 +9,8 @@ import io.metersphere.base.domain.UserExample;
|
||||||
import io.metersphere.base.mapper.ScheduleMapper;
|
import io.metersphere.base.mapper.ScheduleMapper;
|
||||||
import io.metersphere.base.mapper.UserMapper;
|
import io.metersphere.base.mapper.UserMapper;
|
||||||
import io.metersphere.base.mapper.ext.ExtScheduleMapper;
|
import io.metersphere.base.mapper.ext.ExtScheduleMapper;
|
||||||
|
import io.metersphere.commons.constants.ScheduleGroup;
|
||||||
|
import io.metersphere.commons.constants.ScheduleType;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.utils.DateUtils;
|
import io.metersphere.commons.utils.DateUtils;
|
||||||
import io.metersphere.commons.utils.LogUtil;
|
import io.metersphere.commons.utils.LogUtil;
|
||||||
|
@ -17,8 +19,10 @@ import io.metersphere.commons.utils.SessionUtils;
|
||||||
import io.metersphere.controller.request.OrderRequest;
|
import io.metersphere.controller.request.OrderRequest;
|
||||||
import io.metersphere.controller.request.QueryScheduleRequest;
|
import io.metersphere.controller.request.QueryScheduleRequest;
|
||||||
import io.metersphere.dto.ScheduleDao;
|
import io.metersphere.dto.ScheduleDao;
|
||||||
|
import io.metersphere.job.sechedule.ApiScenarioTestJob;
|
||||||
import io.metersphere.job.sechedule.ApiTestJob;
|
import io.metersphere.job.sechedule.ApiTestJob;
|
||||||
import io.metersphere.job.sechedule.ScheduleManager;
|
import io.metersphere.job.sechedule.ScheduleManager;
|
||||||
|
import io.metersphere.job.sechedule.TestPlanTestJob;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.quartz.JobKey;
|
import org.quartz.JobKey;
|
||||||
import org.quartz.SchedulerException;
|
import org.quartz.SchedulerException;
|
||||||
|
@ -188,4 +192,54 @@ public class ScheduleService {
|
||||||
List<TaskInfoResult> runningTaskInfoList = extScheduleMapper.findRunningTaskInfoByProjectID(projectID);
|
List<TaskInfoResult> runningTaskInfoList = extScheduleMapper.findRunningTaskInfoByProjectID(projectID);
|
||||||
return runningTaskInfoList;
|
return runningTaskInfoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void createSchedule(Schedule request) {
|
||||||
|
Schedule schedule = this.buildApiTestSchedule(request);
|
||||||
|
schedule.setJob(ApiScenarioTestJob.class.getName());
|
||||||
|
|
||||||
|
JobKey jobKey = null;
|
||||||
|
TriggerKey triggerKey = null;
|
||||||
|
Class clazz = null;
|
||||||
|
if("testPlan".equals(request.getScheduleFrom())){
|
||||||
|
schedule.setGroup(ScheduleGroup.TEST_PLAN_TEST.name());
|
||||||
|
schedule.setType(ScheduleType.CRON.name());
|
||||||
|
jobKey = TestPlanTestJob.getJobKey(request.getResourceId());
|
||||||
|
triggerKey = TestPlanTestJob.getTriggerKey(request.getResourceId());
|
||||||
|
clazz = TestPlanTestJob.class;
|
||||||
|
}else {
|
||||||
|
//默认为情景
|
||||||
|
schedule.setGroup(ScheduleGroup.API_SCENARIO_TEST.name());
|
||||||
|
schedule.setType(ScheduleType.CRON.name());
|
||||||
|
jobKey = ApiScenarioTestJob.getJobKey(request.getResourceId());
|
||||||
|
triggerKey = ApiScenarioTestJob.getTriggerKey(request.getResourceId());
|
||||||
|
clazz = ApiScenarioTestJob.class;
|
||||||
|
}
|
||||||
|
this.addSchedule(schedule);
|
||||||
|
|
||||||
|
this.addOrUpdateCronJob(request,jobKey ,triggerKey , clazz);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateSchedule(Schedule request) {
|
||||||
|
this.editSchedule(request);
|
||||||
|
|
||||||
|
JobKey jobKey = null;
|
||||||
|
TriggerKey triggerKey = null;
|
||||||
|
Class clazz = null;
|
||||||
|
if(ScheduleGroup.TEST_PLAN_TEST.name().equals(request.getGroup())){
|
||||||
|
jobKey = TestPlanTestJob.getJobKey(request.getResourceId());
|
||||||
|
triggerKey = TestPlanTestJob.getTriggerKey(request.getResourceId());
|
||||||
|
clazz = TestPlanTestJob.class;
|
||||||
|
}else {
|
||||||
|
//默认为情景
|
||||||
|
jobKey = ApiScenarioTestJob.getJobKey(request.getResourceId());
|
||||||
|
triggerKey = ApiScenarioTestJob.getTriggerKey(request.getResourceId());
|
||||||
|
clazz = ApiScenarioTestJob.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.addOrUpdateCronJob(request,jobKey ,triggerKey , clazz);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getCurrentlyExecutingJobs() {
|
||||||
|
return scheduleManager.getCurrentlyExecutingJobs();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
package io.metersphere.track.controller;
|
||||||
|
|
||||||
|
import com.github.pagehelper.Page;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import io.metersphere.base.domain.LoadTest;
|
||||||
|
import io.metersphere.commons.utils.PageUtils;
|
||||||
|
import io.metersphere.commons.utils.Pager;
|
||||||
|
import io.metersphere.track.dto.TestPlanLoadCaseDTO;
|
||||||
|
import io.metersphere.track.request.testplan.LoadCaseReportRequest;
|
||||||
|
import io.metersphere.track.request.testplan.LoadCaseRequest;
|
||||||
|
import io.metersphere.track.request.testplan.RunTestPlanRequest;
|
||||||
|
import io.metersphere.track.service.TestPlanLoadCaseService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RequestMapping("/test/plan/load/case")
|
||||||
|
@RestController
|
||||||
|
public class TestPlanLoadCaseController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TestPlanLoadCaseService testPlanLoadCaseService;
|
||||||
|
|
||||||
|
@PostMapping("/relevance/list/{goPage}/{pageSize}")
|
||||||
|
public Pager<List<LoadTest>> relevanceList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody LoadCaseRequest request) {
|
||||||
|
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||||
|
return PageUtils.setPageInfo(page, testPlanLoadCaseService.relevanceList(request));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/relevance")
|
||||||
|
public void relevanceCase(@RequestBody LoadCaseRequest request) {
|
||||||
|
testPlanLoadCaseService.relevanceCase(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/list/{goPage}/{pageSize}")
|
||||||
|
public Pager<List<TestPlanLoadCaseDTO>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody LoadCaseRequest request) {
|
||||||
|
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||||
|
return PageUtils.setPageInfo(page, testPlanLoadCaseService.list(request));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/delete/{id}")
|
||||||
|
public void delete(@PathVariable String id) {
|
||||||
|
testPlanLoadCaseService.delete(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/run")
|
||||||
|
public String run(@RequestBody RunTestPlanRequest request) {
|
||||||
|
return testPlanLoadCaseService.run(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/report/exist")
|
||||||
|
public Boolean isExistReport(@RequestBody LoadCaseReportRequest request) {
|
||||||
|
return testPlanLoadCaseService.isExistReport(request);
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,9 @@ import io.metersphere.base.domain.TestCaseWithBLOBs;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public class TestCaseDTO extends TestCaseWithBLOBs {
|
public class TestCaseDTO extends TestCaseWithBLOBs {
|
||||||
|
@ -12,4 +15,5 @@ public class TestCaseDTO extends TestCaseWithBLOBs {
|
||||||
private String apiName;
|
private String apiName;
|
||||||
private String performName;
|
private String performName;
|
||||||
|
|
||||||
|
private List<String> caseTags = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package io.metersphere.track.dto;
|
||||||
|
|
||||||
|
import io.metersphere.base.domain.TestPlanLoadCase;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class TestPlanLoadCaseDTO extends TestPlanLoadCase {
|
||||||
|
private String userName;
|
||||||
|
private String caseName;
|
||||||
|
}
|
|
@ -16,4 +16,5 @@ public class EditTestCaseRequest extends TestCaseWithBLOBs {
|
||||||
* 复制测试用例后,要进行复制的文件Id list
|
* 复制测试用例后,要进行复制的文件Id list
|
||||||
*/
|
*/
|
||||||
private List<String> fileIds = new ArrayList<>();
|
private List<String> fileIds = new ArrayList<>();
|
||||||
|
private List<String> caseTags = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package io.metersphere.track.request.testplan;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class LoadCaseReportRequest {
|
||||||
|
private String reportId;
|
||||||
|
private String testPlanLoadCaseId;
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package io.metersphere.track.request.testplan;
|
||||||
|
|
||||||
|
import io.metersphere.base.domain.TestPlanLoadCase;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class LoadCaseRequest extends TestPlanLoadCase {
|
||||||
|
private String projectId;
|
||||||
|
private List<String> caseIds;
|
||||||
|
}
|
|
@ -8,4 +8,5 @@ import lombok.Setter;
|
||||||
public class RunTestPlanRequest extends TestPlanRequest {
|
public class RunTestPlanRequest extends TestPlanRequest {
|
||||||
private String userId;
|
private String userId;
|
||||||
private String triggerMode;
|
private String triggerMode;
|
||||||
|
private String testPlanLoadId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -585,6 +585,7 @@ public class TestCaseService {
|
||||||
throw new IllegalArgumentException(Translator.get("file_cannot_be_null"));
|
throw new IllegalArgumentException(Translator.get("file_cannot_be_null"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
request.setTags(JSON.toJSONString(new HashSet<>(request.getCaseTags())));
|
||||||
final TestCaseWithBLOBs testCaseWithBLOBs = addTestCase(request);
|
final TestCaseWithBLOBs testCaseWithBLOBs = addTestCase(request);
|
||||||
|
|
||||||
// 复制用例时传入文件ID进行复制
|
// 复制用例时传入文件ID进行复制
|
||||||
|
@ -641,6 +642,7 @@ public class TestCaseService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
request.setTags(JSON.toJSONString(new HashSet<>(request.getCaseTags())));
|
||||||
editTestCase(request);
|
editTestCase(request);
|
||||||
return request.getId();
|
return request.getId();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,34 @@
|
||||||
package io.metersphere.track.service;
|
package io.metersphere.track.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import io.metersphere.api.dto.definition.ApiTestCaseDTO;
|
import io.metersphere.api.dto.definition.ApiTestCaseDTO;
|
||||||
import io.metersphere.api.dto.definition.ApiTestCaseRequest;
|
import io.metersphere.api.dto.definition.ApiTestCaseRequest;
|
||||||
|
import io.metersphere.api.dto.definition.RunDefinitionRequest;
|
||||||
import io.metersphere.api.dto.definition.TestPlanApiCaseDTO;
|
import io.metersphere.api.dto.definition.TestPlanApiCaseDTO;
|
||||||
|
import io.metersphere.api.dto.definition.request.MsTestElement;
|
||||||
|
import io.metersphere.api.dto.definition.request.MsTestPlan;
|
||||||
|
import io.metersphere.api.dto.definition.request.MsThreadGroup;
|
||||||
import io.metersphere.api.service.ApiDefinitionExecResultService;
|
import io.metersphere.api.service.ApiDefinitionExecResultService;
|
||||||
|
import io.metersphere.api.service.ApiDefinitionService;
|
||||||
import io.metersphere.api.service.ApiTestCaseService;
|
import io.metersphere.api.service.ApiTestCaseService;
|
||||||
|
import io.metersphere.base.domain.ApiTestCaseWithBLOBs;
|
||||||
import io.metersphere.base.domain.TestPlanApiCase;
|
import io.metersphere.base.domain.TestPlanApiCase;
|
||||||
import io.metersphere.base.domain.TestPlanApiCaseExample;
|
import io.metersphere.base.domain.TestPlanApiCaseExample;
|
||||||
import io.metersphere.base.mapper.TestPlanApiCaseMapper;
|
import io.metersphere.base.mapper.TestPlanApiCaseMapper;
|
||||||
import io.metersphere.base.mapper.ext.ExtTestPlanApiCaseMapper;
|
import io.metersphere.base.mapper.ext.ExtTestPlanApiCaseMapper;
|
||||||
import io.metersphere.commons.utils.ServiceUtils;
|
import io.metersphere.commons.utils.ServiceUtils;
|
||||||
import io.metersphere.track.request.testcase.TestPlanApiCaseBatchRequest;
|
import io.metersphere.track.request.testcase.TestPlanApiCaseBatchRequest;
|
||||||
|
import org.apache.jmeter.testelement.TestElement;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@ -30,6 +41,8 @@ public class TestPlanApiCaseService {
|
||||||
ApiTestCaseService apiTestCaseService;
|
ApiTestCaseService apiTestCaseService;
|
||||||
@Resource
|
@Resource
|
||||||
ExtTestPlanApiCaseMapper extTestPlanApiCaseMapper;
|
ExtTestPlanApiCaseMapper extTestPlanApiCaseMapper;
|
||||||
|
@Resource
|
||||||
|
ApiDefinitionService apiDefinitionService;
|
||||||
@Lazy
|
@Lazy
|
||||||
@Resource
|
@Resource
|
||||||
ApiDefinitionExecResultService apiDefinitionExecResultService;
|
ApiDefinitionExecResultService apiDefinitionExecResultService;
|
||||||
|
|
|
@ -0,0 +1,99 @@
|
||||||
|
package io.metersphere.track.service;
|
||||||
|
|
||||||
|
import io.metersphere.base.domain.*;
|
||||||
|
import io.metersphere.base.mapper.LoadTestReportMapper;
|
||||||
|
import io.metersphere.base.mapper.TestPlanLoadCaseMapper;
|
||||||
|
import io.metersphere.base.mapper.ext.ExtTestPlanLoadCaseMapper;
|
||||||
|
import io.metersphere.performance.service.PerformanceTestService;
|
||||||
|
import io.metersphere.track.dto.TestPlanLoadCaseDTO;
|
||||||
|
import io.metersphere.track.request.testplan.LoadCaseReportRequest;
|
||||||
|
import io.metersphere.track.request.testplan.LoadCaseRequest;
|
||||||
|
import io.metersphere.track.request.testplan.RunTestPlanRequest;
|
||||||
|
import org.apache.ibatis.session.ExecutorType;
|
||||||
|
import org.apache.ibatis.session.SqlSession;
|
||||||
|
import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public class TestPlanLoadCaseService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TestPlanLoadCaseMapper testPlanLoadCaseMapper;
|
||||||
|
@Resource
|
||||||
|
private ExtTestPlanLoadCaseMapper extTestPlanLoadCaseMapper;
|
||||||
|
@Resource
|
||||||
|
private PerformanceTestService performanceTestService;
|
||||||
|
@Resource
|
||||||
|
private SqlSessionFactory sqlSessionFactory;
|
||||||
|
@Resource
|
||||||
|
private LoadTestReportMapper loadTestReportMapper;
|
||||||
|
|
||||||
|
public List<LoadTest> relevanceList(LoadCaseRequest request) {
|
||||||
|
List<String> ids = extTestPlanLoadCaseMapper.selectIdsNotInPlan(request.getProjectId(), request.getTestPlanId());
|
||||||
|
if (CollectionUtils.isEmpty(ids)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
return performanceTestService.getLoadTestListByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TestPlanLoadCaseDTO> list(LoadCaseRequest request) {
|
||||||
|
return extTestPlanLoadCaseMapper.selectTestPlanLoadCaseList(request.getTestPlanId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void relevanceCase(LoadCaseRequest request) {
|
||||||
|
List<String> caseIds = request.getCaseIds();
|
||||||
|
String planId = request.getTestPlanId();
|
||||||
|
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||||
|
|
||||||
|
TestPlanLoadCaseMapper testPlanLoadCaseMapper = sqlSession.getMapper(TestPlanLoadCaseMapper.class);
|
||||||
|
caseIds.forEach(id -> {
|
||||||
|
TestPlanLoadCase t = new TestPlanLoadCase();
|
||||||
|
t.setId(UUID.randomUUID().toString());
|
||||||
|
t.setTestPlanId(planId);
|
||||||
|
t.setLoadCaseId(id);
|
||||||
|
t.setCreateTime(System.currentTimeMillis());
|
||||||
|
t.setUpdateTime(System.currentTimeMillis());
|
||||||
|
testPlanLoadCaseMapper.insert(t);
|
||||||
|
});
|
||||||
|
sqlSession.flushStatements();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delete(String id) {
|
||||||
|
TestPlanLoadCaseExample testPlanLoadCaseExample = new TestPlanLoadCaseExample();
|
||||||
|
testPlanLoadCaseExample.createCriteria().andIdEqualTo(id);
|
||||||
|
testPlanLoadCaseMapper.deleteByExample(testPlanLoadCaseExample);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String run(RunTestPlanRequest request) {
|
||||||
|
String reportId = performanceTestService.run(request);
|
||||||
|
TestPlanLoadCase testPlanLoadCase = new TestPlanLoadCase();
|
||||||
|
testPlanLoadCase.setId(request.getTestPlanLoadId());
|
||||||
|
testPlanLoadCase.setLoadReportId(reportId);
|
||||||
|
testPlanLoadCaseMapper.updateByPrimaryKeySelective(testPlanLoadCase);
|
||||||
|
return reportId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean isExistReport(LoadCaseReportRequest request) {
|
||||||
|
String reportId = request.getReportId();
|
||||||
|
String testPlanLoadCaseId = request.getTestPlanLoadCaseId();
|
||||||
|
LoadTestReportExample example = new LoadTestReportExample();
|
||||||
|
example.createCriteria().andIdEqualTo(reportId);
|
||||||
|
List<LoadTestReport> loadTestReports = loadTestReportMapper.selectByExample(example);
|
||||||
|
if (CollectionUtils.isEmpty(loadTestReports)) {
|
||||||
|
TestPlanLoadCase testPlanLoadCase = new TestPlanLoadCase();
|
||||||
|
testPlanLoadCase.setId(testPlanLoadCaseId);
|
||||||
|
testPlanLoadCase.setLoadReportId("");
|
||||||
|
testPlanLoadCaseMapper.updateByPrimaryKeySelective(testPlanLoadCase);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
CREATE TABLE IF NOT EXISTS `test_plan_load_case`
|
||||||
|
(
|
||||||
|
`id` varchar(50) NOT NULL COMMENT 'ID',
|
||||||
|
`test_plan_id` varchar(50) NOT NULL COMMENT 'Test plan ID',
|
||||||
|
`load_case_id` varchar(50) NOT NULL COMMENT 'Load test case ID',
|
||||||
|
`status` varchar(50) DEFAULT NULL COMMENT 'Load case status',
|
||||||
|
`load_report_id` varchar(50) DEFAULT NULL COMMENT 'Load report id',
|
||||||
|
`create_time` bigint(13) NOT NULL COMMENT 'Create timestamp',
|
||||||
|
`update_time` bigint(13) NOT NULL COMMENT 'Update timestamp',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `plan_load_case_id` (`test_plan_id`, `load_case_id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4;
|
|
@ -0,0 +1,8 @@
|
||||||
|
ALTER TABLE api_definition
|
||||||
|
ADD tags VARCHAR(1000) NULL;
|
||||||
|
|
||||||
|
ALTER TABLE api_test_case
|
||||||
|
ADD tags VARCHAR(1000) NULL;
|
||||||
|
|
||||||
|
ALTER TABLE test_case
|
||||||
|
ADD tags VARCHAR(1000) NULL;
|
|
@ -64,7 +64,7 @@
|
||||||
|
|
||||||
<!--要生成的数据库表 -->
|
<!--要生成的数据库表 -->
|
||||||
|
|
||||||
<table tableName="project"/>
|
<table tableName="test_case"/>
|
||||||
<!--<table tableName="test_plan_api_scenario"/>-->
|
<!--<table tableName="test_plan_api_scenario"/>-->
|
||||||
<!--<table tableName="test_plan"/>-->
|
<!--<table tableName="test_plan"/>-->
|
||||||
<!--<table tableName="api_scenario_report"/>-->
|
<!--<table tableName="api_scenario_report"/>-->
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-dropdown-item command="ref">{{ $t('api_test.automation.view_ref') }}</el-dropdown-item>
|
<el-dropdown-item command="ref">{{ $t('api_test.automation.view_ref') }}</el-dropdown-item>
|
||||||
<el-dropdown-item command="schedule" v-tester>{{ $t('api_test.automation.schedule') }}</el-dropdown-item>
|
<el-dropdown-item command="schedule" v-tester>{{ $t('api_test.automation.schedule') }}</el-dropdown-item>
|
||||||
|
<el-dropdown-item command="create_performance" v-tester>{{ $t('api_test.create_performance_test') }}</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
<ms-reference-view ref="viewRef"/>
|
<ms-reference-view ref="viewRef"/>
|
||||||
<ms-schedule-maintain ref="scheduleMaintain" />
|
<ms-schedule-maintain ref="scheduleMaintain" />
|
||||||
|
@ -15,6 +16,7 @@
|
||||||
<script>
|
<script>
|
||||||
import MsReferenceView from "@/business/components/api/automation/scenario/ReferenceView";
|
import MsReferenceView from "@/business/components/api/automation/scenario/ReferenceView";
|
||||||
import MsScheduleMaintain from "@/business/components/api/automation/schedule/ScheduleMaintain"
|
import MsScheduleMaintain from "@/business/components/api/automation/schedule/ScheduleMaintain"
|
||||||
|
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsScenarioExtendButtons",
|
name: "MsScenarioExtendButtons",
|
||||||
|
@ -31,8 +33,34 @@
|
||||||
case "schedule":
|
case "schedule":
|
||||||
this.$refs.scheduleMaintain.open(this.row);
|
this.$refs.scheduleMaintain.open(this.row);
|
||||||
break;
|
break;
|
||||||
|
case "create_performance":
|
||||||
|
this.createPerformance(this.row);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
createPerformance(row) {
|
||||||
|
this.infoDb = false;
|
||||||
|
let url = "/api/automation/genPerformanceTestJmx";
|
||||||
|
let run = {};
|
||||||
|
let scenarioIds = [];
|
||||||
|
scenarioIds.push(row.id);
|
||||||
|
run.projectId = getCurrentProjectID();
|
||||||
|
run.scenarioIds = scenarioIds;
|
||||||
|
run.id = getUUID();
|
||||||
|
run.name = row.name;
|
||||||
|
this.$post(url, run, response => {
|
||||||
|
let jmxObj = {};
|
||||||
|
jmxObj.name = response.data.name;
|
||||||
|
jmxObj.xml = response.data.xml;
|
||||||
|
this.$store.commit('setTest', {
|
||||||
|
name: row.name,
|
||||||
|
jmx: jmxObj
|
||||||
|
})
|
||||||
|
this.$router.push({
|
||||||
|
path: "/performance/test/create"
|
||||||
|
})
|
||||||
|
});
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane :label="$t('schedule.task_notification')" name="second">
|
<el-tab-pane :label="$t('schedule.task_notification')" name="second">
|
||||||
<ms-schedule-notification :is-tester-permission="isTesterPermission" :test-id="testId"
|
<ms-schedule-notification :is-tester-permission="isTesterPermission" :test-id="testId"
|
||||||
:schedule-receiver-options="scheduleReceiverOptions"/>
|
:schedule-receiver-options="scheduleReceiverOptions"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
|
@ -55,7 +55,7 @@ const noticeTemplate = requireComponent.keys().length > 0 ? requireComponent("./
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsScheduleMaintain",
|
name: "MsScheduleMaintain",
|
||||||
components: {CrontabResult, Crontab, MsScheduleNotification,"NoticeTemplate": noticeTemplate.default},
|
components: {CrontabResult, Crontab, MsScheduleNotification, "NoticeTemplate": noticeTemplate.default},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
customValidate: {
|
customValidate: {
|
||||||
|
@ -81,8 +81,7 @@ export default {
|
||||||
callback(new Error(this.$t('commons.input_content')));
|
callback(new Error(this.$t('commons.input_content')));
|
||||||
} else if (!cronValidate(cronValue)) {
|
} else if (!cronValidate(cronValue)) {
|
||||||
callback(new Error(this.$t('schedule.cron_expression_format_error')));
|
callback(new Error(this.$t('schedule.cron_expression_format_error')));
|
||||||
}
|
} else if (!customValidate.pass) {
|
||||||
else if (!customValidate.pass) {
|
|
||||||
callback(new Error(customValidate.info));
|
callback(new Error(customValidate.info));
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
|
@ -93,9 +92,10 @@ export default {
|
||||||
operation: true,
|
operation: true,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
schedule: {
|
schedule: {
|
||||||
value : "",
|
value: "",
|
||||||
},
|
},
|
||||||
testId:String,
|
scheduleTaskType: "",
|
||||||
|
testId: String,
|
||||||
showCron: false,
|
showCron: false,
|
||||||
form: {
|
form: {
|
||||||
cronValue: ""
|
cronValue: ""
|
||||||
|
@ -130,20 +130,30 @@ export default {
|
||||||
return param;
|
return param;
|
||||||
},
|
},
|
||||||
open(row) {
|
open(row) {
|
||||||
this.testId = row.id;
|
//测试计划页面跳转来的
|
||||||
this.findSchedule(row.id);
|
let paramTestId = "";
|
||||||
|
if (row.redirectFrom == 'testPlan') {
|
||||||
|
paramTestId = row.id;
|
||||||
|
this.scheduleTaskType = "TEST_PLAN_TEST";
|
||||||
|
} else {
|
||||||
|
paramTestId = row.id;
|
||||||
|
this.scheduleTaskType = "API_SCENARIO_TEST";
|
||||||
|
}
|
||||||
|
this.testId = paramTestId;
|
||||||
|
this.findSchedule(paramTestId);
|
||||||
this.initUserList();
|
this.initUserList();
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = true;
|
||||||
this.form.cronValue = this.schedule.value;
|
this.form.cronValue = this.schedule.value;
|
||||||
listenGoBack(this.close);
|
listenGoBack(this.close);
|
||||||
this.activeName = 'first'
|
this.activeName = 'first'
|
||||||
},
|
},
|
||||||
findSchedule(){
|
findSchedule() {
|
||||||
var scenarioID = this.testId;
|
var scheduleResourceID = this.testId;
|
||||||
this.result = this.$get("/schedule/findOne/"+scenarioID+"/API_SCENARIO_TEST", response => {
|
var taskType = this.scheduleTaskType;
|
||||||
if(response.data!=null){
|
this.result = this.$get("/schedule/findOne/" + scheduleResourceID + "/" +taskType, response => {
|
||||||
|
if (response.data != null) {
|
||||||
this.schedule = response.data;
|
this.schedule = response.data;
|
||||||
}else {
|
} else {
|
||||||
this.schedule = {};
|
this.schedule = {};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -177,9 +187,20 @@ export default {
|
||||||
param = this.schedule;
|
param = this.schedule;
|
||||||
param.resourceId = this.testId;
|
param.resourceId = this.testId;
|
||||||
let url = '/api/automation/schedule/create';
|
let url = '/api/automation/schedule/create';
|
||||||
if (param.id) {
|
if(this.scheduleTaskType === "TEST_PLAN_TEST"){
|
||||||
url = '/api/automation/schedule/update';
|
param.scheduleFrom = "testPlan";
|
||||||
|
//测试计划页面跳转的创建
|
||||||
|
url = '/schedule/create';
|
||||||
|
if (param.id) {
|
||||||
|
url = '/schedule/update';
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
param.scheduleFrom = "scenario";
|
||||||
|
if (param.id) {
|
||||||
|
url = '/api/automation/schedule/update';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$post(url, param, () => {
|
this.$post(url, param, () => {
|
||||||
this.$success(this.$t('commons.save_success'));
|
this.$success(this.$t('commons.save_success'));
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,112 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-dialog
|
||||||
|
:title="$t('api_test.environment.select_environment')"
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
width="25%"
|
||||||
|
:destroy-on-close="true"
|
||||||
|
@close="handleClose"
|
||||||
|
>
|
||||||
|
<el-form label-position="right" label-width="150px" size="medium" ref="form">
|
||||||
|
<el-form-item prop="type">
|
||||||
|
<el-select v-model="environmentId" value-key="id" size="small" class="ms-htt-width"
|
||||||
|
:placeholder="$t('api_test.definition.request.run_env')"
|
||||||
|
clearable>
|
||||||
|
<el-option v-for="(environment, index) in environments" :key="index"
|
||||||
|
:label="environment.name + (environment.config.httpConfig.socket ? (': ' + environment.config.httpConfig.protocol + '://' + environment.config.httpConfig.socket) : '')"
|
||||||
|
:value="environment.id"/>
|
||||||
|
<template v-slot:empty>
|
||||||
|
<div class="empty-environment">
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template v-slot:footer>
|
||||||
|
<!-- <el-button onclick="this.handleClose">{{ $t('commons.cancel') }}</el-button>-->
|
||||||
|
<el-button type="primary" @click="createPerformance" @keydown.enter.native.prevent>
|
||||||
|
{{ $t('commons.confirm') }}
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||||
|
import {parseEnvironment} from "@/business/components/api/test/model/EnvironmentModel";
|
||||||
|
import {getUUID, getCurrentProjectID} from "@/common/js/utils";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "MsSetEnvironment",
|
||||||
|
components: {},
|
||||||
|
props: {
|
||||||
|
testCase: Object,
|
||||||
|
row: Object,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dialogVisible: false,
|
||||||
|
filterable: false,
|
||||||
|
environments: [],
|
||||||
|
environmentId: "",
|
||||||
|
dialogTitle: {
|
||||||
|
type: String,
|
||||||
|
default() {
|
||||||
|
return this.$t('api_test.environment.select_environment')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
environmentId() {
|
||||||
|
this.environmentChange(this.environmentId);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
environmentChange(value) {
|
||||||
|
for (let i in this.environments) {
|
||||||
|
if (this.environments[i].id === value) {
|
||||||
|
this.environment = this.environments[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getEnvironments() {
|
||||||
|
let selectProjectId = getCurrentProjectID();
|
||||||
|
if (selectProjectId) {
|
||||||
|
this.$get('/api/environment/list/' + selectProjectId, response => {
|
||||||
|
this.environments = response.data;
|
||||||
|
this.environments.forEach(environment => {
|
||||||
|
parseEnvironment(environment);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.environment = undefined;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
open() {
|
||||||
|
this.dialogVisible = true;
|
||||||
|
this.getEnvironments();
|
||||||
|
listenGoBack(this.handleClose);
|
||||||
|
},
|
||||||
|
handleClose() {
|
||||||
|
this.form = {};
|
||||||
|
this.options = [];
|
||||||
|
removeGoBackListener(this.handleClose);
|
||||||
|
},
|
||||||
|
createPerformance() {
|
||||||
|
this.$get('/api/testcase/findById/' + this.testCase.id, response => {
|
||||||
|
let testCaseInfo = response.data;
|
||||||
|
if(testCaseInfo!=null){
|
||||||
|
this.$emit("createPerformance", testCaseInfo, this.environment);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
|
@ -1,37 +1,61 @@
|
||||||
<template>
|
<template>
|
||||||
<el-card style="margin-top: 5px" @click.native="selectTestCase(apiCase,$event)">
|
<el-card style="margin-top: 5px" @click.native="selectTestCase(apiCase,$event)">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="6">
|
<el-col :span="6">
|
||||||
<div class="el-step__icon is-text ms-api-col">
|
<div class="el-step__icon is-text ms-api-col">
|
||||||
<div class="el-step__icon-inner">{{index+1}}</div>
|
<div class="el-step__icon-inner">{{ index + 1 }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<label class="ms-api-label">{{$t('test_track.case.priority')}}</label>
|
<label class="ms-api-label">{{ $t('test_track.case.priority') }}</label>
|
||||||
<el-select size="small" v-model="apiCase.priority" class="ms-api-select" @change="changePriority(apiCase)">
|
<el-select size="small" v-model="apiCase.priority" class="ms-api-select" @change="changePriority(apiCase)">
|
||||||
<el-option v-for="grd in priorities" :key="grd.id" :label="grd.name" :value="grd.id"/>
|
<el-option v-for="grd in priorities" :key="grd.id" :label="grd.name" :value="grd.id"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="10">
|
<el-col :span="10">
|
||||||
<i class="icon el-icon-arrow-right" :class="{'is-active': apiCase.active}"
|
<i class="icon el-icon-arrow-right" :class="{'is-active': apiCase.active}"
|
||||||
@click="active(apiCase)"/>
|
@click="active(apiCase)"/>
|
||||||
<el-input v-if="!apiCase.id || isShowInput" size="small" v-model="apiCase.name" :name="index" :key="index"
|
<el-input v-if="!apiCase.id || isShowInput" size="small" v-model="apiCase.name" :name="index" :key="index"
|
||||||
class="ms-api-header-select" style="width: 180px"
|
class="ms-api-header-select" style="width: 180px"
|
||||||
@blur="saveTestCase(apiCase)" placeholder="请输入用例名称"/>
|
@blur="saveTestCase(apiCase)" placeholder="请输入用例名称"/>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
{{apiCase.id ? apiCase.name:''}}
|
{{ apiCase.id ? apiCase.name : '' }}
|
||||||
<i class="el-icon-edit" style="cursor:pointer" @click="showInput(apiCase)" v-tester/>
|
<i class="el-icon-edit" style="cursor:pointer" @click="showInput(apiCase)" v-tester/>
|
||||||
</span>
|
</span>
|
||||||
<div v-if="apiCase.id" style="color: #999999;font-size: 12px">
|
|
||||||
|
|
||||||
|
<label class="ms-api-label" style="padding-left: 20px; padding-right: 20px;">{{ $t('commons.tag') }}</label>
|
||||||
|
<el-tag
|
||||||
|
:key="apiCase.id + '_' + index"
|
||||||
|
v-for="(tag, index) in apiCase.tags"
|
||||||
|
closable
|
||||||
|
size="mini"
|
||||||
|
:disable-transitions="false"
|
||||||
|
@close="handleClose(tag)">
|
||||||
|
{{ tag }}
|
||||||
|
</el-tag>
|
||||||
|
<el-input
|
||||||
|
class="input-new-tag"
|
||||||
|
v-if="inputVisible"
|
||||||
|
v-model="inputValue"
|
||||||
|
ref="saveTagInput"
|
||||||
|
size="mini"
|
||||||
|
@keyup.enter.native="handleInputConfirm"
|
||||||
|
@blur="handleInputConfirm"
|
||||||
|
>
|
||||||
|
</el-input>
|
||||||
|
<el-button v-else class="button-new-tag" size="mini" @click="showTagInput">+</el-button>
|
||||||
|
|
||||||
|
<div v-if="apiCase.id" style="color: #999999;font-size: 12px">
|
||||||
<span>
|
<span>
|
||||||
{{apiCase.createTime | timestampFormatDate }}
|
{{ apiCase.createTime | timestampFormatDate }}
|
||||||
{{apiCase.createUser}} {{$t('api_test.definition.request.create_info')}}
|
{{ apiCase.createUser }} {{ $t('api_test.definition.request.create_info') }}
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
{{apiCase.updateTime | timestampFormatDate }}
|
{{ apiCase.updateTime | timestampFormatDate }}
|
||||||
{{apiCase.updateUser}} {{$t('api_test.definition.request.update_info')}}
|
{{ apiCase.updateUser }} {{ $t('api_test.definition.request.update_info') }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
<el-col :span="4">
|
<el-col :span="4">
|
||||||
<ms-tip-button @click="singleRun(apiCase)" :tip="$t('api_test.run')" icon="el-icon-video-play"
|
<ms-tip-button @click="singleRun(apiCase)" :tip="$t('api_test.run')" icon="el-icon-video-play"
|
||||||
|
@ -40,270 +64,314 @@
|
||||||
size="mini" :disabled="!apiCase.id || isCaseEdit" circle v-tester/>
|
size="mini" :disabled="!apiCase.id || isCaseEdit" circle v-tester/>
|
||||||
<ms-tip-button @click="deleteCase(index,apiCase)" :tip="$t('commons.delete')" icon="el-icon-delete"
|
<ms-tip-button @click="deleteCase(index,apiCase)" :tip="$t('commons.delete')" icon="el-icon-delete"
|
||||||
size="mini" :disabled="!apiCase.id || isCaseEdit" circle v-tester/>
|
size="mini" :disabled="!apiCase.id || isCaseEdit" circle v-tester/>
|
||||||
<ms-api-extend-btns :is-case-edit="isCaseEdit" :row="apiCase" v-tester/>
|
<ms-api-extend-btns :is-case-edit="isCaseEdit" :environment="environment" :row="apiCase" v-tester/>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
<el-col :span="3">
|
<el-col :span="3">
|
||||||
<el-link type="danger" v-if="apiCase.execResult && apiCase.execResult==='error'" @click="showExecResult(apiCase)">{{getResult(apiCase.execResult)}}</el-link>
|
<el-link type="danger" v-if="apiCase.execResult && apiCase.execResult==='error'" @click="showExecResult(apiCase)">
|
||||||
<el-link v-else-if="apiCase.execResult && apiCase.execResult==='success'" @click="showExecResult(apiCase)">{{getResult(apiCase.execResult)}}</el-link>
|
{{ getResult(apiCase.execResult) }}
|
||||||
<div v-else> {{getResult(apiCase.execResult)}}</div>
|
</el-link>
|
||||||
|
<el-link v-else-if="apiCase.execResult && apiCase.execResult==='success'" @click="showExecResult(apiCase)">
|
||||||
|
{{ getResult(apiCase.execResult) }}
|
||||||
|
</el-link>
|
||||||
|
<div v-else> {{ getResult(apiCase.execResult) }}</div>
|
||||||
|
|
||||||
<div v-if="apiCase.id" style="color: #999999;font-size: 12px">
|
<div v-if="apiCase.id" style="color: #999999;font-size: 12px">
|
||||||
<span> {{apiCase.execTime | timestampFormatDate }}</span>
|
<span> {{ apiCase.execTime | timestampFormatDate }}</span>
|
||||||
{{apiCase.updateUser}}
|
{{ apiCase.updateUser }}
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<!-- 请求参数-->
|
<!-- 请求参数-->
|
||||||
<el-collapse-transition>
|
<el-collapse-transition>
|
||||||
<div v-if="apiCase.active">
|
<div v-if="apiCase.active">
|
||||||
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
<p class="tip">{{ $t('api_test.definition.request.req_param') }} </p>
|
||||||
|
|
||||||
<ms-api-request-form :is-read-only="isReadOnly" :headers="apiCase.request.headers " :request="apiCase.request" v-if="api.protocol==='HTTP'"/>
|
<ms-api-request-form :is-read-only="isReadOnly" :headers="apiCase.request.headers " :request="apiCase.request" v-if="api.protocol==='HTTP'"/>
|
||||||
<ms-tcp-basis-parameters :request="apiCase.request" v-if="api.protocol==='TCP'"/>
|
<ms-tcp-basis-parameters :request="apiCase.request" v-if="api.protocol==='TCP'"/>
|
||||||
<ms-sql-basis-parameters :request="apiCase.request" v-if="api.protocol==='SQL'"/>
|
<ms-sql-basis-parameters :request="apiCase.request" v-if="api.protocol==='SQL'"/>
|
||||||
<ms-dubbo-basis-parameters :request="apiCase.request" v-if="api.protocol==='DUBBO'"/>
|
<ms-dubbo-basis-parameters :request="apiCase.request" v-if="api.protocol==='DUBBO'"/>
|
||||||
<!-- 保存操作 -->
|
<!-- 保存操作 -->
|
||||||
<el-button type="primary" size="small" style="margin: 20px; float: right" @click="saveTestCase(apiCase)" v-tester>
|
<el-button type="primary" size="small" style="margin: 20px; float: right" @click="saveTestCase(apiCase)" v-tester>
|
||||||
{{$t('commons.save')}}
|
{{ $t('commons.save') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-collapse-transition>
|
</el-collapse-transition>
|
||||||
</el-card>
|
</el-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {getCurrentProjectID, getUUID} from "../../../../../../common/js/utils";
|
import {getCurrentProjectID, getUUID} from "../../../../../../common/js/utils";
|
||||||
import {PRIORITY, RESULT_MAP} from "../../model/JsonData";
|
import {PRIORITY, RESULT_MAP} from "../../model/JsonData";
|
||||||
import MsTag from "../../../../common/components/MsTag";
|
import MsTag from "../../../../common/components/MsTag";
|
||||||
import MsTipButton from "../../../../common/components/MsTipButton";
|
import MsTipButton from "../../../../common/components/MsTipButton";
|
||||||
import MsApiRequestForm from "../request/http/ApiRequestForm";
|
import MsApiRequestForm from "../request/http/ApiRequestForm";
|
||||||
import ApiEnvironmentConfig from "../environment/ApiEnvironmentConfig";
|
import ApiEnvironmentConfig from "../environment/ApiEnvironmentConfig";
|
||||||
import MsApiAssertions from "../assertion/ApiAssertions";
|
import MsApiAssertions from "../assertion/ApiAssertions";
|
||||||
import MsSqlBasisParameters from "../request/database/BasisParameters";
|
import MsSqlBasisParameters from "../request/database/BasisParameters";
|
||||||
import MsTcpBasisParameters from "../request/tcp/BasisParameters";
|
import MsTcpBasisParameters from "../request/tcp/BasisParameters";
|
||||||
import MsDubboBasisParameters from "../request/dubbo/BasisParameters";
|
import MsDubboBasisParameters from "../request/dubbo/BasisParameters";
|
||||||
import MsApiExtendBtns from "../reference/ApiExtendBtns";
|
import MsApiExtendBtns from "../reference/ApiExtendBtns";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ApiCaseItem",
|
name: "ApiCaseItem",
|
||||||
components: {
|
components: {
|
||||||
MsTag,
|
MsTag,
|
||||||
MsTipButton,
|
MsTipButton,
|
||||||
MsApiRequestForm,
|
MsApiRequestForm,
|
||||||
ApiEnvironmentConfig,
|
ApiEnvironmentConfig,
|
||||||
MsApiAssertions,
|
MsApiAssertions,
|
||||||
MsSqlBasisParameters,
|
MsSqlBasisParameters,
|
||||||
MsTcpBasisParameters,
|
MsTcpBasisParameters,
|
||||||
MsDubboBasisParameters,
|
MsDubboBasisParameters,
|
||||||
MsApiExtendBtns
|
MsApiExtendBtns
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
result: {},
|
||||||
|
grades: [],
|
||||||
|
isReadOnly: false,
|
||||||
|
selectedEvent: Object,
|
||||||
|
priorities: PRIORITY,
|
||||||
|
runData: [],
|
||||||
|
reportId: "",
|
||||||
|
checkedCases: new Set(),
|
||||||
|
visible: false,
|
||||||
|
condition: {},
|
||||||
|
isShowInput: false,
|
||||||
|
inputVisible: false,
|
||||||
|
inputValue: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
apiCase: {
|
||||||
|
type: Object,
|
||||||
|
default() {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
data() {
|
environment: {},
|
||||||
return {
|
index: {
|
||||||
result: {},
|
type: Number,
|
||||||
grades: [],
|
default() {
|
||||||
environment: {},
|
return 0
|
||||||
isReadOnly: false,
|
}
|
||||||
selectedEvent: Object,
|
},
|
||||||
priorities: PRIORITY,
|
api: {
|
||||||
runData: [],
|
type: Object,
|
||||||
reportId: "",
|
default() {
|
||||||
checkedCases: new Set(),
|
return {}
|
||||||
visible: false,
|
}
|
||||||
condition: {},
|
},
|
||||||
isShowInput: false
|
isCaseEdit: Boolean,
|
||||||
|
},
|
||||||
|
watch: {},
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
deleteCase(index, row) {
|
||||||
|
this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + row.name + " ?", '', {
|
||||||
|
confirmButtonText: this.$t('commons.confirm'),
|
||||||
|
callback: (action) => {
|
||||||
|
if (action === 'confirm') {
|
||||||
|
this.$get('/api/testcase/delete/' + row.id, () => {
|
||||||
|
this.$success(this.$t('commons.delete_success'));
|
||||||
|
this.$emit('refresh');
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
});
|
||||||
props: {
|
|
||||||
apiCase: {
|
|
||||||
type: Object,
|
|
||||||
default() {
|
|
||||||
return {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
index: {
|
|
||||||
type: Number,
|
|
||||||
default() {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
api: {
|
|
||||||
type: Object,
|
|
||||||
default() {
|
|
||||||
return {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
isCaseEdit: Boolean,
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
|
|
||||||
deleteCase(index, row) {
|
},
|
||||||
this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + row.name + " ?", '', {
|
singleRun(data) {
|
||||||
confirmButtonText: this.$t('commons.confirm'),
|
this.$emit('singleRun', data);
|
||||||
callback: (action) => {
|
},
|
||||||
if (action === 'confirm') {
|
copyCase(data) {
|
||||||
this.$get('/api/testcase/delete/' + row.id, () => {
|
let obj = {name: "copy_" + data.name, priority: data.priority, active: true, request: data.request};
|
||||||
this.$success(this.$t('commons.delete_success'));
|
this.$emit('copyCase', obj);
|
||||||
this.$emit('refresh');
|
},
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
selectTestCase(item, $event) {
|
||||||
singleRun(data) {
|
if (!item.id || !this.loaded) {
|
||||||
this.$emit('singleRun', data);
|
return;
|
||||||
},
|
}
|
||||||
copyCase(data) {
|
if ($event.currentTarget.className.indexOf('is-selected') > 0) {
|
||||||
let obj = {name: "copy_" + data.name, priority: data.priority, active: true, request: data.request};
|
$event.currentTarget.className = "el-card is-always-shadow";
|
||||||
this.$emit('copyCase', obj);
|
this.$emit('selectTestCase', null);
|
||||||
},
|
} else {
|
||||||
|
if (this.selectedEvent.currentTarget != undefined) {
|
||||||
|
this.selectedEvent.currentTarget.className = "el-card is-always-shadow";
|
||||||
|
}
|
||||||
|
this.selectedEvent.currentTarget = $event.currentTarget;
|
||||||
|
$event.currentTarget.className = "el-card is-always-shadow is-selected";
|
||||||
|
this.$emit('selectTestCase', item);
|
||||||
|
}
|
||||||
|
|
||||||
selectTestCase(item, $event) {
|
},
|
||||||
if (!item.id || !this.loaded) {
|
changePriority(row) {
|
||||||
return;
|
if (row.id) {
|
||||||
}
|
this.saveTestCase(row);
|
||||||
if ($event.currentTarget.className.indexOf('is-selected') > 0) {
|
}
|
||||||
$event.currentTarget.className = "el-card is-always-shadow";
|
},
|
||||||
this.$emit('selectTestCase', null);
|
saveTestCase(row) {
|
||||||
} else {
|
this.isShowInput = false;
|
||||||
if (this.selectedEvent.currentTarget != undefined) {
|
if (this.validate(row)) {
|
||||||
this.selectedEvent.currentTarget.className = "el-card is-always-shadow";
|
return;
|
||||||
}
|
}
|
||||||
this.selectedEvent.currentTarget = $event.currentTarget;
|
let bodyFiles = this.getBodyUploadFiles(row);
|
||||||
$event.currentTarget.className = "el-card is-always-shadow is-selected";
|
row.projectId = getCurrentProjectID();
|
||||||
this.$emit('selectTestCase', item);
|
row.active = true;
|
||||||
}
|
row.request.path = this.api.path;
|
||||||
|
row.request.method = this.api.method;
|
||||||
},
|
row.apiDefinitionId = row.apiDefinitionId || this.api.id;
|
||||||
changePriority(row) {
|
let url = "/api/testcase/create";
|
||||||
if (row.id) {
|
if (row.id) {
|
||||||
this.saveTestCase(row);
|
url = "/api/testcase/update";
|
||||||
}
|
}
|
||||||
},
|
this.$fileUpload(url, null, bodyFiles, row, () => {
|
||||||
saveTestCase(row) {
|
this.$success(this.$t('commons.save_success'));
|
||||||
this.isShowInput = false;
|
this.$emit('refresh');
|
||||||
if (this.validate(row)) {
|
});
|
||||||
return;
|
},
|
||||||
}
|
showInput(row) {
|
||||||
let bodyFiles = this.getBodyUploadFiles(row);
|
// row.type = "create";
|
||||||
row.projectId = getCurrentProjectID();
|
this.isShowInput = true;
|
||||||
row.active = true;
|
row.active = true;
|
||||||
row.request.path = this.api.path;
|
this.active(row);
|
||||||
row.request.method = this.api.method;
|
},
|
||||||
row.apiDefinitionId = row.apiDefinitionId || this.api.id;
|
active(item) {
|
||||||
let url = "/api/testcase/create";
|
item.active = !item.active;
|
||||||
if (row.id) {
|
},
|
||||||
url = "/api/testcase/update";
|
getResult(data) {
|
||||||
}
|
if (RESULT_MAP.get(data)) {
|
||||||
this.$fileUpload(url, null, bodyFiles, row, () => {
|
return RESULT_MAP.get(data);
|
||||||
this.$success(this.$t('commons.save_success'));
|
} else {
|
||||||
this.$emit('refresh');
|
return RESULT_MAP.get("default");
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
showInput(row) {
|
validate(row) {
|
||||||
// row.type = "create";
|
if (!row.name) {
|
||||||
this.isShowInput = true;
|
this.$warning(this.$t('api_test.input_name'));
|
||||||
row.active = true;
|
return true;
|
||||||
this.active(row);
|
}
|
||||||
},
|
},
|
||||||
active(item) {
|
showExecResult(data) {
|
||||||
item.active = !item.active;
|
this.$emit('showExecResult', data);
|
||||||
},
|
},
|
||||||
getResult(data) {
|
getBodyUploadFiles(row) {
|
||||||
if (RESULT_MAP.get(data)) {
|
let bodyUploadFiles = [];
|
||||||
return RESULT_MAP.get(data);
|
row.bodyUploadIds = [];
|
||||||
} else {
|
let request = row.request;
|
||||||
return RESULT_MAP.get("default");
|
if (request.body && request.body.kvs) {
|
||||||
}
|
request.body.kvs.forEach(param => {
|
||||||
},
|
if (param.files) {
|
||||||
validate(row) {
|
param.files.forEach(item => {
|
||||||
if (!row.name) {
|
if (item.file) {
|
||||||
this.$warning(this.$t('api_test.input_name'));
|
let fileId = getUUID().substring(0, 8);
|
||||||
return true;
|
item.name = item.file.name;
|
||||||
}
|
item.id = fileId;
|
||||||
},
|
row.bodyUploadIds.push(fileId);
|
||||||
showExecResult(data) {
|
bodyUploadFiles.push(item.file);
|
||||||
this.$emit('showExecResult', data);
|
|
||||||
},
|
|
||||||
getBodyUploadFiles(row) {
|
|
||||||
let bodyUploadFiles = [];
|
|
||||||
row.bodyUploadIds = [];
|
|
||||||
let request = row.request;
|
|
||||||
if (request.body && request.body.kvs) {
|
|
||||||
request.body.kvs.forEach(param => {
|
|
||||||
if (param.files) {
|
|
||||||
param.files.forEach(item => {
|
|
||||||
if (item.file) {
|
|
||||||
let fileId = getUUID().substring(0, 8);
|
|
||||||
item.name = item.file.name;
|
|
||||||
item.id = fileId;
|
|
||||||
row.bodyUploadIds.push(fileId);
|
|
||||||
bodyUploadFiles.push(item.file);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (request.body.binary) {
|
}
|
||||||
request.body.binary.forEach(param => {
|
});
|
||||||
if (param.files) {
|
if (request.body.binary) {
|
||||||
param.files.forEach(item => {
|
request.body.binary.forEach(param => {
|
||||||
if (item.file) {
|
if (param.files) {
|
||||||
let fileId = getUUID().substring(0, 8);
|
param.files.forEach(item => {
|
||||||
item.name = item.file.name;
|
if (item.file) {
|
||||||
item.id = fileId;
|
let fileId = getUUID().substring(0, 8);
|
||||||
row.bodyUploadIds.push(fileId);
|
item.name = item.file.name;
|
||||||
bodyUploadFiles.push(item.file);
|
item.id = fileId;
|
||||||
}
|
row.bodyUploadIds.push(fileId);
|
||||||
});
|
bodyUploadFiles.push(item.file);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
return bodyUploadFiles;
|
}
|
||||||
},
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
return bodyUploadFiles;
|
||||||
|
},
|
||||||
|
handleClose(tag) {
|
||||||
|
this.apiCase.tags.splice(this.apiCase.tags.indexOf(tag), 1);
|
||||||
|
this.saveTestCase(this.apiCase)
|
||||||
|
},
|
||||||
|
|
||||||
|
showTagInput() {
|
||||||
|
this.inputVisible = true;
|
||||||
|
this.$nextTick(_ => {
|
||||||
|
this.$refs.saveTagInput.$refs.input.focus();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
handleInputConfirm() {
|
||||||
|
let inputValue = this.inputValue;
|
||||||
|
if (inputValue) {
|
||||||
|
this.apiCase.tags.push(inputValue);
|
||||||
|
this.saveTestCase(this.apiCase)
|
||||||
|
}
|
||||||
|
this.inputVisible = false;
|
||||||
|
this.inputValue = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.ms-api-select {
|
.ms-api-select {
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
width: 80px;
|
width: 80px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ms-api-header-select {
|
.ms-api-header-select {
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
min-width: 100px;
|
min-width: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ms-api-label {
|
.ms-api-label {
|
||||||
color: #CCCCCC;
|
color: #CCCCCC;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ms-api-col {
|
.ms-api-col {
|
||||||
background-color: #7C3985;
|
background-color: #7C3985;
|
||||||
border-color: #7C3985;
|
border-color: #7C3985;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.is-active {
|
.icon.is-active {
|
||||||
transform: rotate(90deg);
|
transform: rotate(90deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.tip {
|
.tip {
|
||||||
padding: 3px 5px;
|
padding: 3px 5px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
border-left: 4px solid #783887;
|
border-left: 4px solid #783887;
|
||||||
margin: 20px 0;
|
margin: 20px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.is-selected {
|
.is-selected {
|
||||||
background: #EFF7FF;
|
background: #EFF7FF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.el-tag + .el-tag {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-new-tag {
|
||||||
|
margin-left: 10px;
|
||||||
|
height: 20px;
|
||||||
|
/*line-height: 30px;*/
|
||||||
|
padding-top: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-new-tag {
|
||||||
|
width: 90px;
|
||||||
|
margin-left: 10px;
|
||||||
|
vertical-align: bottom;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
@singleRun="singleRun"
|
@singleRun="singleRun"
|
||||||
@copyCase="copyCase"
|
@copyCase="copyCase"
|
||||||
@showExecResult="showExecResult"
|
@showExecResult="showExecResult"
|
||||||
|
:environment="environment"
|
||||||
:is-case-edit="isCaseEdit"
|
:is-case-edit="isCaseEdit"
|
||||||
:api="api"
|
:api="api"
|
||||||
:api-case="item" :index="index"/>
|
:api-case="item" :index="index"/>
|
||||||
|
@ -42,216 +43,224 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import ApiCaseHeader from "./ApiCaseHeader";
|
import ApiCaseHeader from "./ApiCaseHeader";
|
||||||
import ApiCaseItem from "./ApiCaseItem";
|
import ApiCaseItem from "./ApiCaseItem";
|
||||||
import MsRun from "../Run";
|
import MsRun from "../Run";
|
||||||
import {downloadFile, getUUID, getCurrentProjectID} from "@/common/js/utils";
|
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
|
||||||
import MsDrawer from "../../../../common/components/MsDrawer";
|
import MsDrawer from "../../../../common/components/MsDrawer";
|
||||||
import {PRIORITY} from "../../model/JsonData";
|
import {PRIORITY} from "../../model/JsonData";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ApiCaseList',
|
name: 'ApiCaseList',
|
||||||
components: {
|
components: {
|
||||||
MsDrawer,
|
MsDrawer,
|
||||||
MsRun,
|
MsRun,
|
||||||
ApiCaseHeader,
|
ApiCaseHeader,
|
||||||
ApiCaseItem,
|
ApiCaseItem,
|
||||||
|
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
createCase: String,
|
||||||
|
loaded: Boolean,
|
||||||
|
refreshSign: String,
|
||||||
|
currentApi: {
|
||||||
|
type: Object
|
||||||
},
|
},
|
||||||
props: {
|
},
|
||||||
createCase: String,
|
data() {
|
||||||
loaded: Boolean,
|
return {
|
||||||
refreshSign: String,
|
result: {},
|
||||||
currentApi: {
|
grades: [],
|
||||||
type: Object
|
environment: {},
|
||||||
},
|
isReadOnly: false,
|
||||||
},
|
selectedEvent: Object,
|
||||||
data() {
|
priorities: PRIORITY,
|
||||||
return {
|
apiCaseList: [],
|
||||||
result: {},
|
batchLoading: false,
|
||||||
grades: [],
|
singleLoading: false,
|
||||||
environment: {},
|
singleRunId: "",
|
||||||
isReadOnly: false,
|
runData: [],
|
||||||
selectedEvent: Object,
|
reportId: "",
|
||||||
priorities: PRIORITY,
|
projectId: "",
|
||||||
apiCaseList: [],
|
testCaseId: "",
|
||||||
batchLoading: false,
|
checkedCases: new Set(),
|
||||||
singleLoading: false,
|
visible: false,
|
||||||
singleRunId: "",
|
condition: {},
|
||||||
runData: [],
|
api: {}
|
||||||
reportId: "",
|
}
|
||||||
projectId: "",
|
},
|
||||||
testCaseId: "",
|
watch: {
|
||||||
checkedCases: new Set(),
|
refreshSign() {
|
||||||
visible: false,
|
|
||||||
condition: {},
|
|
||||||
api: {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
refreshSign() {
|
|
||||||
this.api = this.currentApi;
|
|
||||||
this.getApiTest();
|
|
||||||
},
|
|
||||||
createCase() {
|
|
||||||
this.api = this.currentApi;
|
|
||||||
this.sysAddition();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.api = this.currentApi;
|
this.api = this.currentApi;
|
||||||
this.projectId = getCurrentProjectID();
|
this.getApiTest();
|
||||||
if (this.createCase) {
|
|
||||||
this.sysAddition();
|
|
||||||
} else {
|
|
||||||
this.getApiTest();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
computed: {
|
createCase() {
|
||||||
isCaseEdit() {
|
this.api = this.currentApi;
|
||||||
return this.testCaseId ? true : false;
|
this.sysAddition();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.api = this.currentApi;
|
||||||
|
this.projectId = getCurrentProjectID();
|
||||||
|
if (this.createCase) {
|
||||||
|
this.sysAddition();
|
||||||
|
} else {
|
||||||
|
this.getApiTest();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
isCaseEdit() {
|
||||||
|
return this.testCaseId ? true : false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
open(api, testCaseId) {
|
||||||
|
this.api = api;
|
||||||
|
// testCaseId 不为空则为用例编辑页面
|
||||||
|
this.testCaseId = testCaseId;
|
||||||
|
this.getApiTest();
|
||||||
|
this.visible = true;
|
||||||
},
|
},
|
||||||
methods: {
|
setEnvironment(environment) {
|
||||||
open(api, testCaseId) {
|
this.environment = environment;
|
||||||
this.api = api;
|
},
|
||||||
// testCaseId 不为空则为用例编辑页面
|
sysAddition() {
|
||||||
this.testCaseId = testCaseId;
|
this.condition.projectId = this.projectId;
|
||||||
this.getApiTest();
|
this.condition.apiDefinitionId = this.api.id;
|
||||||
this.visible = true;
|
this.$post("/api/testcase/list", this.condition, response => {
|
||||||
},
|
for (let index in response.data) {
|
||||||
setEnvironment(environment) {
|
let test = response.data[index];
|
||||||
this.environment = environment;
|
test.request = JSON.parse(test.request);
|
||||||
},
|
}
|
||||||
sysAddition() {
|
this.apiCaseList = response.data;
|
||||||
|
this.addCase();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
apiCaseClose() {
|
||||||
|
this.apiCaseList = [];
|
||||||
|
this.visible = false;
|
||||||
|
},
|
||||||
|
|
||||||
|
runRefresh(data) {
|
||||||
|
this.batchLoading = false;
|
||||||
|
this.singleLoading = false;
|
||||||
|
this.singleRunId = "";
|
||||||
|
this.$success(this.$t('schedule.event_success'));
|
||||||
|
this.getApiTest();
|
||||||
|
this.$emit('refresh');
|
||||||
|
},
|
||||||
|
|
||||||
|
refresh(data) {
|
||||||
|
this.getApiTest();
|
||||||
|
this.$emit('refresh');
|
||||||
|
},
|
||||||
|
|
||||||
|
getApiTest() {
|
||||||
|
if (this.api) {
|
||||||
this.condition.projectId = this.projectId;
|
this.condition.projectId = this.projectId;
|
||||||
this.condition.apiDefinitionId = this.api.id;
|
if (this.isCaseEdit) {
|
||||||
this.$post("/api/testcase/list", this.condition, response => {
|
this.condition.id = this.testCaseId;
|
||||||
|
} else {
|
||||||
|
this.condition.apiDefinitionId = this.api.id;
|
||||||
|
}
|
||||||
|
this.result = this.$post("/api/testcase/list", this.condition, response => {
|
||||||
for (let index in response.data) {
|
for (let index in response.data) {
|
||||||
let test = response.data[index];
|
let test = response.data[index];
|
||||||
test.request = JSON.parse(test.request);
|
test.request = JSON.parse(test.request);
|
||||||
|
if (!test.request.hashTree) {
|
||||||
|
test.request.hashTree = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.apiCaseList = response.data;
|
this.apiCaseList = response.data;
|
||||||
this.addCase();
|
if (this.apiCaseList.length == 0 && !this.loaded) {
|
||||||
});
|
this.addCase();
|
||||||
},
|
|
||||||
|
|
||||||
apiCaseClose() {
|
|
||||||
this.apiCaseList = [];
|
|
||||||
this.visible = false;
|
|
||||||
},
|
|
||||||
|
|
||||||
runRefresh(data) {
|
|
||||||
this.batchLoading = false;
|
|
||||||
this.singleLoading = false;
|
|
||||||
this.singleRunId = "";
|
|
||||||
this.$success(this.$t('schedule.event_success'));
|
|
||||||
this.getApiTest();
|
|
||||||
this.$emit('refresh');
|
|
||||||
},
|
|
||||||
|
|
||||||
refresh(data) {
|
|
||||||
this.getApiTest();
|
|
||||||
this.$emit('refresh');
|
|
||||||
},
|
|
||||||
|
|
||||||
getApiTest() {
|
|
||||||
if (this.api) {
|
|
||||||
this.condition.projectId = this.projectId;
|
|
||||||
if (this.isCaseEdit) {
|
|
||||||
this.condition.id = this.testCaseId;
|
|
||||||
} else {
|
|
||||||
this.condition.apiDefinitionId = this.api.id;
|
|
||||||
}
|
}
|
||||||
this.result = this.$post("/api/testcase/list", this.condition, response => {
|
this.apiCaseList.forEach(apiCase => {
|
||||||
for (let index in response.data) {
|
if (!apiCase.tags) {
|
||||||
let test = response.data[index];
|
apiCase.tags = [];
|
||||||
test.request = JSON.parse(test.request);
|
} else {
|
||||||
if (!test.request.hashTree) {
|
apiCase.tags = JSON.parse(apiCase.tags);
|
||||||
test.request.hashTree = [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.apiCaseList = response.data;
|
|
||||||
if (this.apiCaseList.length == 0 && !this.loaded) {
|
|
||||||
this.addCase();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
addCase() {
|
|
||||||
if (this.api.request) {
|
|
||||||
// 初始化对象
|
|
||||||
let request = {};
|
|
||||||
if (this.api.request instanceof Object) {
|
|
||||||
request = this.api.request;
|
|
||||||
} else {
|
|
||||||
request = JSON.parse(this.api.request);
|
|
||||||
}
|
|
||||||
let obj = {apiDefinitionId: this.api.id, name: '', priority: 'P0', active: true};
|
|
||||||
obj.request = request;
|
|
||||||
this.apiCaseList.unshift(obj);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
copyCase(data) {
|
|
||||||
this.apiCaseList.unshift(data);
|
|
||||||
},
|
|
||||||
|
|
||||||
handleClose() {
|
|
||||||
this.visible = false;
|
|
||||||
},
|
|
||||||
showExecResult(row) {
|
|
||||||
this.visible = false;
|
|
||||||
this.$emit('showExecResult', row);
|
|
||||||
},
|
|
||||||
|
|
||||||
singleRun(row) {
|
|
||||||
if (!this.environment || !this.environment) {
|
|
||||||
this.$warning(this.$t('api_test.environment.select_environment'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.runData = [];
|
|
||||||
this.singleLoading = true;
|
|
||||||
this.singleRunId = row.id;
|
|
||||||
row.request.name = row.id;
|
|
||||||
row.request.useEnvironment = this.environment.id;
|
|
||||||
this.runData.push(row.request);
|
|
||||||
/*触发执行操作*/
|
|
||||||
this.reportId = getUUID().substring(0, 8);
|
|
||||||
},
|
|
||||||
|
|
||||||
batchRun() {
|
|
||||||
if (!this.environment) {
|
|
||||||
this.$warning(this.$t('api_test.environment.select_environment'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (this.apiCaseList.length > 0) {
|
|
||||||
this.apiCaseList.forEach(item => {
|
|
||||||
if (item.id) {
|
|
||||||
item.request.name = item.id;
|
|
||||||
item.request.useEnvironment = this.environment.id;
|
|
||||||
this.runData.push(item.request);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (this.runData.length > 0) {
|
|
||||||
this.batchLoading = true;
|
});
|
||||||
/*触发执行操作*/
|
}
|
||||||
this.reportId = getUUID().substring(0, 8);
|
},
|
||||||
} else {
|
addCase() {
|
||||||
this.$warning("没有可执行的用例!");
|
if (this.api.request) {
|
||||||
|
// 初始化对象
|
||||||
|
let request = {};
|
||||||
|
if (this.api.request instanceof Object) {
|
||||||
|
request = this.api.request;
|
||||||
|
} else {
|
||||||
|
request = JSON.parse(this.api.request);
|
||||||
|
}
|
||||||
|
let obj = {apiDefinitionId: this.api.id, name: '', priority: 'P0', active: true, tags: []};
|
||||||
|
obj.request = request;
|
||||||
|
this.apiCaseList.unshift(obj);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
copyCase(data) {
|
||||||
|
this.apiCaseList.unshift(data);
|
||||||
|
},
|
||||||
|
|
||||||
|
handleClose() {
|
||||||
|
this.visible = false;
|
||||||
|
},
|
||||||
|
showExecResult(row) {
|
||||||
|
this.visible = false;
|
||||||
|
this.$emit('showExecResult', row);
|
||||||
|
},
|
||||||
|
|
||||||
|
singleRun(row) {
|
||||||
|
if (!this.environment || !this.environment) {
|
||||||
|
this.$warning(this.$t('api_test.environment.select_environment'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.runData = [];
|
||||||
|
this.singleLoading = true;
|
||||||
|
this.singleRunId = row.id;
|
||||||
|
row.request.name = row.id;
|
||||||
|
row.request.useEnvironment = this.environment.id;
|
||||||
|
this.runData.push(row.request);
|
||||||
|
/*触发执行操作*/
|
||||||
|
this.reportId = getUUID().substring(0, 8);
|
||||||
|
},
|
||||||
|
|
||||||
|
batchRun() {
|
||||||
|
if (!this.environment) {
|
||||||
|
this.$warning(this.$t('api_test.environment.select_environment'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.apiCaseList.length > 0) {
|
||||||
|
this.apiCaseList.forEach(item => {
|
||||||
|
if (item.id) {
|
||||||
|
item.request.name = item.id;
|
||||||
|
item.request.useEnvironment = this.environment.id;
|
||||||
|
this.runData.push(item.request);
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
if (this.runData.length > 0) {
|
||||||
|
this.batchLoading = true;
|
||||||
|
/*触发执行操作*/
|
||||||
|
this.reportId = getUUID().substring(0, 8);
|
||||||
} else {
|
} else {
|
||||||
this.$warning("没有可执行的用例!");
|
this.$warning("没有可执行的用例!");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this.$warning("没有可执行的用例!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
.ms-drawer >>> .ms-drawer-body {
|
.ms-drawer >>> .ms-drawer-body {
|
||||||
margin-top: 80px;
|
margin-top: 80px;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -52,7 +52,32 @@
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col>
|
<el-col :span="8">
|
||||||
|
<el-form-item :label="$t('commons.tag')" prop="tag">
|
||||||
|
<el-tag
|
||||||
|
:key="basicForm + '_' + index"
|
||||||
|
v-for="(tag, index) in basicForm.tags"
|
||||||
|
closable
|
||||||
|
size="mini"
|
||||||
|
:disable-transitions="false"
|
||||||
|
@close="handleClose(tag)">
|
||||||
|
{{ tag }}
|
||||||
|
</el-tag>
|
||||||
|
<el-input
|
||||||
|
class="input-new-tag"
|
||||||
|
v-if="inputVisible"
|
||||||
|
v-model="inputValue"
|
||||||
|
ref="saveTagInput"
|
||||||
|
size="mini"
|
||||||
|
@keyup.enter.native="handleInputConfirm"
|
||||||
|
@blur="handleInputConfirm"
|
||||||
|
>
|
||||||
|
</el-input>
|
||||||
|
<el-button v-else class="button-new-tag" size="mini" @click="showInput">+</el-button>
|
||||||
|
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="16">
|
||||||
<el-form-item :label="$t('commons.description')" prop="description">
|
<el-form-item :label="$t('commons.description')" prop="description">
|
||||||
<el-input class="ms-http-textarea"
|
<el-input class="ms-http-textarea"
|
||||||
v-model="basicForm.description"
|
v-model="basicForm.description"
|
||||||
|
@ -67,10 +92,10 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {API_STATUS} from "../../model/JsonData";
|
import {API_STATUS} from "../../model/JsonData";
|
||||||
import {WORKSPACE_ID} from '../../../../../../common/js/constants';
|
import {WORKSPACE_ID} from '../../../../../../common/js/constants';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsBasisApi",
|
name: "MsBasisApi",
|
||||||
components: {},
|
components: {},
|
||||||
props: {
|
props: {
|
||||||
|
@ -83,6 +108,11 @@
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getMaintainerOptions();
|
this.getMaintainerOptions();
|
||||||
|
if (!this.basisData.tags) {
|
||||||
|
this.basisData.tags = [];
|
||||||
|
} else {
|
||||||
|
this.basisData.tags = JSON.parse(this.basisData.tags);
|
||||||
|
}
|
||||||
this.basicForm = this.basisData;
|
this.basicForm = this.basisData;
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
@ -103,7 +133,8 @@
|
||||||
},
|
},
|
||||||
value: API_STATUS[0].id,
|
value: API_STATUS[0].id,
|
||||||
options: API_STATUS,
|
options: API_STATUS,
|
||||||
|
inputVisible: false,
|
||||||
|
inputValue: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -129,9 +160,45 @@
|
||||||
createModules(){
|
createModules(){
|
||||||
this.$emit("createRootModelInTree");
|
this.$emit("createRootModelInTree");
|
||||||
},
|
},
|
||||||
|
handleClose(tag) {
|
||||||
|
this.basicForm.tags.splice(this.basicForm.tags.indexOf(tag), 1);
|
||||||
|
},
|
||||||
|
|
||||||
|
showInput() {
|
||||||
|
this.inputVisible = true;
|
||||||
|
this.$nextTick(_ => {
|
||||||
|
this.$refs.saveTagInput.$refs.input.focus();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
handleInputConfirm() {
|
||||||
|
let inputValue = this.inputValue;
|
||||||
|
if (inputValue) {
|
||||||
|
this.basicForm.tags.push(inputValue);
|
||||||
|
}
|
||||||
|
this.inputVisible = false;
|
||||||
|
this.inputValue = '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.el-tag + .el-tag {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-new-tag {
|
||||||
|
margin-left: 10px;
|
||||||
|
height: 20px;
|
||||||
|
/*line-height: 30px;*/
|
||||||
|
padding-top: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-new-tag {
|
||||||
|
width: 90px;
|
||||||
|
margin-left: 10px;
|
||||||
|
vertical-align: bottom;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
<el-form :model="httpForm" :rules="rule" ref="httpForm" :inline="true" label-position="right">
|
<el-form :model="httpForm" :rules="rule" ref="httpForm" :inline="true" label-position="right">
|
||||||
<!-- 操作按钮 -->
|
<!-- 操作按钮 -->
|
||||||
<div style="float: right;margin-right: 20px">
|
<div style="float: right;margin-right: 20px">
|
||||||
<el-button type="primary" size="small" @click="saveApi">{{$t('commons.save')}}</el-button>
|
<el-button type="primary" size="small" @click="saveApi">{{ $t('commons.save') }}</el-button>
|
||||||
<el-button type="primary" size="small" @click="runTest">{{$t('commons.test')}}</el-button>
|
<el-button type="primary" size="small" @click="runTest">{{ $t('commons.test') }}</el-button>
|
||||||
</div>
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
<p class="tip">{{$t('test_track.plan_view.base_info')}} </p>
|
<p class="tip">{{ $t('test_track.plan_view.base_info') }} </p>
|
||||||
|
|
||||||
<!-- 基础信息 -->
|
<!-- 基础信息 -->
|
||||||
<div class="base-info">
|
<div class="base-info">
|
||||||
|
@ -42,9 +42,9 @@
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<el-option :key="0" :value="''">
|
<el-option :key="0" :value="''">
|
||||||
<div style="margin-left: 40px">
|
<div style="margin-left: 40px">
|
||||||
<span style="font-size: 14px;color: #606266;font-weight: 48.93">{{$t('api_test.definition.select_comp.no_data')}},
|
<span style="font-size: 14px;color: #606266;font-weight: 48.93">{{ $t('api_test.definition.select_comp.no_data') }},
|
||||||
</span>
|
</span>
|
||||||
<el-link type="primary" @click="createModules">{{$t('api_test.definition.select_comp.add_data')}}</el-link>
|
<el-link type="primary" @click="createModules">{{ $t('api_test.definition.select_comp.add_data') }}</el-link>
|
||||||
</div>
|
</div>
|
||||||
</el-option>
|
</el-option>
|
||||||
</div>
|
</div>
|
||||||
|
@ -75,186 +75,261 @@
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-form-item :label="$t('commons.description')" prop="description">
|
<el-col :span="8">
|
||||||
<el-input class="ms-http-textarea"
|
<el-form-item :label="$t('commons.tag')" prop="tag">
|
||||||
v-model="httpForm.description"
|
<el-tag
|
||||||
type="textarea"
|
:key="httpForm + '_' + index"
|
||||||
:autosize="{ minRows: 2, maxRows: 10}"
|
v-for="(tag, index) in httpForm.tags"
|
||||||
:rows="2" size="small"/>
|
closable
|
||||||
</el-form-item>
|
size="mini"
|
||||||
|
:disable-transitions="false"
|
||||||
|
@close="handleClose(tag)">
|
||||||
|
{{ tag }}
|
||||||
|
</el-tag>
|
||||||
|
<el-input
|
||||||
|
class="input-new-tag"
|
||||||
|
v-if="inputVisible"
|
||||||
|
v-model="inputValue"
|
||||||
|
ref="saveTagInput"
|
||||||
|
size="mini"
|
||||||
|
@keyup.enter.native="handleInputConfirm"
|
||||||
|
@blur="handleInputConfirm"
|
||||||
|
>
|
||||||
|
</el-input>
|
||||||
|
<el-button v-else class="button-new-tag" size="mini" @click="showInput">+</el-button>
|
||||||
|
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="16">
|
||||||
|
<el-form-item :label="$t('commons.description')" prop="description">
|
||||||
|
<el-input class="ms-http-textarea"
|
||||||
|
v-model="httpForm.description"
|
||||||
|
type="textarea"
|
||||||
|
:autosize="{ minRows: 2, maxRows: 10}"
|
||||||
|
:rows="2" size="small"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 请求参数 -->
|
<!-- 请求参数 -->
|
||||||
<div>
|
<div>
|
||||||
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
<p class="tip">{{ $t('api_test.definition.request.req_param') }} </p>
|
||||||
<ms-api-request-form :showScript="false" :request="request" :headers="request.headers" :isShowEnable="isShowEnable"/>
|
<ms-api-request-form :showScript="false" :request="request" :headers="request.headers" :isShowEnable="isShowEnable"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<!-- 响应内容-->
|
<!-- 响应内容-->
|
||||||
<p class="tip">{{$t('api_test.definition.request.res_param')}} </p>
|
<p class="tip">{{ $t('api_test.definition.request.res_param') }} </p>
|
||||||
<ms-response-text :response="response"></ms-response-text>
|
<ms-response-text :response="response"></ms-response-text>
|
||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MsApiRequestForm from "../request/http/ApiRequestForm";
|
import MsApiRequestForm from "../request/http/ApiRequestForm";
|
||||||
import MsResponseText from "../response/ResponseText";
|
import MsResponseText from "../response/ResponseText";
|
||||||
import {WORKSPACE_ID} from '../../../../../../common/js/constants';
|
import {WORKSPACE_ID} from '../../../../../../common/js/constants';
|
||||||
import {REQ_METHOD, API_STATUS} from "../../model/JsonData";
|
import {API_STATUS, REQ_METHOD} from "../../model/JsonData";
|
||||||
import MsJsr233Processor from "../processor/Jsr233Processor";
|
import MsJsr233Processor from "../processor/Jsr233Processor";
|
||||||
import {KeyValue} from "../../model/ApiTestModel";
|
import {KeyValue} from "../../model/ApiTestModel";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsAddCompleteHttpApi",
|
name: "MsAddCompleteHttpApi",
|
||||||
components: {MsResponseText, MsApiRequestForm, MsJsr233Processor},
|
components: {MsResponseText, MsApiRequestForm, MsJsr233Processor},
|
||||||
data() {
|
data() {
|
||||||
let validateURL = (rule, value, callback) => {
|
let validateURL = (rule, value, callback) => {
|
||||||
if (!this.httpForm.path.startsWith("/") || this.httpForm.path.match(/\s/) != null) {
|
if (!this.httpForm.path.startsWith("/") || this.httpForm.path.match(/\s/) != null) {
|
||||||
callback(this.$t('api_test.definition.request.path_valid_info'));
|
callback(this.$t('api_test.definition.request.path_valid_info'));
|
||||||
}
|
|
||||||
callback();
|
|
||||||
};
|
|
||||||
return {
|
|
||||||
rule: {
|
|
||||||
name: [
|
|
||||||
{required: true, message: this.$t('test_track.case.input_name'), trigger: 'blur'},
|
|
||||||
{max: 50, message: this.$t('test_track.length_less_than') + '50', trigger: 'blur'}
|
|
||||||
],
|
|
||||||
path: [{required: true, message: this.$t('api_test.definition.request.path_info'), trigger: 'blur'}, {validator: validateURL, trigger: 'blur'}],
|
|
||||||
userId: [{required: true, message: this.$t('test_track.case.input_maintainer'), trigger: 'change'}],
|
|
||||||
moduleId: [{required: true, message: this.$t('test_track.case.input_module'), trigger: 'change'}],
|
|
||||||
status: [{required: true, message: this.$t('commons.please_select'), trigger: 'change'}],
|
|
||||||
},
|
|
||||||
httpForm: {environmentId: ""},
|
|
||||||
isShowEnable: false,
|
|
||||||
maintainerOptions: [],
|
|
||||||
currentModule: {},
|
|
||||||
reqOptions: REQ_METHOD,
|
|
||||||
options: API_STATUS,
|
|
||||||
}
|
}
|
||||||
},
|
callback();
|
||||||
props: {moduleOptions: {}, request: {}, response: {}, basisData: {}},
|
};
|
||||||
methods: {
|
return {
|
||||||
runTest() {
|
rule: {
|
||||||
this.$refs['httpForm'].validate((valid) => {
|
name: [
|
||||||
if (valid) {
|
{required: true, message: this.$t('test_track.case.input_name'), trigger: 'blur'},
|
||||||
this.setParameter();
|
{max: 50, message: this.$t('test_track.length_less_than') + '50', trigger: 'blur'}
|
||||||
this.$emit('runTest', this.httpForm);
|
],
|
||||||
} else {
|
path: [{required: true, message: this.$t('api_test.definition.request.path_info'), trigger: 'blur'}, {
|
||||||
return false;
|
validator: validateURL,
|
||||||
}
|
trigger: 'blur'
|
||||||
})
|
}],
|
||||||
|
userId: [{required: true, message: this.$t('test_track.case.input_maintainer'), trigger: 'change'}],
|
||||||
|
moduleId: [{required: true, message: this.$t('test_track.case.input_module'), trigger: 'change'}],
|
||||||
|
status: [{required: true, message: this.$t('commons.please_select'), trigger: 'change'}],
|
||||||
},
|
},
|
||||||
getMaintainerOptions() {
|
httpForm: {environmentId: "", tags: []},
|
||||||
let workspaceId = localStorage.getItem(WORKSPACE_ID);
|
isShowEnable: false,
|
||||||
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
|
maintainerOptions: [],
|
||||||
this.maintainerOptions = response.data;
|
currentModule: {},
|
||||||
});
|
reqOptions: REQ_METHOD,
|
||||||
},
|
options: API_STATUS,
|
||||||
setParameter() {
|
inputVisible: false,
|
||||||
this.httpForm.modulePath = this.getPath(this.httpForm.moduleId);
|
inputValue: ''
|
||||||
this.request.path = this.httpForm.path;
|
|
||||||
this.request.method = this.httpForm.method;
|
|
||||||
this.httpForm.request.useEnvironment = undefined;
|
|
||||||
},
|
|
||||||
saveApi() {
|
|
||||||
this.$refs['httpForm'].validate((valid) => {
|
|
||||||
if (valid) {
|
|
||||||
this.setParameter();
|
|
||||||
this.$emit('saveApi', this.httpForm);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
createModules() {
|
|
||||||
this.$emit("createRootModelInTree");
|
|
||||||
},
|
|
||||||
getPath(id) {
|
|
||||||
if (id === null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
let path = this.moduleOptions.filter(function (item) {
|
|
||||||
return item.id === id ? item.path : "";
|
|
||||||
});
|
|
||||||
return path[0].path;
|
|
||||||
},
|
|
||||||
urlChange() {
|
|
||||||
if (!this.httpForm.path || this.httpForm.path.indexOf('?') === -1) return;
|
|
||||||
let url = this.getURL(this.addProtocol(this.httpForm.path));
|
|
||||||
if (url) {
|
|
||||||
this.httpForm.path = decodeURIComponent("/" + url.hostname + url.pathname);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
addProtocol(url) {
|
|
||||||
if (url) {
|
|
||||||
if (!url.toLowerCase().startsWith("https") && !url.toLowerCase().startsWith("http")) {
|
|
||||||
return "https://" + url;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return url;
|
|
||||||
},
|
|
||||||
getURL(urlStr) {
|
|
||||||
try {
|
|
||||||
let url = new URL(urlStr);
|
|
||||||
url.searchParams.forEach((value, key) => {
|
|
||||||
if (key && value) {
|
|
||||||
this.request.arguments.splice(0, 0, new KeyValue({name: key, required: false, value: value}));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return url;
|
|
||||||
} catch (e) {
|
|
||||||
this.$error(this.$t('api_test.request.url_invalid'), 2000);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
created() {
|
|
||||||
this.getMaintainerOptions();
|
|
||||||
if (!this.basisData.environmentId) {
|
|
||||||
this.basisData.environmentId = "";
|
|
||||||
}
|
|
||||||
this.httpForm = JSON.parse(JSON.stringify(this.basisData));
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
props: {moduleOptions: {}, request: {}, response: {}, basisData: {}},
|
||||||
|
methods: {
|
||||||
|
runTest() {
|
||||||
|
this.$refs['httpForm'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.setParameter();
|
||||||
|
this.$emit('runTest', this.httpForm);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getMaintainerOptions() {
|
||||||
|
let workspaceId = localStorage.getItem(WORKSPACE_ID);
|
||||||
|
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
|
||||||
|
this.maintainerOptions = response.data;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
setParameter() {
|
||||||
|
this.httpForm.modulePath = this.getPath(this.httpForm.moduleId);
|
||||||
|
this.request.path = this.httpForm.path;
|
||||||
|
this.request.method = this.httpForm.method;
|
||||||
|
this.httpForm.request.useEnvironment = undefined;
|
||||||
|
},
|
||||||
|
saveApi() {
|
||||||
|
this.$refs['httpForm'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.setParameter();
|
||||||
|
this.$emit('saveApi', this.httpForm);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
createModules() {
|
||||||
|
this.$emit("createRootModelInTree");
|
||||||
|
},
|
||||||
|
getPath(id) {
|
||||||
|
if (id === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
let path = this.moduleOptions.filter(function (item) {
|
||||||
|
return item.id === id ? item.path : "";
|
||||||
|
});
|
||||||
|
return path[0].path;
|
||||||
|
},
|
||||||
|
urlChange() {
|
||||||
|
if (!this.httpForm.path || this.httpForm.path.indexOf('?') === -1) return;
|
||||||
|
let url = this.getURL(this.addProtocol(this.httpForm.path));
|
||||||
|
if (url) {
|
||||||
|
this.httpForm.path = decodeURIComponent("/" + url.hostname + url.pathname);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
addProtocol(url) {
|
||||||
|
if (url) {
|
||||||
|
if (!url.toLowerCase().startsWith("https") && !url.toLowerCase().startsWith("http")) {
|
||||||
|
return "https://" + url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
},
|
||||||
|
getURL(urlStr) {
|
||||||
|
try {
|
||||||
|
let url = new URL(urlStr);
|
||||||
|
url.searchParams.forEach((value, key) => {
|
||||||
|
if (key && value) {
|
||||||
|
this.request.arguments.splice(0, 0, new KeyValue({name: key, required: false, value: value}));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return url;
|
||||||
|
} catch (e) {
|
||||||
|
this.$error(this.$t('api_test.request.url_invalid'), 2000);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
handleClose(tag) {
|
||||||
|
this.httpForm.tags.splice(this.httpForm.tags.indexOf(tag), 1);
|
||||||
|
},
|
||||||
|
|
||||||
|
showInput() {
|
||||||
|
this.inputVisible = true;
|
||||||
|
this.$nextTick(_ => {
|
||||||
|
this.$refs.saveTagInput.$refs.input.focus();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
handleInputConfirm() {
|
||||||
|
let inputValue = this.inputValue;
|
||||||
|
if (inputValue) {
|
||||||
|
this.httpForm.tags.push(inputValue);
|
||||||
|
}
|
||||||
|
this.inputVisible = false;
|
||||||
|
this.inputValue = '';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
this.getMaintainerOptions();
|
||||||
|
if (!this.basisData.environmentId) {
|
||||||
|
this.basisData.environmentId = "";
|
||||||
|
}
|
||||||
|
if (!this.basisData.tags) {
|
||||||
|
this.basisData.tags = [];
|
||||||
|
} else {
|
||||||
|
this.basisData.tags = JSON.parse(this.basisData.tags);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.httpForm = JSON.parse(JSON.stringify(this.basisData));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
.base-info .el-form-item {
|
.base-info .el-form-item {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.base-info .el-form-item >>> .el-form-item__content {
|
.base-info .el-form-item >>> .el-form-item__content {
|
||||||
width: 80%;
|
width: 80%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.base-info .ms-http-select {
|
.base-info .ms-http-select {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tip {
|
.tip {
|
||||||
padding: 3px 5px;
|
padding: 3px 5px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
border-left: 4px solid #783887;
|
border-left: 4px solid #783887;
|
||||||
margin: 20px 0;
|
margin: 20px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ms-http-textarea {
|
.ms-http-textarea {
|
||||||
width: 400px;
|
width: 400px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ms-left-cell {
|
.ms-left-cell {
|
||||||
margin-top: 100px;
|
margin-top: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ms-left-buttion {
|
.ms-left-buttion {
|
||||||
margin: 6px 0px 8px 30px;
|
margin: 6px 0px 8px 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.el-tag + .el-tag {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-new-tag {
|
||||||
|
margin-left: 10px;
|
||||||
|
height: 20px;
|
||||||
|
/*line-height: 30px;*/
|
||||||
|
padding-top: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-new-tag {
|
||||||
|
width: 90px;
|
||||||
|
margin-left: 10px;
|
||||||
|
vertical-align: bottom;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -17,7 +17,9 @@ export default class JDBCSampler extends Sampler {
|
||||||
this.type = "JDBCSampler";
|
this.type = "JDBCSampler";
|
||||||
this.hashTree = [];
|
this.hashTree = [];
|
||||||
this.variables = [];
|
this.variables = [];
|
||||||
|
this.environmentId = undefined;
|
||||||
this.dataSource = undefined;
|
this.dataSource = undefined;
|
||||||
|
this.dataSourceId = undefined;
|
||||||
this.query = undefined;
|
this.query = undefined;
|
||||||
this.queryType = undefined;
|
this.queryType = undefined;
|
||||||
this.queryArguments = undefined;
|
this.queryArguments = undefined;
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
:is-api-list-enable="isApiListEnable"
|
:is-api-list-enable="isApiListEnable"
|
||||||
@isApiListEnableChange="isApiListEnableChange">
|
@isApiListEnableChange="isApiListEnableChange">
|
||||||
|
|
||||||
<el-input placeholder="搜索" @blur="search" @keyup.enter.native="search" class="search-input" size="small" v-model="condition.name"/>
|
<el-input placeholder="搜索" @blur="search" @keyup.enter.native="search" class="search-input" size="small"
|
||||||
|
v-model="condition.name"/>
|
||||||
|
|
||||||
<el-table v-loading="result.loading"
|
<el-table v-loading="result.loading"
|
||||||
ref="caseTable"
|
ref="caseTable"
|
||||||
|
@ -22,10 +23,10 @@
|
||||||
</span>
|
</span>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-dropdown-item @click.native.stop="isSelectDataAll(true)">
|
<el-dropdown-item @click.native.stop="isSelectDataAll(true)">
|
||||||
{{$t('api_test.batch_menus.select_all_data',[total])}}
|
{{ $t('api_test.batch_menus.select_all_data', [total]) }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item @click.native.stop="isSelectDataAll(false)">
|
<el-dropdown-item @click.native.stop="isSelectDataAll(false)">
|
||||||
{{$t('api_test.batch_menus.select_show_data',[tableData.length])}}
|
{{ $t('api_test.batch_menus.select_show_data', [tableData.length]) }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
|
@ -72,8 +73,12 @@
|
||||||
<el-table-column v-if="!isReadOnly" :label="$t('commons.operating')" min-width="130" align="center">
|
<el-table-column v-if="!isReadOnly" :label="$t('commons.operating')" min-width="130" align="center">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<!--<el-button type="text" @click="reductionApi(scope.row)" v-if="trashEnable">{{$t('commons.reduction')}}</el-button>-->
|
<!--<el-button type="text" @click="reductionApi(scope.row)" v-if="trashEnable">{{$t('commons.reduction')}}</el-button>-->
|
||||||
<el-button type="text" @click="handleTestCase(scope.row)" v-if="!trashEnable">{{$t('commons.edit')}}</el-button>
|
<el-button type="text" @click="handleTestCase(scope.row)" v-if="!trashEnable">{{ $t('commons.edit') }}
|
||||||
<el-button type="text" @click="handleDelete(scope.row)" style="color: #F56C6C">{{$t('commons.delete')}}</el-button>
|
</el-button>
|
||||||
|
<el-button type="text" @click="handleDelete(scope.row)" style="color: #F56C6C">{{ $t('commons.delete') }}
|
||||||
|
</el-button>
|
||||||
|
<ms-api-case-table-extend-btns @showCaseRef="showCaseRef" @showEnvironment="showEnvironment" @createPerformance="createPerformance" :row="scope.row" v-tester/>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
|
@ -85,160 +90,178 @@
|
||||||
<api-case-list @showExecResult="showExecResult" @refresh="initTable" :currentApi="selectCase" ref="caseList"/>
|
<api-case-list @showExecResult="showExecResult" @refresh="initTable" :currentApi="selectCase" ref="caseList"/>
|
||||||
<!--批量编辑-->
|
<!--批量编辑-->
|
||||||
<ms-batch-edit ref="batchEdit" @batchEdit="batchEdit" :typeArr="typeArr" :value-arr="valueArr"/>
|
<ms-batch-edit ref="batchEdit" @batchEdit="batchEdit" :typeArr="typeArr" :value-arr="valueArr"/>
|
||||||
|
<!--选择环境(当创建性能测试的时候)-->
|
||||||
|
<ms-set-environment ref="setEnvironment" :testCase="clickRow" @createPerformance="createPerformance"/>
|
||||||
|
<!--查看引用-->
|
||||||
|
<ms-reference-view ref="viewRef"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import MsTableOperator from "../../../../common/components/MsTableOperator";
|
import MsTableOperator from "../../../../common/components/MsTableOperator";
|
||||||
import MsTableOperatorButton from "../../../../common/components/MsTableOperatorButton";
|
import MsTableOperatorButton from "../../../../common/components/MsTableOperatorButton";
|
||||||
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
|
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
|
||||||
import MsTablePagination from "../../../../common/pagination/TablePagination";
|
import MsTablePagination from "../../../../common/pagination/TablePagination";
|
||||||
import MsTag from "../../../../common/components/MsTag";
|
import MsTag from "../../../../common/components/MsTag";
|
||||||
import MsApiCaseList from "../case/ApiCaseList";
|
import MsApiCaseList from "../case/ApiCaseList";
|
||||||
import MsContainer from "../../../../common/components/MsContainer";
|
import MsContainer from "../../../../common/components/MsContainer";
|
||||||
import MsBottomContainer from "../BottomContainer";
|
import MsBottomContainer from "../BottomContainer";
|
||||||
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
|
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
|
||||||
import MsBatchEdit from "../basis/BatchEdit";
|
import MsBatchEdit from "../basis/BatchEdit";
|
||||||
import {API_METHOD_COLOUR, CASE_PRIORITY, REQ_METHOD} from "../../model/JsonData";
|
import {API_METHOD_COLOUR, CASE_PRIORITY, REQ_METHOD} from "../../model/JsonData";
|
||||||
import {getCurrentProjectID} from "@/common/js/utils";
|
|
||||||
import ApiListContainer from "./ApiListContainer";
|
|
||||||
import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem";
|
|
||||||
import ApiCaseList from "../case/ApiCaseList";
|
|
||||||
import {_filter, _sort} from "../../../../../../common/js/utils";
|
|
||||||
import {_handleSelect, _handleSelectAll} from "../../../../../../common/js/tableUtils";
|
|
||||||
|
|
||||||
export default {
|
import {getBodyUploadFiles,getCurrentProjectID} from "@/common/js/utils";
|
||||||
name: "ApiCaseSimpleList",
|
import ApiListContainer from "./ApiListContainer";
|
||||||
components: {
|
import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem";
|
||||||
ApiCaseList,
|
import ApiCaseList from "../case/ApiCaseList";
|
||||||
PriorityTableItem,
|
import {_filter, _sort} from "../../../../../../common/js/utils";
|
||||||
ApiListContainer,
|
import TestPlanCaseListHeader from "../../../../track/plan/view/comonents/api/TestPlanCaseListHeader";
|
||||||
MsTableOperatorButton,
|
import MsEnvironmentSelect from "../case/MsEnvironmentSelect";
|
||||||
MsTableOperator,
|
import {_handleSelect, _handleSelectAll} from "../../../../../../common/js/tableUtils";
|
||||||
MsTablePagination,
|
import MsApiCaseTableExtendBtns from "../reference/ApiCaseTableExtendBtns";
|
||||||
MsTag,
|
import MsReferenceView from "../reference/ReferenceView";
|
||||||
MsApiCaseList,
|
import MsSetEnvironment from "@/business/components/api/definition/components/basis/SetEnvironment";
|
||||||
MsContainer,
|
import TestPlan from "@/business/components/api/definition/components/jmeter/components/test-plan";
|
||||||
MsBottomContainer,
|
import ThreadGroup from "@/business/components/api/definition/components/jmeter/components/thread-group";
|
||||||
ShowMoreBtn,
|
import {parseEnvironment} from "@/business/components/api/test/model/EnvironmentModel";
|
||||||
MsBatchEdit
|
|
||||||
|
export default {
|
||||||
|
name: "ApiCaseSimpleList",
|
||||||
|
components: {
|
||||||
|
MsSetEnvironment,
|
||||||
|
ApiCaseList,
|
||||||
|
PriorityTableItem,
|
||||||
|
ApiListContainer,
|
||||||
|
MsTableOperatorButton,
|
||||||
|
MsTableOperator,
|
||||||
|
MsTablePagination,
|
||||||
|
MsTag,
|
||||||
|
MsApiCaseList,
|
||||||
|
MsContainer,
|
||||||
|
MsBottomContainer,
|
||||||
|
ShowMoreBtn,
|
||||||
|
MsBatchEdit,
|
||||||
|
MsApiCaseTableExtendBtns,
|
||||||
|
MsReferenceView,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
condition: {},
|
||||||
|
selectCase: {},
|
||||||
|
result: {},
|
||||||
|
moduleId: "",
|
||||||
|
selectDataRange: "all",
|
||||||
|
deletePath: "/test/case/delete",
|
||||||
|
selectRows: new Set(),
|
||||||
|
clickRow: {},
|
||||||
|
buttons: [
|
||||||
|
{name: this.$t('api_test.definition.request.batch_delete'), handleClick: this.handleDeleteBatch},
|
||||||
|
{name: this.$t('api_test.definition.request.batch_edit'), handleClick: this.handleEditBatch}
|
||||||
|
],
|
||||||
|
typeArr: [
|
||||||
|
{id: 'priority', name: this.$t('test_track.case.priority')},
|
||||||
|
{id: 'method', name: this.$t('api_test.definition.api_type')},
|
||||||
|
{id: 'path', name: this.$t('api_test.request.path')},
|
||||||
|
],
|
||||||
|
priorityFilters: [
|
||||||
|
{text: 'P0', value: 'P0'},
|
||||||
|
{text: 'P1', value: 'P1'},
|
||||||
|
{text: 'P2', value: 'P2'},
|
||||||
|
{text: 'P3', value: 'P3'}
|
||||||
|
],
|
||||||
|
valueArr: {
|
||||||
|
priority: CASE_PRIORITY,
|
||||||
|
method: REQ_METHOD,
|
||||||
|
},
|
||||||
|
methodColorMap: new Map(API_METHOD_COLOUR),
|
||||||
|
tableData: [],
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
total: 0,
|
||||||
|
screenHeight: document.documentElement.clientHeight - 330,//屏幕高度
|
||||||
|
environmentId: undefined,
|
||||||
|
selectAll: false,
|
||||||
|
unSelection: [],
|
||||||
|
selectDataCounts: 0,
|
||||||
|
environments: [],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
currentProtocol: String,
|
||||||
|
selectNodeIds: Array,
|
||||||
|
visible: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
},
|
},
|
||||||
data() {
|
trashEnable: {
|
||||||
return {
|
type: Boolean,
|
||||||
condition: {},
|
default: false,
|
||||||
selectCase: {},
|
},
|
||||||
result: {},
|
isApiListEnable: {
|
||||||
moduleId: "",
|
type: Boolean,
|
||||||
selectDataRange: "all",
|
default: false,
|
||||||
deletePath: "/test/case/delete",
|
},
|
||||||
selectRows: new Set(),
|
isReadOnly: {
|
||||||
buttons: [
|
type: Boolean,
|
||||||
{name: this.$t('api_test.definition.request.batch_delete'), handleClick: this.handleDeleteBatch},
|
default: false
|
||||||
{name: this.$t('api_test.definition.request.batch_edit'), handleClick: this.handleEditBatch}
|
},
|
||||||
],
|
isCaseRelevance: {
|
||||||
typeArr: [
|
type: Boolean,
|
||||||
{id: 'priority', name: this.$t('test_track.case.priority')},
|
default: false,
|
||||||
{id: 'method', name: this.$t('api_test.definition.api_type')},
|
},
|
||||||
{id: 'path', name: this.$t('api_test.request.path')},
|
relevanceProjectId: String,
|
||||||
],
|
model: {
|
||||||
priorityFilters: [
|
type: String,
|
||||||
{text: 'P0', value: 'P0'},
|
default() {
|
||||||
{text: 'P1', value: 'P1'},
|
'api'
|
||||||
{text: 'P2', value: 'P2'},
|
|
||||||
{text: 'P3', value: 'P3'}
|
|
||||||
],
|
|
||||||
valueArr: {
|
|
||||||
priority: CASE_PRIORITY,
|
|
||||||
method: REQ_METHOD,
|
|
||||||
},
|
|
||||||
methodColorMap: new Map(API_METHOD_COLOUR),
|
|
||||||
tableData: [],
|
|
||||||
currentPage: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
total: 0,
|
|
||||||
screenHeight: document.documentElement.clientHeight - 330,//屏幕高度
|
|
||||||
environmentId: undefined,
|
|
||||||
selectAll: false,
|
|
||||||
unSelection: [],
|
|
||||||
selectDataCounts: 0,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
planId: String
|
||||||
currentProtocol: String,
|
},
|
||||||
selectNodeIds: Array,
|
created: function () {
|
||||||
visible: {
|
this.initTable();
|
||||||
type: Boolean,
|
},
|
||||||
default: false,
|
watch: {
|
||||||
},
|
selectNodeIds() {
|
||||||
trashEnable: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
isApiListEnable: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
isReadOnly: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
isCaseRelevance: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
relevanceProjectId: String,
|
|
||||||
model: {
|
|
||||||
type: String,
|
|
||||||
default() {
|
|
||||||
'api'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
planId: String
|
|
||||||
},
|
|
||||||
created: function () {
|
|
||||||
this.initTable();
|
this.initTable();
|
||||||
},
|
},
|
||||||
watch: {
|
currentProtocol() {
|
||||||
selectNodeIds() {
|
this.initTable();
|
||||||
this.initTable();
|
},
|
||||||
},
|
trashEnable() {
|
||||||
currentProtocol() {
|
if (this.trashEnable) {
|
||||||
this.initTable();
|
|
||||||
},
|
|
||||||
trashEnable() {
|
|
||||||
if (this.trashEnable) {
|
|
||||||
this.initTable();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
relevanceProjectId() {
|
|
||||||
this.initTable();
|
this.initTable();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
relevanceProjectId() {
|
||||||
|
this.initTable();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
|
||||||
// 接口定义用例列表
|
// 接口定义用例列表
|
||||||
isApiModel() {
|
isApiModel() {
|
||||||
return this.model === 'api'
|
return this.model === 'api'
|
||||||
},
|
|
||||||
},
|
},
|
||||||
methods: {
|
},
|
||||||
isApiListEnableChange(data) {
|
methods: {
|
||||||
this.$emit('isApiListEnableChange', data);
|
isApiListEnableChange(data) {
|
||||||
},
|
this.$emit('isApiListEnableChange', data);
|
||||||
initTable() {
|
},
|
||||||
this.selectRows = new Set();
|
initTable() {
|
||||||
this.condition.status = "";
|
this.selectRows = new Set();
|
||||||
this.condition.moduleIds = this.selectNodeIds;
|
this.condition.status = "";
|
||||||
if (this.trashEnable) {
|
this.condition.moduleIds = this.selectNodeIds;
|
||||||
this.condition.status = "Trash";
|
if (this.trashEnable) {
|
||||||
this.condition.moduleIds = [];
|
this.condition.status = "Trash";
|
||||||
}
|
this.condition.moduleIds = [];
|
||||||
this.selectAll = false;
|
}
|
||||||
this.unSelection = [];
|
this.selectAll = false;
|
||||||
this.selectDataCounts = 0;
|
this.unSelection = [];
|
||||||
this.condition.projectId = getCurrentProjectID();
|
this.selectDataCounts = 0;
|
||||||
|
this.condition.projectId = getCurrentProjectID();
|
||||||
|
|
||||||
if (this.currentProtocol != null) {
|
if (this.currentProtocol != null) {
|
||||||
this.condition.protocol = this.currentProtocol;
|
this.condition.protocol = this.currentProtocol;
|
||||||
|
@ -304,169 +327,246 @@
|
||||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||||
},
|
},
|
||||||
|
|
||||||
handleTestCase(testCase) {
|
handleTestCase(testCase) {
|
||||||
this.$get('/api/definition/get/' + testCase.apiDefinitionId, (response) => {
|
this.$get('/api/definition/get/' + testCase.apiDefinitionId, (response) => {
|
||||||
let api = response.data;
|
let api = response.data;
|
||||||
let selectApi = api;
|
let selectApi = api;
|
||||||
let request = {};
|
let request = {};
|
||||||
if (Object.prototype.toString.call(api.request).match(/\[object (\w+)\]/)[1].toLowerCase() === 'object') {
|
if (Object.prototype.toString.call(api.request).match(/\[object (\w+)\]/)[1].toLowerCase() === 'object') {
|
||||||
request = api.request;
|
request = api.request;
|
||||||
} else {
|
|
||||||
request = JSON.parse(api.request);
|
|
||||||
}
|
|
||||||
if (!request.hashTree) {
|
|
||||||
request.hashTree = [];
|
|
||||||
}
|
|
||||||
selectApi.url = request.path;
|
|
||||||
this.$refs.caseList.open(selectApi, testCase.id);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
reductionApi(row) {
|
|
||||||
let ids = [row.id];
|
|
||||||
this.$post('/api/testcase/reduction/', ids, () => {
|
|
||||||
this.$success(this.$t('commons.save_success'));
|
|
||||||
this.search();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
handleDeleteBatch() {
|
|
||||||
// if (this.trashEnable) {
|
|
||||||
this.$alert(this.$t('api_test.definition.request.delete_confirm') + "?", '', {
|
|
||||||
confirmButtonText: this.$t('commons.confirm'),
|
|
||||||
callback: (action) => {
|
|
||||||
if (action === 'confirm') {
|
|
||||||
let obj = {};
|
|
||||||
obj.projectId = getCurrentProjectID();
|
|
||||||
obj.selectAllDate = this.isSelectAllDate;
|
|
||||||
obj.unSelectIds = this.unSelection;
|
|
||||||
obj.ids = Array.from(this.selectRows).map(row => row.id);
|
|
||||||
obj = Object.assign(obj, this.condition);
|
|
||||||
this.$post('/api/testcase/deleteBatchByParam/', obj, () => {
|
|
||||||
this.selectRows.clear();
|
|
||||||
this.initTable();
|
|
||||||
this.$success(this.$t('commons.delete_success'));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// } else {
|
|
||||||
// this.$alert(this.$t('api_test.definition.request.delete_confirm') + "?", '', {
|
|
||||||
// confirmButtonText: this.$t('commons.confirm'),
|
|
||||||
// callback: (action) => {
|
|
||||||
// if (action === 'confirm') {
|
|
||||||
// let ids = Array.from(this.selectRows).map(row => row.id);
|
|
||||||
// this.$post('/api/testcase/removeToGc/', ids, () => {
|
|
||||||
// this.selectRows.clear();
|
|
||||||
// this.initTable();
|
|
||||||
// this.$success(this.$t('commons.delete_success'));
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
handleEditBatch() {
|
|
||||||
this.$refs.batchEdit.open();
|
|
||||||
},
|
|
||||||
batchEdit(form) {
|
|
||||||
let arr = Array.from(this.selectRows);
|
|
||||||
let ids = arr.map(row => row.id);
|
|
||||||
let param = {};
|
|
||||||
param[form.type] = form.value;
|
|
||||||
param.ids = ids;
|
|
||||||
param.projectId = getCurrentProjectID();
|
|
||||||
param.selectAllDate = this.isSelectAllDate;
|
|
||||||
param.unSelectIds = this.unSelection;
|
|
||||||
param = Object.assign(param, this.condition);
|
|
||||||
this.$post('/api/testcase/batch/editByParam', param, () => {
|
|
||||||
this.$success(this.$t('commons.save_success'));
|
|
||||||
this.initTable();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
handleDelete(apiCase) {
|
|
||||||
// if (this.trashEnable) {
|
|
||||||
this.$get('/api/testcase/delete/' + apiCase.id, () => {
|
|
||||||
this.$success(this.$t('commons.delete_success'));
|
|
||||||
this.initTable();
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
// }
|
|
||||||
// this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + apiCase.name + " ?", '', {
|
|
||||||
// confirmButtonText: this.$t('commons.confirm'),
|
|
||||||
// callback: (action) => {
|
|
||||||
// if (action === 'confirm') {
|
|
||||||
// let ids = [apiCase.id];
|
|
||||||
// this.$post('/api/testcase/removeToGc/', ids, () => {
|
|
||||||
// this.$success(this.$t('commons.delete_success'));
|
|
||||||
// this.initTable();
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
},
|
|
||||||
setEnvironment(data) {
|
|
||||||
this.environmentId = data.id;
|
|
||||||
},
|
|
||||||
selectRowsCount(selection) {
|
|
||||||
let selectedIDs = this.getIds(selection);
|
|
||||||
let allIDs = this.tableData.map(s => s.id);
|
|
||||||
this.unSelection = allIDs.filter(function (val) {
|
|
||||||
return selectedIDs.indexOf(val) === -1
|
|
||||||
});
|
|
||||||
if (this.isSelectAllDate) {
|
|
||||||
this.selectDataCounts = this.total - this.unSelection.length;
|
|
||||||
} else {
|
} else {
|
||||||
this.selectDataCounts = selection.size;
|
request = JSON.parse(api.request);
|
||||||
}
|
}
|
||||||
},
|
if (!request.hashTree) {
|
||||||
isSelectDataAll(dataType) {
|
request.hashTree = [];
|
||||||
this.isSelectAllDate = dataType;
|
|
||||||
this.selectRowsCount(this.selectRows)
|
|
||||||
//如果已经全选,不需要再操作了
|
|
||||||
if (this.selectRows.size != this.tableData.length) {
|
|
||||||
this.$refs.caseTable.toggleAllSelection(true);
|
|
||||||
}
|
}
|
||||||
},
|
selectApi.url = request.path;
|
||||||
//判断是否只显示本周的数据。 从首页跳转过来的请求会带有相关参数
|
this.$refs.caseList.open(selectApi, testCase.id);
|
||||||
isSelectThissWeekData() {
|
});
|
||||||
this.selectDataRange = "all";
|
},
|
||||||
let routeParam = this.$route.params.dataSelectRange;
|
reductionApi(row) {
|
||||||
let dataType = this.$route.params.dataType;
|
let ids = [row.id];
|
||||||
if (dataType === 'apiTestCase') {
|
this.$post('/api/testcase/reduction/', ids, () => {
|
||||||
this.selectDataRange = routeParam;
|
this.$success(this.$t('commons.save_success'));
|
||||||
|
this.search();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDeleteBatch() {
|
||||||
|
// if (this.trashEnable) {
|
||||||
|
this.$alert(this.$t('api_test.definition.request.delete_confirm') + "?", '', {
|
||||||
|
confirmButtonText: this.$t('commons.confirm'),
|
||||||
|
callback: (action) => {
|
||||||
|
if (action === 'confirm') {
|
||||||
|
let obj = {};
|
||||||
|
obj.projectId = getCurrentProjectID();
|
||||||
|
obj.selectAllDate = this.isSelectAllDate;
|
||||||
|
obj.unSelectIds = this.unSelection;
|
||||||
|
obj.ids = Array.from(this.selectRows).map(row => row.id);
|
||||||
|
obj = Object.assign(obj, this.condition);
|
||||||
|
this.$post('/api/testcase/deleteBatchByParam/', obj, () => {
|
||||||
|
this.selectRows.clear();
|
||||||
|
this.initTable();
|
||||||
|
this.$success(this.$t('commons.delete_success'));
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
});
|
||||||
changeSelectDataRangeAll() {
|
// } else {
|
||||||
this.$emit("changeSelectDataRangeAll", "testCase");
|
// this.$alert(this.$t('api_test.definition.request.delete_confirm') + "?", '', {
|
||||||
},
|
// confirmButtonText: this.$t('commons.confirm'),
|
||||||
getIds(rowSets) {
|
// callback: (action) => {
|
||||||
let rowArray = Array.from(rowSets)
|
// if (action === 'confirm') {
|
||||||
let ids = rowArray.map(s => s.id);
|
// let ids = Array.from(this.selectRows).map(row => row.id);
|
||||||
return ids;
|
// this.$post('/api/testcase/removeToGc/', ids, () => {
|
||||||
|
// this.selectRows.clear();
|
||||||
|
// this.initTable();
|
||||||
|
// this.$success(this.$t('commons.delete_success'));
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
handleEditBatch() {
|
||||||
|
this.$refs.batchEdit.open();
|
||||||
|
},
|
||||||
|
batchEdit(form) {
|
||||||
|
let arr = Array.from(this.selectRows);
|
||||||
|
let ids = arr.map(row => row.id);
|
||||||
|
let param = {};
|
||||||
|
param[form.type] = form.value;
|
||||||
|
param.ids = ids;
|
||||||
|
param.projectId = getCurrentProjectID();
|
||||||
|
param.selectAllDate = this.isSelectAllDate;
|
||||||
|
param.unSelectIds = this.unSelection;
|
||||||
|
param = Object.assign(param, this.condition);
|
||||||
|
this.$post('/api/testcase/batch/editByParam', param, () => {
|
||||||
|
this.$success(this.$t('commons.save_success'));
|
||||||
|
this.initTable();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDelete(apiCase) {
|
||||||
|
// if (this.trashEnable) {
|
||||||
|
this.$get('/api/testcase/delete/' + apiCase.id, () => {
|
||||||
|
this.$success(this.$t('commons.delete_success'));
|
||||||
|
this.initTable();
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
// }
|
||||||
|
// this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + apiCase.name + " ?", '', {
|
||||||
|
// confirmButtonText: this.$t('commons.confirm'),
|
||||||
|
// callback: (action) => {
|
||||||
|
// if (action === 'confirm') {
|
||||||
|
// let ids = [apiCase.id];
|
||||||
|
// this.$post('/api/testcase/removeToGc/', ids, () => {
|
||||||
|
// this.$success(this.$t('commons.delete_success'));
|
||||||
|
// this.initTable();
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
},
|
||||||
|
setEnvironment(data) {
|
||||||
|
this.environmentId = data.id;
|
||||||
|
},
|
||||||
|
selectRowsCount(selection) {
|
||||||
|
let selectedIDs = this.getIds(selection);
|
||||||
|
let allIDs = this.tableData.map(s => s.id);
|
||||||
|
this.unSelection = allIDs.filter(function (val) {
|
||||||
|
return selectedIDs.indexOf(val) === -1
|
||||||
|
});
|
||||||
|
if (this.isSelectAllDate) {
|
||||||
|
this.selectDataCounts = this.total - this.unSelection.length;
|
||||||
|
} else {
|
||||||
|
this.selectDataCounts = selection.size;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
isSelectDataAll(dataType) {
|
||||||
|
this.isSelectAllDate = dataType;
|
||||||
|
this.selectRowsCount(this.selectRows)
|
||||||
|
//如果已经全选,不需要再操作了
|
||||||
|
if (this.selectRows.size != this.tableData.length) {
|
||||||
|
this.$refs.caseTable.toggleAllSelection(true);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//判断是否只显示本周的数据。 从首页跳转过来的请求会带有相关参数
|
||||||
|
isSelectThissWeekData() {
|
||||||
|
this.selectDataRange = "all";
|
||||||
|
let routeParam = this.$route.params.dataSelectRange;
|
||||||
|
let dataType = this.$route.params.dataType;
|
||||||
|
if (dataType === 'apiTestCase') {
|
||||||
|
this.selectDataRange = routeParam;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
changeSelectDataRangeAll() {
|
||||||
|
this.$emit("changeSelectDataRangeAll", "testCase");
|
||||||
|
},
|
||||||
|
getIds(rowSets) {
|
||||||
|
let rowArray = Array.from(rowSets)
|
||||||
|
let ids = rowArray.map(s => s.id);
|
||||||
|
return ids;
|
||||||
|
},
|
||||||
|
showCaseRef(row) {
|
||||||
|
this.$refs.viewRef.open(row);
|
||||||
|
},
|
||||||
|
showEnvironment(row) {
|
||||||
|
|
||||||
|
let projectID = getCurrentProjectID();
|
||||||
|
if (this.projectId) {
|
||||||
|
this.$get('/api/environment/list/' + this.projectId, response => {
|
||||||
|
this.environments = response.data;
|
||||||
|
this.environments.forEach(environment => {
|
||||||
|
parseEnvironment(environment);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.environment = undefined;
|
||||||
|
}
|
||||||
|
this.clickRow = row;
|
||||||
|
this.$refs.setEnvironment.open(row);
|
||||||
|
},
|
||||||
|
createPerformance(row, environment) {
|
||||||
|
/**
|
||||||
|
* 思路:调用后台创建性能测试的方法,把当前案例的hashTree在后台转化为jmx并文件创建性能测试。
|
||||||
|
* 然后跳转到修改性能测试的页面
|
||||||
|
*
|
||||||
|
* 性能测试保存地址: performance/save
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
if (!environment) {
|
||||||
|
this.$warning(this.$t('api_test.environment.select_environment'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let runData = [];
|
||||||
|
let singleLoading = true;
|
||||||
|
row.request = JSON.parse(row.request);
|
||||||
|
row.request.name = row.id;
|
||||||
|
row.request.useEnvironment = environment.id;
|
||||||
|
runData.push(row.request);
|
||||||
|
/*触发执行操作*/
|
||||||
|
let testPlan = new TestPlan();
|
||||||
|
let threadGroup = new ThreadGroup();
|
||||||
|
threadGroup.hashTree = [];
|
||||||
|
testPlan.hashTree = [threadGroup];
|
||||||
|
runData.forEach(item => {
|
||||||
|
threadGroup.hashTree.push(item);
|
||||||
|
})
|
||||||
|
let reqObj = {
|
||||||
|
id: row.id,
|
||||||
|
testElement: testPlan,
|
||||||
|
name: row.name,
|
||||||
|
projectId: getCurrentProjectID(),
|
||||||
|
};
|
||||||
|
let bodyFiles = getBodyUploadFiles(reqObj, runData);
|
||||||
|
reqObj.reportId = "run";
|
||||||
|
|
||||||
|
let url = "/api/genPerformanceTestXml";
|
||||||
|
|
||||||
|
this.$fileUpload(url, null, bodyFiles, reqObj, response => {
|
||||||
|
let jmxObj = {};
|
||||||
|
jmxObj.name = response.data.name;
|
||||||
|
jmxObj.xml = response.data.xml;
|
||||||
|
this.$store.commit('setTest', {
|
||||||
|
name: row.name,
|
||||||
|
jmx: jmxObj
|
||||||
|
})
|
||||||
|
this.$router.push({
|
||||||
|
path: "/performance/test/create"
|
||||||
|
})
|
||||||
|
// let performanceId = response.data;
|
||||||
|
// if(performanceId!=null){
|
||||||
|
// this.$router.push({
|
||||||
|
// path: "/performance/test/edit/"+performanceId,
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
}, erro => {
|
||||||
|
this.$emit('runRefresh', {});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.operate-button > div {
|
.operate-button > div {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.request-method {
|
.request-method {
|
||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
color: #1E90FF;
|
color: #1E90FF;
|
||||||
}
|
}
|
||||||
|
|
||||||
.api-el-tag {
|
.api-el-tag {
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-input {
|
.search-input {
|
||||||
float: right;
|
float: right;
|
||||||
width: 300px;
|
width: 300px;
|
||||||
/*margin-bottom: 20px;*/
|
/*margin-bottom: 20px;*/
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<api-list-container
|
<api-list-container
|
||||||
:is-api-list-enable="isApiListEnable"
|
:is-api-list-enable="isApiListEnable"
|
||||||
@isApiListEnableChange="isApiListEnableChange">
|
@isApiListEnableChange="isApiListEnableChange">
|
||||||
|
|
||||||
<el-input placeholder="搜索" @blur="search" class="search-input" size="small" @keyup.enter.native="search"
|
<el-input placeholder="搜索" @blur="search" class="search-input" size="small" @keyup.enter.native="search"
|
||||||
v-model="condition.name"/>
|
v-model="condition.name"/>
|
||||||
|
@ -47,8 +47,9 @@
|
||||||
:label="$t('api_test.definition.api_type')"
|
:label="$t('api_test.definition.api_type')"
|
||||||
show-overflow-tooltip>
|
show-overflow-tooltip>
|
||||||
<template v-slot:default="scope" class="request-method">
|
<template v-slot:default="scope" class="request-method">
|
||||||
<el-tag size="mini" :style="{'background-color': getColor(true, scope.row.method), border: getColor(true, scope.row.method)}" class="api-el-tag">
|
<el-tag size="mini" :style="{'background-color': getColor(true, scope.row.method), border: getColor(true, scope.row.method)}"
|
||||||
{{ scope.row.method}}
|
class="api-el-tag">
|
||||||
|
{{ scope.row.method }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -63,6 +64,15 @@
|
||||||
:label="$t('api_test.definition.api_principal')"
|
:label="$t('api_test.definition.api_principal')"
|
||||||
show-overflow-tooltip/>
|
show-overflow-tooltip/>
|
||||||
|
|
||||||
|
<el-table-column prop="tags" :label="$t('commons.tag')">
|
||||||
|
<template v-slot:default="scope">
|
||||||
|
<ms-tag v-for="(tag, index) in scope.row.showTags"
|
||||||
|
:key="tag + '_' + index"
|
||||||
|
:effect="'light'"
|
||||||
|
:content="tag"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column width="160" :label="$t('api_test.definition.api_last_time')" prop="updateTime">
|
<el-table-column width="160" :label="$t('api_test.definition.api_last_time')" prop="updateTime">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||||
|
@ -87,10 +97,10 @@
|
||||||
|
|
||||||
<el-table-column v-if="!isReadOnly" :label="$t('commons.operating')" min-width="130" align="center">
|
<el-table-column v-if="!isReadOnly" :label="$t('commons.operating')" min-width="130" align="center">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<el-button type="text" @click="reductionApi(scope.row)" v-if="trashEnable" v-tester>{{$t('commons.reduction')}}</el-button>
|
<el-button type="text" @click="reductionApi(scope.row)" v-if="trashEnable" v-tester>{{ $t('commons.reduction') }}</el-button>
|
||||||
<el-button type="text" @click="editApi(scope.row)" v-else v-tester>{{$t('commons.edit')}}</el-button>
|
<el-button type="text" @click="editApi(scope.row)" v-else v-tester>{{ $t('commons.edit') }}</el-button>
|
||||||
<el-button type="text" @click="handleTestCase(scope.row)">{{$t('api_test.definition.request.case')}}</el-button>
|
<el-button type="text" @click="handleTestCase(scope.row)">{{ $t('api_test.definition.request.case') }}</el-button>
|
||||||
<el-button type="text" @click="handleDelete(scope.row)" style="color: #F56C6C" v-tester>{{$t('commons.delete')}}</el-button>
|
<el-button type="text" @click="handleDelete(scope.row)" style="color: #F56C6C" v-tester>{{ $t('commons.delete') }}</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
@ -106,133 +116,132 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import MsTableHeader from '../../../../common/components/MsTableHeader';
|
import MsTableHeader from '../../../../common/components/MsTableHeader';
|
||||||
import MsTableOperator from "../../../../common/components/MsTableOperator";
|
import MsTableOperator from "../../../../common/components/MsTableOperator";
|
||||||
import MsTableOperatorButton from "../../../../common/components/MsTableOperatorButton";
|
import MsTableOperatorButton from "../../../../common/components/MsTableOperatorButton";
|
||||||
import MsTableButton from "../../../../common/components/MsTableButton";
|
import MsTableButton from "../../../../common/components/MsTableButton";
|
||||||
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
|
import MsTablePagination from "../../../../common/pagination/TablePagination";
|
||||||
import MsTablePagination from "../../../../common/pagination/TablePagination";
|
import MsTag from "../../../../common/components/MsTag";
|
||||||
import MsTag from "../../../../common/components/MsTag";
|
import MsApiCaseList from "../case/ApiCaseList";
|
||||||
import MsApiCaseList from "../case/ApiCaseList";
|
import MsContainer from "../../../../common/components/MsContainer";
|
||||||
import MsContainer from "../../../../common/components/MsContainer";
|
import MsBottomContainer from "../BottomContainer";
|
||||||
import MsBottomContainer from "../BottomContainer";
|
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
|
||||||
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
|
import MsBatchEdit from "../basis/BatchEdit";
|
||||||
import MsBatchEdit from "../basis/BatchEdit";
|
import {API_METHOD_COLOUR, API_STATUS, REQ_METHOD} from "../../model/JsonData";
|
||||||
import {API_METHOD_COLOUR, REQ_METHOD, API_STATUS} from "../../model/JsonData";
|
import {getCurrentProjectID} from "@/common/js/utils";
|
||||||
import {getCurrentProjectID} from "@/common/js/utils";
|
import {WORKSPACE_ID} from '@/common/js/constants';
|
||||||
import {WORKSPACE_ID} from '../../../../../../common/js/constants';
|
import ApiListContainer from "./ApiListContainer";
|
||||||
import ApiListContainer from "./ApiListContainer";
|
import MsTableSelectAll from "../../../../common/components/table/MsTableSelectAll";
|
||||||
import MsTableSelectAll from "../../../../common/components/table/MsTableSelectAll";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ApiList",
|
name: "ApiList",
|
||||||
components: {
|
components: {
|
||||||
MsTableSelectAll,
|
MsTableSelectAll,
|
||||||
ApiListContainer,
|
ApiListContainer,
|
||||||
MsTableButton,
|
MsTableButton,
|
||||||
MsTableOperatorButton,
|
MsTableOperatorButton,
|
||||||
MsTableOperator,
|
MsTableOperator,
|
||||||
MsTableHeader,
|
MsTableHeader,
|
||||||
MsTablePagination,
|
MsTablePagination,
|
||||||
MsTag,
|
MsTag,
|
||||||
MsApiCaseList,
|
MsApiCaseList,
|
||||||
MsContainer,
|
MsContainer,
|
||||||
MsBottomContainer,
|
MsBottomContainer,
|
||||||
ShowMoreBtn,
|
ShowMoreBtn,
|
||||||
MsBatchEdit
|
MsBatchEdit
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
condition: {},
|
||||||
|
selectApi: {},
|
||||||
|
result: {},
|
||||||
|
moduleId: "",
|
||||||
|
selectDataRange: "all",
|
||||||
|
deletePath: "/test/case/delete",
|
||||||
|
selectRows: new Set(),
|
||||||
|
buttons: [
|
||||||
|
{name: this.$t('api_test.definition.request.batch_delete'), handleClick: this.handleDeleteBatch},
|
||||||
|
{name: this.$t('api_test.definition.request.batch_edit'), handleClick: this.handleEditBatch}
|
||||||
|
],
|
||||||
|
typeArr: [
|
||||||
|
{id: 'status', name: this.$t('api_test.definition.api_status')},
|
||||||
|
{id: 'method', name: this.$t('api_test.definition.api_type')},
|
||||||
|
{id: 'userId', name: this.$t('api_test.definition.api_principal')},
|
||||||
|
],
|
||||||
|
valueArr: {
|
||||||
|
status: API_STATUS,
|
||||||
|
method: REQ_METHOD,
|
||||||
|
userId: [],
|
||||||
|
},
|
||||||
|
methodColorMap: new Map(API_METHOD_COLOUR),
|
||||||
|
tableData: [],
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
total: 0,
|
||||||
|
screenHeight: document.documentElement.clientHeight - 330,//屏幕高度,
|
||||||
|
environmentId: undefined,
|
||||||
|
selectAll: false,
|
||||||
|
unSelection: [],
|
||||||
|
selectDataCounts: 0,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
currentProtocol: String,
|
||||||
|
selectNodeIds: Array,
|
||||||
|
isSelectThisWeek: String,
|
||||||
|
visible: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
},
|
},
|
||||||
data() {
|
isCaseRelevance: {
|
||||||
return {
|
type: Boolean,
|
||||||
condition: {},
|
default: false,
|
||||||
selectApi: {},
|
|
||||||
result: {},
|
|
||||||
moduleId: "",
|
|
||||||
selectDataRange: "all",
|
|
||||||
deletePath: "/test/case/delete",
|
|
||||||
selectRows: new Set(),
|
|
||||||
buttons: [
|
|
||||||
{name: this.$t('api_test.definition.request.batch_delete'), handleClick: this.handleDeleteBatch},
|
|
||||||
{name: this.$t('api_test.definition.request.batch_edit'), handleClick: this.handleEditBatch}
|
|
||||||
],
|
|
||||||
typeArr: [
|
|
||||||
{id: 'status', name: this.$t('api_test.definition.api_status')},
|
|
||||||
{id: 'method', name: this.$t('api_test.definition.api_type')},
|
|
||||||
{id: 'userId', name: this.$t('api_test.definition.api_principal')},
|
|
||||||
],
|
|
||||||
valueArr: {
|
|
||||||
status: API_STATUS,
|
|
||||||
method: REQ_METHOD,
|
|
||||||
userId: [],
|
|
||||||
},
|
|
||||||
methodColorMap: new Map(API_METHOD_COLOUR),
|
|
||||||
tableData: [],
|
|
||||||
currentPage: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
total: 0,
|
|
||||||
screenHeight: document.documentElement.clientHeight - 330,//屏幕高度,
|
|
||||||
environmentId: undefined,
|
|
||||||
selectAll: false,
|
|
||||||
unSelection:[],
|
|
||||||
selectDataCounts:0,
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
props: {
|
trashEnable: {
|
||||||
currentProtocol: String,
|
type: Boolean,
|
||||||
selectNodeIds: Array,
|
default: false,
|
||||||
isSelectThisWeek: String,
|
|
||||||
visible: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
isCaseRelevance: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
trashEnable: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
isApiListEnable: Boolean,
|
|
||||||
isReadOnly: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
created: function () {
|
isApiListEnable: Boolean,
|
||||||
|
isReadOnly: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
},
|
||||||
|
created: function () {
|
||||||
|
this.initTable();
|
||||||
|
this.getMaintainerOptions();
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
selectNodeIds() {
|
||||||
this.initTable();
|
this.initTable();
|
||||||
this.getMaintainerOptions();
|
|
||||||
},
|
},
|
||||||
watch: {
|
currentProtocol() {
|
||||||
selectNodeIds() {
|
this.initTable();
|
||||||
|
},
|
||||||
|
trashEnable() {
|
||||||
|
if (this.trashEnable) {
|
||||||
this.initTable();
|
this.initTable();
|
||||||
},
|
|
||||||
currentProtocol() {
|
|
||||||
this.initTable();
|
|
||||||
},
|
|
||||||
trashEnable() {
|
|
||||||
if (this.trashEnable) {
|
|
||||||
this.initTable();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
isApiListEnableChange(data) {
|
||||||
|
this.$emit('isApiListEnableChange', data);
|
||||||
},
|
},
|
||||||
methods: {
|
initTable() {
|
||||||
isApiListEnableChange(data) {
|
this.selectRows = new Set();
|
||||||
this.$emit('isApiListEnableChange', data);
|
|
||||||
},
|
|
||||||
initTable() {
|
|
||||||
this.selectRows = new Set();
|
|
||||||
|
|
||||||
this.selectAll = false;
|
this.selectAll = false;
|
||||||
this.unSelection = [];
|
this.unSelection = [];
|
||||||
this.selectDataCounts = 0;
|
this.selectDataCounts = 0;
|
||||||
|
|
||||||
this.condition.filters = ["Prepare", "Underway", "Completed"];
|
this.condition.filters = ["Prepare", "Underway", "Completed"];
|
||||||
|
|
||||||
this.condition.moduleIds = this.selectNodeIds;
|
this.condition.moduleIds = this.selectNodeIds;
|
||||||
if (this.trashEnable) {
|
if (this.trashEnable) {
|
||||||
this.condition.filters = ["Trash"];
|
this.condition.filters = ["Trash"];
|
||||||
this.condition.moduleIds = [];
|
this.condition.moduleIds = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
this.condition.projectId = getCurrentProjectID();
|
this.condition.projectId = getCurrentProjectID();
|
||||||
if (this.currentProtocol != null) {
|
if (this.currentProtocol != null) {
|
||||||
|
@ -243,7 +252,7 @@
|
||||||
this.getSelectDataRange();
|
this.getSelectDataRange();
|
||||||
this.condition.selectThisWeedData = false;
|
this.condition.selectThisWeedData = false;
|
||||||
this.condition.apiCaseCoverage = null;
|
this.condition.apiCaseCoverage = null;
|
||||||
switch (this.selectDataRange){
|
switch (this.selectDataRange) {
|
||||||
case 'thisWeekCount':
|
case 'thisWeekCount':
|
||||||
this.condition.selectThisWeedData = true;
|
this.condition.selectThisWeedData = true;
|
||||||
break;
|
break;
|
||||||
|
@ -268,6 +277,10 @@
|
||||||
this.total = response.data.itemCount;
|
this.total = response.data.itemCount;
|
||||||
this.tableData = response.data.listObject;
|
this.tableData = response.data.listObject;
|
||||||
this.unSelection = response.data.listObject.map(s => s.id);
|
this.unSelection = response.data.listObject.map(s => s.id);
|
||||||
|
|
||||||
|
this.tableData.forEach(row => {
|
||||||
|
row.showTags = JSON.parse(row.tags);
|
||||||
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -325,76 +338,76 @@
|
||||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||||
},
|
},
|
||||||
|
|
||||||
editApi(row) {
|
editApi(row) {
|
||||||
this.$emit('editApi', row);
|
this.$emit('editApi', row);
|
||||||
},
|
},
|
||||||
reductionApi(row) {
|
reductionApi(row) {
|
||||||
row.request = null;
|
row.request = null;
|
||||||
row.response = null;
|
row.response = null;
|
||||||
let rows = [row];
|
let rows = [row];
|
||||||
this.$post('/api/definition/reduction/', rows, () => {
|
this.$post('/api/definition/reduction/', rows, () => {
|
||||||
this.$success(this.$t('commons.save_success'));
|
this.$success(this.$t('commons.save_success'));
|
||||||
this.search();
|
this.search();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDeleteBatch() {
|
||||||
|
if (this.trashEnable) {
|
||||||
|
this.$alert(this.$t('api_test.definition.request.delete_confirm') + "?", '', {
|
||||||
|
confirmButtonText: this.$t('commons.confirm'),
|
||||||
|
callback: (action) => {
|
||||||
|
if (action === 'confirm') {
|
||||||
|
let deleteParam = {};
|
||||||
|
let ids = Array.from(this.selectRows).map(row => row.id);
|
||||||
|
deleteParam.dataIds = ids;
|
||||||
|
deleteParam.projectId = getCurrentProjectID();
|
||||||
|
deleteParam.selectAllDate = this.isSelectAllDate;
|
||||||
|
deleteParam.unSelectIds = this.unSelection;
|
||||||
|
deleteParam = Object.assign(deleteParam, this.condition);
|
||||||
|
this.$post('/api/definition/deleteBatchByParams/', deleteParam, () => {
|
||||||
|
this.selectRows.clear();
|
||||||
|
this.initTable();
|
||||||
|
this.$success(this.$t('commons.delete_success'));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
} else {
|
||||||
handleDeleteBatch() {
|
this.$alert(this.$t('api_test.definition.request.delete_confirm') + "?", '', {
|
||||||
if (this.trashEnable) {
|
confirmButtonText: this.$t('commons.confirm'),
|
||||||
this.$alert(this.$t('api_test.definition.request.delete_confirm') + "?", '', {
|
callback: (action) => {
|
||||||
confirmButtonText: this.$t('commons.confirm'),
|
if (action === 'confirm') {
|
||||||
callback: (action) => {
|
let ids = Array.from(this.selectRows).map(row => row.id);
|
||||||
if (action === 'confirm') {
|
let deleteParam = {};
|
||||||
let deleteParam = {};
|
deleteParam.dataIds = ids;
|
||||||
let ids = Array.from(this.selectRows).map(row => row.id);
|
deleteParam.projectId = getCurrentProjectID();
|
||||||
deleteParam.dataIds = ids;
|
deleteParam.selectAllDate = this.isSelectAllDate;
|
||||||
deleteParam.projectId = getCurrentProjectID();
|
deleteParam.unSelectIds = this.unSelection;
|
||||||
deleteParam.selectAllDate = this.isSelectAllDate;
|
deleteParam = Object.assign(deleteParam, this.condition);
|
||||||
deleteParam.unSelectIds = this.unSelection;
|
this.$post('/api/definition/removeToGcByParams/', deleteParam, () => {
|
||||||
deleteParam = Object.assign(deleteParam, this.condition);
|
this.selectRows.clear();
|
||||||
this.$post('/api/definition/deleteBatchByParams/', deleteParam, () => {
|
this.initTable();
|
||||||
this.selectRows.clear();
|
this.$success(this.$t('commons.delete_success'));
|
||||||
this.initTable();
|
this.$refs.caseList.apiCaseClose();
|
||||||
this.$success(this.$t('commons.delete_success'));
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
} else {
|
});
|
||||||
this.$alert(this.$t('api_test.definition.request.delete_confirm') + "?", '', {
|
}
|
||||||
confirmButtonText: this.$t('commons.confirm'),
|
},
|
||||||
callback: (action) => {
|
handleEditBatch() {
|
||||||
if (action === 'confirm') {
|
this.$refs.batchEdit.open();
|
||||||
let ids = Array.from(this.selectRows).map(row => row.id);
|
},
|
||||||
let deleteParam = {};
|
batchEdit(form) {
|
||||||
deleteParam.dataIds = ids;
|
let arr = Array.from(this.selectRows);
|
||||||
deleteParam.projectId = getCurrentProjectID();
|
let ids = arr.map(row => row.id);
|
||||||
deleteParam.selectAllDate = this.isSelectAllDate;
|
let param = {};
|
||||||
deleteParam.unSelectIds = this.unSelection;
|
param[form.type] = form.value;
|
||||||
deleteParam = Object.assign(deleteParam, this.condition);
|
param.ids = ids;
|
||||||
this.$post('/api/definition/removeToGcByParams/', deleteParam, () => {
|
|
||||||
this.selectRows.clear();
|
|
||||||
this.initTable();
|
|
||||||
this.$success(this.$t('commons.delete_success'));
|
|
||||||
this.$refs.caseList.apiCaseClose();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleEditBatch() {
|
|
||||||
this.$refs.batchEdit.open();
|
|
||||||
},
|
|
||||||
batchEdit(form) {
|
|
||||||
let arr = Array.from(this.selectRows);
|
|
||||||
let ids = arr.map(row => row.id);
|
|
||||||
let param = {};
|
|
||||||
param[form.type] = form.value;
|
|
||||||
param.ids = ids;
|
|
||||||
|
|
||||||
param.projectId = getCurrentProjectID();
|
param.projectId = getCurrentProjectID();
|
||||||
param.selectAllDate = this.isSelectAllDate;
|
param.selectAllDate = this.isSelectAllDate;
|
||||||
param.unSelectIds = this.unSelection;
|
param.unSelectIds = this.unSelection;
|
||||||
param = Object.assign(param, this.condition);
|
param = Object.assign(param, this.condition);
|
||||||
|
|
||||||
this.$post('/api/definition/batch/editByParams', param, () => {
|
this.$post('/api/definition/batch/editByParams', param, () => {
|
||||||
this.$success(this.$t('commons.save_success'));
|
this.$success(this.$t('commons.save_success'));
|
||||||
|
@ -488,52 +501,57 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.operate-button > div {
|
.operate-button > div {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.request-method {
|
.request-method {
|
||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
color: #1E90FF;
|
color: #1E90FF;
|
||||||
}
|
}
|
||||||
|
|
||||||
.api-el-tag {
|
.api-el-tag {
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-input {
|
.search-input {
|
||||||
float: right;
|
float: right;
|
||||||
width: 300px;
|
width: 300px;
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.api-list >>> th:first-child {
|
.api-list >>> th:first-child {
|
||||||
/*border: 1px solid #DCDFE6;*/
|
/*border: 1px solid #DCDFE6;*/
|
||||||
/*border-right: 0px;*/
|
/*border-right: 0px;*/
|
||||||
/*border-top-left-radius:5px;*/
|
/*border-top-left-radius:5px;*/
|
||||||
/*border-bottom-left-radius:5px;*/
|
/*border-bottom-left-radius:5px;*/
|
||||||
/*width: 20px;*/
|
/*width: 20px;*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.api-list >>> th:nth-child(2) {
|
.api-list >>> th:nth-child(2) {
|
||||||
/*border: 1px solid #DCDFE6;*/
|
/*border: 1px solid #DCDFE6;*/
|
||||||
/*border-left: 0px;*/
|
/*border-left: 0px;*/
|
||||||
/*border-top-right-radius:5px;*/
|
/*border-top-right-radius:5px;*/
|
||||||
/*border-bottom-right-radius:5px;*/
|
/*border-bottom-right-radius:5px;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
.api-list >>> th:first-child>.cell {
|
.api-list >>> th:first-child > .cell {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
width: 30px;
|
width: 30px;
|
||||||
}
|
}
|
||||||
.api-list >>> th:nth-child(2)>.cell {
|
|
||||||
/*background-color: black;*/
|
|
||||||
}
|
|
||||||
|
|
||||||
.api-list >>> .el-dropdown {
|
.api-list >>> th:nth-child(2) > .cell {
|
||||||
float: left;
|
/*background-color: black;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.api-list >>> .el-dropdown {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-tag {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
<template>
|
||||||
|
<el-dropdown @command="handleCommand" class="scenario-ext-btn">
|
||||||
|
<el-link type="primary" :underline="false">
|
||||||
|
<el-icon class="el-icon-more"></el-icon>
|
||||||
|
</el-link>
|
||||||
|
<el-dropdown-menu slot="dropdown">
|
||||||
|
<el-dropdown-item command="ref">{{ $t('api_test.automation.view_ref') }}</el-dropdown-item>
|
||||||
|
<el-dropdown-item command="create_performance">{{ $t('api_test.create_performance_test') }}</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</el-dropdown>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "MsApiCaseTableExtendBtns",
|
||||||
|
components: {},
|
||||||
|
props: {
|
||||||
|
row: Object,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
planVisible: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
handleCommand(cmd) {
|
||||||
|
if (this.row.id) {
|
||||||
|
switch (cmd) {
|
||||||
|
case "ref":
|
||||||
|
this.$emit("showCaseRef", this.row);
|
||||||
|
break;
|
||||||
|
case "create_performance":
|
||||||
|
this.$emit("showEnvironment", this.row);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.$warning(this.$t('api_test.automation.save_case_info'))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
createPerformance(row, environment) {
|
||||||
|
this.$emit("createPerformance", row, environment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.scenario-ext-btn {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -5,7 +5,8 @@
|
||||||
</el-link>
|
</el-link>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-dropdown-item command="ref">{{ $t('api_test.automation.view_ref') }}</el-dropdown-item>
|
<el-dropdown-item command="ref">{{ $t('api_test.automation.view_ref') }}</el-dropdown-item>
|
||||||
<!--<el-dropdown-item :disabled="isCaseEdit" command="add_plan">{{ $t('api_test.automation.batch_add_plan') }}</el-dropdown-item>-->
|
<!-- <el-dropdown-item :disabled="isCaseEdit" command="add_plan">{{ $t('api_test.automation.batch_add_plan') }}</el-dropdown-item>-->
|
||||||
|
<el-dropdown-item :disabled="isCaseEdit" command="create_performance">{{ $t('api_test.create_performance_test') }}</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
<ms-reference-view ref="viewRef"/>
|
<ms-reference-view ref="viewRef"/>
|
||||||
<!--测试计划-->
|
<!--测试计划-->
|
||||||
|
@ -18,6 +19,9 @@
|
||||||
<script>
|
<script>
|
||||||
import MsReferenceView from "./ReferenceView";
|
import MsReferenceView from "./ReferenceView";
|
||||||
import MsTestPlanList from "../../../automation/scenario/testplan/TestPlanList";
|
import MsTestPlanList from "../../../automation/scenario/testplan/TestPlanList";
|
||||||
|
import {getBodyUploadFiles, getCurrentProjectID, getUUID} from "@/common/js/utils";
|
||||||
|
import TestPlan from "@/business/components/api/definition/components/jmeter/components/test-plan";
|
||||||
|
import ThreadGroup from "@/business/components/api/definition/components/jmeter/components/thread-group";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsApiExtendBtns",
|
name: "MsApiExtendBtns",
|
||||||
|
@ -25,6 +29,7 @@
|
||||||
props: {
|
props: {
|
||||||
row: Object,
|
row: Object,
|
||||||
isCaseEdit: Boolean,
|
isCaseEdit: Boolean,
|
||||||
|
environment: {},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -42,11 +47,73 @@
|
||||||
case "add_plan":
|
case "add_plan":
|
||||||
this.addCaseToPlan();
|
this.addCaseToPlan();
|
||||||
break;
|
break;
|
||||||
|
case "create_performance":
|
||||||
|
this.createPerformance(this.row);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.$warning(this.$t('api_test.automation.save_case_info'))
|
this.$warning(this.$t('api_test.automation.save_case_info'))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
createPerformance(row){
|
||||||
|
/**
|
||||||
|
* 思路:调用后台创建性能测试的方法,把当前案例的hashTree在后台转化为jmx并文件创建性能测试。
|
||||||
|
* 然后跳转到修改性能测试的页面
|
||||||
|
*
|
||||||
|
* 性能测试保存地址: performance/save
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
if (!this.environment || !this.environment) {
|
||||||
|
this.$warning(this.$t('api_test.environment.select_environment'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.runData = [];
|
||||||
|
this.singleLoading = true;
|
||||||
|
this.row.request.name = this.row.id;
|
||||||
|
this.row.request.useEnvironment = this.environment.id;
|
||||||
|
this.runData.push(this.row.request);
|
||||||
|
/*触发执行操作*/
|
||||||
|
let testPlan = new TestPlan();
|
||||||
|
let threadGroup = new ThreadGroup();
|
||||||
|
threadGroup.hashTree = [];
|
||||||
|
testPlan.hashTree = [threadGroup];
|
||||||
|
this.runData.forEach(item => {
|
||||||
|
threadGroup.hashTree.push(item);
|
||||||
|
})
|
||||||
|
let reqObj = {id: this.row.id,
|
||||||
|
testElement: testPlan,
|
||||||
|
type: this.type,
|
||||||
|
name:this.row.name,
|
||||||
|
projectId:getCurrentProjectID(),
|
||||||
|
};
|
||||||
|
|
||||||
|
let bodyFiles = getBodyUploadFiles(reqObj, this.runData);
|
||||||
|
reqObj.reportId = "run";
|
||||||
|
// let url = "/api/genPerformanceTest";
|
||||||
|
let url = "/api/genPerformanceTestXml";
|
||||||
|
|
||||||
|
this.$fileUpload(url, null, bodyFiles, reqObj, response => {
|
||||||
|
let jmxObj = {};
|
||||||
|
jmxObj.name = response.data.name;
|
||||||
|
jmxObj.xml = response.data.xml;
|
||||||
|
this.$store.commit('setTest', {
|
||||||
|
name: row.name,
|
||||||
|
jmx: jmxObj
|
||||||
|
})
|
||||||
|
this.$router.push({
|
||||||
|
path: "/performance/test/create"
|
||||||
|
})
|
||||||
|
// let performanceId = response.data;
|
||||||
|
// if(performanceId!=null){
|
||||||
|
// this.$router.push({
|
||||||
|
// path: "/performance/test/edit/"+performanceId,
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
}, erro => {
|
||||||
|
this.$emit('runRefresh', {});
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
addCaseToPlan() {
|
addCaseToPlan() {
|
||||||
this.planVisible = true;
|
this.planVisible = true;
|
||||||
},
|
},
|
||||||
|
|
|
@ -247,6 +247,7 @@
|
||||||
},
|
},
|
||||||
environmentChange(value) {
|
environmentChange(value) {
|
||||||
this.request.dataSource = undefined;
|
this.request.dataSource = undefined;
|
||||||
|
this.request.dataSourceId = "";
|
||||||
for (let i in this.environments) {
|
for (let i in this.environments) {
|
||||||
if (this.environments[i].id === value) {
|
if (this.environments[i].id === value) {
|
||||||
this.databaseConfigsOptions = [];
|
this.databaseConfigsOptions = [];
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<ms-table-operator-button :isTesterPermission="isTesterPermission" :tip="tip1" icon="el-icon-edit" @exec="editClick" @click.stop="editClickStop"/>
|
<ms-table-operator-button :isTesterPermission="isTesterPermission" :tip="tip1" icon="el-icon-edit" @exec="editClick" @click.stop="editClickStop"/>
|
||||||
<slot name="middle"></slot>
|
<slot name="middle"></slot>
|
||||||
<ms-table-operator-button :isTesterPermission="isTesterPermission" :tip="tip2" icon="el-icon-delete" type="danger" @exec="deleteClick" @click.stop="deleteClickStop"/>
|
<ms-table-operator-button :isTesterPermission="isTesterPermission" :tip="tip2" icon="el-icon-delete" type="danger" @exec="deleteClick" @click.stop="deleteClickStop"/>
|
||||||
<slot name="behind"></slot>
|
<slot name="beheind"></slot>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -66,6 +66,33 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="10" :offset="1">
|
||||||
|
<el-form-item :label="$t('commons.tag')" :label-width="formLabelWidth" prop="tag">
|
||||||
|
<el-tag
|
||||||
|
:key="form + '_' + index"
|
||||||
|
v-for="(tag, index) in form.caseTags"
|
||||||
|
closable
|
||||||
|
size="mini"
|
||||||
|
:disable-transitions="false"
|
||||||
|
@close="handleClose(tag)">
|
||||||
|
{{ tag }}
|
||||||
|
</el-tag>
|
||||||
|
<el-input
|
||||||
|
class="input-new-tag"
|
||||||
|
v-if="inputVisible"
|
||||||
|
v-model="inputValue"
|
||||||
|
ref="saveTagInput"
|
||||||
|
size="mini"
|
||||||
|
@keyup.enter.native="handleInputConfirm"
|
||||||
|
@blur="handleInputConfirm"
|
||||||
|
>
|
||||||
|
</el-input>
|
||||||
|
<el-button v-else class="button-new-tag" size="mini" @click="showInput">+</el-button>
|
||||||
|
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="10" :offset="1">
|
<el-col :span="10" :offset="1">
|
||||||
|
@ -296,6 +323,7 @@ export default {
|
||||||
result: ''
|
result: ''
|
||||||
}],
|
}],
|
||||||
remark: '',
|
remark: '',
|
||||||
|
caseTags: []
|
||||||
},
|
},
|
||||||
moduleOptions: [],
|
moduleOptions: [],
|
||||||
maintainerOptions: [],
|
maintainerOptions: [],
|
||||||
|
@ -326,7 +354,9 @@ export default {
|
||||||
{value: 'auto', label: this.$t('test_track.case.auto')},
|
{value: 'auto', label: this.$t('test_track.case.auto')},
|
||||||
{value: 'manual', label: this.$t('test_track.case.manual')}
|
{value: 'manual', label: this.$t('test_track.case.manual')}
|
||||||
],
|
],
|
||||||
testCase: {}
|
testCase: {},
|
||||||
|
inputVisible: false,
|
||||||
|
inputValue: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
@ -357,6 +387,7 @@ export default {
|
||||||
open(testCase) {
|
open(testCase) {
|
||||||
this.testCase = {};
|
this.testCase = {};
|
||||||
if (testCase) {
|
if (testCase) {
|
||||||
|
testCase.caseTags = JSON.parse(testCase.tags);
|
||||||
// 复制 不查询评论
|
// 复制 不查询评论
|
||||||
this.testCase = testCase.isCopy ? {} : testCase;
|
this.testCase = testCase.isCopy ? {} : testCase;
|
||||||
}
|
}
|
||||||
|
@ -394,6 +425,7 @@ export default {
|
||||||
this.form.type = 'functional';
|
this.form.type = 'functional';
|
||||||
this.form.method = 'manual';
|
this.form.method = 'manual';
|
||||||
this.form.maintainer = user.id;
|
this.form.maintainer = user.id;
|
||||||
|
this.form.caseTags = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getSelectOptions();
|
this.getSelectOptions();
|
||||||
|
@ -609,6 +641,7 @@ export default {
|
||||||
desc: '',
|
desc: '',
|
||||||
result: ''
|
result: ''
|
||||||
}];
|
}];
|
||||||
|
this.caseTags = [];
|
||||||
this.uploadList = [];
|
this.uploadList = [];
|
||||||
this.fileList = [];
|
this.fileList = [];
|
||||||
this.tableData = [];
|
this.tableData = [];
|
||||||
|
@ -695,6 +728,26 @@ export default {
|
||||||
fileValidator(file) {
|
fileValidator(file) {
|
||||||
/// todo: 是否需要对文件内容和大小做限制
|
/// todo: 是否需要对文件内容和大小做限制
|
||||||
return file.size > 0;
|
return file.size > 0;
|
||||||
|
},
|
||||||
|
|
||||||
|
handleClose(tag) {
|
||||||
|
this.form.caseTags.splice(this.form.caseTags.indexOf(tag), 1);
|
||||||
|
},
|
||||||
|
|
||||||
|
showInput() {
|
||||||
|
this.inputVisible = true;
|
||||||
|
this.$nextTick(_ => {
|
||||||
|
this.$refs.saveTagInput.$refs.input.focus();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
handleInputConfirm() {
|
||||||
|
let inputValue = this.inputValue;
|
||||||
|
if (inputValue) {
|
||||||
|
this.form.caseTags.push(inputValue);
|
||||||
|
}
|
||||||
|
this.inputVisible = false;
|
||||||
|
this.inputValue = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -734,4 +787,22 @@ export default {
|
||||||
.comment-card >>> .el-card__body {
|
.comment-card >>> .el-card__body {
|
||||||
height: calc(100vh - 120px);
|
height: calc(100vh - 120px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.el-tag + .el-tag {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-new-tag {
|
||||||
|
margin-left: 10px;
|
||||||
|
height: 20px;
|
||||||
|
/*line-height: 30px;*/
|
||||||
|
padding-top: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-new-tag {
|
||||||
|
width: 90px;
|
||||||
|
margin-left: 10px;
|
||||||
|
vertical-align: bottom;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -111,6 +111,15 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column prop="tags" :label="$t('commons.tag')">
|
||||||
|
<template v-slot:default="scope">
|
||||||
|
<ms-tag v-for="(tag, index) in scope.row.showTags"
|
||||||
|
:key="tag + '_' + index"
|
||||||
|
:effect="'light'"
|
||||||
|
:content="tag"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="nodePath"
|
prop="nodePath"
|
||||||
:label="$t('test_track.case.module')"
|
:label="$t('test_track.case.module')"
|
||||||
|
@ -175,6 +184,7 @@ import StatusTableItem from "@/business/components/track/common/tableItems/planv
|
||||||
import TestCaseDetail from "./TestCaseDetail";
|
import TestCaseDetail from "./TestCaseDetail";
|
||||||
import ReviewStatus from "@/business/components/track/case/components/ReviewStatus";
|
import ReviewStatus from "@/business/components/track/case/components/ReviewStatus";
|
||||||
import {getCurrentProjectID} from "../../../../../common/js/utils";
|
import {getCurrentProjectID} from "../../../../../common/js/utils";
|
||||||
|
import MsTag from "@/business/components/common/components/MsTag";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TestCaseList",
|
name: "TestCaseList",
|
||||||
|
@ -195,7 +205,8 @@ export default {
|
||||||
BatchEdit,
|
BatchEdit,
|
||||||
StatusTableItem,
|
StatusTableItem,
|
||||||
TestCaseDetail,
|
TestCaseDetail,
|
||||||
ReviewStatus
|
ReviewStatus,
|
||||||
|
MsTag,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -308,6 +319,9 @@ export default {
|
||||||
this.tableData = data.listObject;
|
this.tableData = data.listObject;
|
||||||
// this.selectIds.clear();
|
// this.selectIds.clear();
|
||||||
this.selectRows.clear();
|
this.selectRows.clear();
|
||||||
|
this.tableData.forEach(row => {
|
||||||
|
row.showTags = JSON.parse(row.tags);
|
||||||
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -537,4 +551,7 @@ export default {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.el-tag {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -128,19 +128,21 @@
|
||||||
@exec="openReport(scope.row.id, scope.row.reportId)"/>
|
@exec="openReport(scope.row.id, scope.row.reportId)"/>
|
||||||
</template>
|
</template>
|
||||||
</ms-table-operator>
|
</ms-table-operator>
|
||||||
|
<ms-table-operator-button style="margin-left: 10px;color:#6C317C" type=""
|
||||||
|
:tip="$t('test_track.plan_view.view_report')" icon="el-icon-time"
|
||||||
|
@exec="scheduleTask(scope.row)"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||||
:total="total"/>
|
:total="total"/>
|
||||||
|
|
||||||
<test-report-template-list @openReport="openReport" ref="testReportTemplateList"/>
|
<test-report-template-list @openReport="openReport" ref="testReportTemplateList"/>
|
||||||
<test-case-report-view @refresh="initTableData" ref="testCaseReportView"/>
|
<test-case-report-view @refresh="initTableData" ref="testCaseReportView"/>
|
||||||
<ms-delete-confirm :title="$t('test_track.plan.plan_delete')" @delete="_handleDelete" ref="deleteConfirm" :with-tip="enableDeleteTip">
|
<ms-delete-confirm :title="$t('test_track.plan.plan_delete')" @delete="_handleDelete" ref="deleteConfirm" :with-tip="enableDeleteTip">
|
||||||
{{$t('test_track.plan.plan_delete_tip')}}
|
{{$t('test_track.plan.plan_delete_tip')}}
|
||||||
</ms-delete-confirm>
|
</ms-delete-confirm>
|
||||||
|
<ms-schedule-maintain ref="scheduleMaintain" />
|
||||||
</el-card>
|
</el-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -160,6 +162,7 @@ import MsDeleteConfirm from "../../../common/components/MsDeleteConfirm";
|
||||||
import {TEST_PLAN_CONFIGS} from "../../../common/components/search/search-components";
|
import {TEST_PLAN_CONFIGS} from "../../../common/components/search/search-components";
|
||||||
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
|
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
|
||||||
import {getCurrentProjectID} from "../../../../../common/js/utils";
|
import {getCurrentProjectID} from "../../../../../common/js/utils";
|
||||||
|
import MsScheduleMaintain from "@/business/components/api/automation/schedule/ScheduleMaintain"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TestPlanList",
|
name: "TestPlanList",
|
||||||
|
@ -169,6 +172,7 @@ export default {
|
||||||
TestReportTemplateList,
|
TestReportTemplateList,
|
||||||
PlanStageTableItem,
|
PlanStageTableItem,
|
||||||
PlanStatusTableItem,
|
PlanStatusTableItem,
|
||||||
|
MsScheduleMaintain,
|
||||||
MsTableOperator, MsTableOperatorButton, MsDialogFooter, MsTableHeader, MsCreateBox, MsTablePagination
|
MsTableOperator, MsTableOperatorButton, MsDialogFooter, MsTableHeader, MsCreateBox, MsTablePagination
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
@ -289,6 +293,10 @@ export default {
|
||||||
this.$refs.testCaseReportView.open(planId, reportId);
|
this.$refs.testCaseReportView.open(planId, reportId);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
scheduleTask(row){
|
||||||
|
row.redirectFrom = "testPlan";
|
||||||
|
this.$refs.scheduleMaintain.open(row);
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -14,12 +14,14 @@
|
||||||
class="el-menu-demo header-menu" mode="horizontal" @select="handleSelect">
|
class="el-menu-demo header-menu" mode="horizontal" @select="handleSelect">
|
||||||
<el-menu-item index="functional">功能测试用例</el-menu-item>
|
<el-menu-item index="functional">功能测试用例</el-menu-item>
|
||||||
<el-menu-item index="api">接口测试用例</el-menu-item>
|
<el-menu-item index="api">接口测试用例</el-menu-item>
|
||||||
|
<el-menu-item index="load">性能测试用例</el-menu-item>
|
||||||
<el-menu-item index="report">报告统计</el-menu-item>
|
<el-menu-item index="report">报告统计</el-menu-item>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
</template>
|
</template>
|
||||||
</ms-test-plan-header-bar>
|
</ms-test-plan-header-bar>
|
||||||
<test-plan-functional v-if="activeIndex === 'functional'" :plan-id="planId"/>
|
<test-plan-functional v-if="activeIndex === 'functional'" :plan-id="planId"/>
|
||||||
<test-plan-api v-if="activeIndex === 'api'" :plan-id="planId"/>
|
<test-plan-api v-if="activeIndex === 'api'" :plan-id="planId"/>
|
||||||
|
<test-plan-load v-if="activeIndex === 'load'" :plan-id="planId"/>
|
||||||
<test-case-statistics-report-view :test-plan="currentPlan" v-if="activeIndex === 'report'"/>
|
<test-case-statistics-report-view :test-plan="currentPlan" v-if="activeIndex === 'report'"/>
|
||||||
|
|
||||||
<test-report-template-list @openReport="openReport" ref="testReportTemplateList"/>
|
<test-report-template-list @openReport="openReport" ref="testReportTemplateList"/>
|
||||||
|
@ -42,6 +44,7 @@
|
||||||
import TestPlanApi from "./comonents/api/TestPlanApi";
|
import TestPlanApi from "./comonents/api/TestPlanApi";
|
||||||
import TestCaseStatisticsReportView from "./comonents/report/statistics/TestCaseStatisticsReportView";
|
import TestCaseStatisticsReportView from "./comonents/report/statistics/TestCaseStatisticsReportView";
|
||||||
import TestReportTemplateList from "./comonents/TestReportTemplateList";
|
import TestReportTemplateList from "./comonents/TestReportTemplateList";
|
||||||
|
import TestPlanLoad from "@/business/components/track/plan/view/comonents/load/TestPlanLoad";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TestPlanView",
|
name: "TestPlanView",
|
||||||
|
@ -52,7 +55,7 @@
|
||||||
TestPlanFunctional,
|
TestPlanFunctional,
|
||||||
MsTestPlanHeaderBar,
|
MsTestPlanHeaderBar,
|
||||||
MsMainContainer,
|
MsMainContainer,
|
||||||
MsAsideContainer, MsContainer, NodeTree, TestPlanTestCaseList, TestCaseRelevance, SelectMenu},
|
MsAsideContainer, MsContainer, NodeTree, TestPlanTestCaseList, TestCaseRelevance, SelectMenu, TestPlanLoad},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
testPlans: [],
|
testPlans: [],
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
<div class="card-container">
|
<div class="card-container">
|
||||||
<el-card class="card-content" v-loading="result.loading">
|
<el-card class="card-content" v-loading="result.loading">
|
||||||
<template v-slot:header>
|
<template v-slot:header>
|
||||||
<test-plan-case-list-header
|
<test-plan-case-list-header
|
||||||
:project-id="getProjectId()"
|
:project-id="getProjectId()"
|
||||||
:condition="condition"
|
:condition="condition"
|
||||||
:plan-id="planId"
|
:plan-id="planId"
|
||||||
@refresh="initTable"
|
@refresh="initTable"
|
||||||
@relevanceCase="$emit('relevanceCase')"
|
@relevanceCase="$emit('relevanceCase')"
|
||||||
@setEnvironment="setEnvironment"
|
@setEnvironment="setEnvironment"
|
||||||
v-if="isPlanModel"/>
|
v-if="isPlanModel"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<el-table v-loading="result.loading"
|
<el-table v-loading="result.loading"
|
||||||
|
@ -60,8 +60,17 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column prop="tags" :label="$t('commons.tag')">
|
||||||
|
<template v-slot:default="scope">
|
||||||
|
<ms-tag v-for="(tag, index) in scope.row.showTags"
|
||||||
|
:key="tag + '_' + index"
|
||||||
|
:effect="'light'"
|
||||||
|
:content="tag"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column :label="'执行状态'" min-width="130" align="center">
|
<el-table-column :label="'执行状态'" min-width="130" align="center">
|
||||||
<template v-slot:default="scope" >
|
<template v-slot:default="scope">
|
||||||
<div v-loading="rowLoading === scope.row.id">
|
<div v-loading="rowLoading === scope.row.id">
|
||||||
<el-link type="danger"
|
<el-link type="danger"
|
||||||
v-if="scope.row.execResult && scope.row.execResult === 'error'"
|
v-if="scope.row.execResult && scope.row.execResult === 'error'"
|
||||||
|
@ -73,8 +82,8 @@
|
||||||
<div v-else v-text="getResult(scope.row.execResult)"/>
|
<div v-else v-text="getResult(scope.row.execResult)"/>
|
||||||
|
|
||||||
<div v-if="scope.row.id" style="color: #999999;font-size: 12px">
|
<div v-if="scope.row.id" style="color: #999999;font-size: 12px">
|
||||||
<span> {{scope.row.updateTime | timestampFormatDate }}</span>
|
<span> {{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||||
{{scope.row.updateUser}}
|
{{ scope.row.updateUser }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -82,10 +91,10 @@
|
||||||
|
|
||||||
<el-table-column v-if="!isReadOnly" :label="$t('commons.operating')" align="center">
|
<el-table-column v-if="!isReadOnly" :label="$t('commons.operating')" align="center">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<ms-table-operator-button class="run-button" :is-tester-permission="true" :tip="$t('api_test.run')" icon="el-icon-video-play"
|
<ms-table-operator-button class="run-button" :is-tester-permission="true" :tip="$t('api_test.run')" icon="el-icon-video-play"
|
||||||
@exec="singleRun(scope.row)" v-tester/>
|
@exec="singleRun(scope.row)" v-tester/>
|
||||||
<ms-table-operator-button :is-tester-permission="true" :tip="$t('test_track.plan_view.cancel_relevance')"
|
<ms-table-operator-button :is-tester-permission="true" :tip="$t('test_track.plan_view.cancel_relevance')"
|
||||||
icon="el-icon-unlock" type="danger" @exec="handleDelete(scope.row)" v-tester/>
|
icon="el-icon-unlock" type="danger" @exec="handleDelete(scope.row)" v-tester/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
|
@ -106,366 +115,371 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import MsTableOperator from "../../../../../common/components/MsTableOperator";
|
import MsTableOperator from "../../../../../common/components/MsTableOperator";
|
||||||
import MsTableOperatorButton from "../../../../../common/components/MsTableOperatorButton";
|
import MsTableOperatorButton from "../../../../../common/components/MsTableOperatorButton";
|
||||||
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
|
import MsTablePagination from "../../../../../common/pagination/TablePagination";
|
||||||
import MsTablePagination from "../../../../../common/pagination/TablePagination";
|
import MsTag from "../../../../../common/components/MsTag";
|
||||||
import MsTag from "../../../../../common/components/MsTag";
|
import MsApiCaseList from "../../../../../api/definition/components/case/ApiCaseList";
|
||||||
import MsApiCaseList from "../../../../../api/definition/components/case/ApiCaseList";
|
import ApiCaseList from "../../../../../api/definition/components/case/ApiCaseList";
|
||||||
import MsContainer from "../../../../../common/components/MsContainer";
|
import MsContainer from "../../../../../common/components/MsContainer";
|
||||||
import MsBottomContainer from "../../../../../api/definition/components/BottomContainer";
|
import MsBottomContainer from "../../../../../api/definition/components/BottomContainer";
|
||||||
import ShowMoreBtn from "../../../../case/components/ShowMoreBtn";
|
import ShowMoreBtn from "../../../../case/components/ShowMoreBtn";
|
||||||
import MsBatchEdit from "../../../../../api/definition/components/basis/BatchEdit";
|
import MsBatchEdit from "../../../../../api/definition/components/basis/BatchEdit";
|
||||||
import {API_METHOD_COLOUR, CASE_PRIORITY, RESULT_MAP} from "../../../../../api/definition/model/JsonData";
|
import {API_METHOD_COLOUR, CASE_PRIORITY, RESULT_MAP} from "../../../../../api/definition/model/JsonData";
|
||||||
import {getCurrentProjectID} from "@/common/js/utils";
|
import {getCurrentProjectID} from "@/common/js/utils";
|
||||||
import ApiListContainer from "../../../../../api/definition/components/list/ApiListContainer";
|
import ApiListContainer from "../../../../../api/definition/components/list/ApiListContainer";
|
||||||
import PriorityTableItem from "../../../../common/tableItems/planview/PriorityTableItem";
|
import PriorityTableItem from "../../../../common/tableItems/planview/PriorityTableItem";
|
||||||
import ApiCaseList from "../../../../../api/definition/components/case/ApiCaseList";
|
import {_filter, _sort, getBodyUploadFiles, getUUID} from "../../../../../../../common/js/utils";
|
||||||
import {_filter, _sort, getUUID, getBodyUploadFiles} from "../../../../../../../common/js/utils";
|
import TestPlanCaseListHeader from "./TestPlanCaseListHeader";
|
||||||
import TestPlanCaseListHeader from "./TestPlanCaseListHeader";
|
import MsRun from "../../../../../api/definition/components/Run";
|
||||||
import MsRun from "../../../../../api/definition/components/Run";
|
import TestPlanApiCaseResult from "./TestPlanApiCaseResult";
|
||||||
import TestPlanApiCaseResult from "./TestPlanApiCaseResult";
|
import TestPlan from "../../../../../api/definition/components/jmeter/components/test-plan";
|
||||||
import TestPlan from "../../../../../api/definition/components/jmeter/components/test-plan";
|
import ThreadGroup from "../../../../../api/definition/components/jmeter/components/thread-group";
|
||||||
import ThreadGroup from "../../../../../api/definition/components/jmeter/components/thread-group";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TestPlanApiCaseList",
|
name: "TestPlanApiCaseList",
|
||||||
components: {
|
components: {
|
||||||
TestPlanApiCaseResult,
|
TestPlanApiCaseResult,
|
||||||
MsRun,
|
MsRun,
|
||||||
TestPlanCaseListHeader,
|
TestPlanCaseListHeader,
|
||||||
ApiCaseList,
|
ApiCaseList,
|
||||||
PriorityTableItem,
|
PriorityTableItem,
|
||||||
ApiListContainer,
|
ApiListContainer,
|
||||||
MsTableOperatorButton,
|
MsTableOperatorButton,
|
||||||
MsTableOperator,
|
MsTableOperator,
|
||||||
MsTablePagination,
|
MsTablePagination,
|
||||||
MsTag,
|
MsTag,
|
||||||
MsApiCaseList,
|
MsApiCaseList,
|
||||||
MsContainer,
|
MsContainer,
|
||||||
MsBottomContainer,
|
MsBottomContainer,
|
||||||
ShowMoreBtn,
|
ShowMoreBtn,
|
||||||
MsBatchEdit
|
MsBatchEdit
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
condition: {},
|
||||||
|
selectCase: {},
|
||||||
|
result: {},
|
||||||
|
moduleId: "",
|
||||||
|
deletePath: "/test/case/delete",
|
||||||
|
selectRows: new Set(),
|
||||||
|
buttons: [
|
||||||
|
{name: this.$t('api_test.definition.request.batch_delete'), handleClick: this.handleDeleteBatch},
|
||||||
|
{name: this.$t('api_test.automation.batch_execute'), handleClick: this.handleBatchExecute}
|
||||||
|
],
|
||||||
|
typeArr: [
|
||||||
|
{id: 'priority', name: this.$t('test_track.case.priority')},
|
||||||
|
],
|
||||||
|
priorityFilters: [
|
||||||
|
{text: 'P0', value: 'P0'},
|
||||||
|
{text: 'P1', value: 'P1'},
|
||||||
|
{text: 'P2', value: 'P2'},
|
||||||
|
{text: 'P3', value: 'P3'}
|
||||||
|
],
|
||||||
|
valueArr: {
|
||||||
|
priority: CASE_PRIORITY,
|
||||||
|
},
|
||||||
|
methodColorMap: new Map(API_METHOD_COLOUR),
|
||||||
|
tableData: [],
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
total: 0,
|
||||||
|
screenHeight: document.documentElement.clientHeight - 330,//屏幕高度
|
||||||
|
// environmentId: undefined,
|
||||||
|
currentCaseProjectId: "",
|
||||||
|
runData: [],
|
||||||
|
reportId: "",
|
||||||
|
response: {},
|
||||||
|
rowLoading: ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
currentProtocol: String,
|
||||||
|
selectNodeIds: Array,
|
||||||
|
visible: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
},
|
},
|
||||||
data() {
|
isApiListEnable: {
|
||||||
return {
|
type: Boolean,
|
||||||
condition: {},
|
default: false,
|
||||||
selectCase: {},
|
},
|
||||||
result: {},
|
isReadOnly: {
|
||||||
moduleId: "",
|
type: Boolean,
|
||||||
deletePath: "/test/case/delete",
|
default: false
|
||||||
selectRows: new Set(),
|
},
|
||||||
buttons: [
|
isCaseRelevance: {
|
||||||
{name: this.$t('api_test.definition.request.batch_delete'), handleClick: this.handleDeleteBatch},
|
type: Boolean,
|
||||||
{name: this.$t('api_test.automation.batch_execute'), handleClick: this.handleBatchExecute}
|
default: false,
|
||||||
],
|
},
|
||||||
typeArr: [
|
model: {
|
||||||
{id: 'priority', name: this.$t('test_track.case.priority')},
|
type: String,
|
||||||
],
|
default() {
|
||||||
priorityFilters: [
|
'api'
|
||||||
{text: 'P0', value: 'P0'},
|
|
||||||
{text: 'P1', value: 'P1'},
|
|
||||||
{text: 'P2', value: 'P2'},
|
|
||||||
{text: 'P3', value: 'P3'}
|
|
||||||
],
|
|
||||||
valueArr: {
|
|
||||||
priority: CASE_PRIORITY,
|
|
||||||
},
|
|
||||||
methodColorMap: new Map(API_METHOD_COLOUR),
|
|
||||||
tableData: [],
|
|
||||||
currentPage: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
total: 0,
|
|
||||||
screenHeight: document.documentElement.clientHeight - 330,//屏幕高度
|
|
||||||
// environmentId: undefined,
|
|
||||||
currentCaseProjectId: "",
|
|
||||||
runData: [],
|
|
||||||
reportId: "",
|
|
||||||
response: {},
|
|
||||||
rowLoading: ""
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
planId: String
|
||||||
currentProtocol: String,
|
},
|
||||||
selectNodeIds: Array,
|
created: function () {
|
||||||
visible: {
|
this.initTable();
|
||||||
type: Boolean,
|
},
|
||||||
default: false,
|
watch: {
|
||||||
},
|
selectNodeIds() {
|
||||||
isApiListEnable: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
isReadOnly: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
isCaseRelevance: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
model: {
|
|
||||||
type: String,
|
|
||||||
default() {
|
|
||||||
'api'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
planId: String
|
|
||||||
},
|
|
||||||
created: function () {
|
|
||||||
this.initTable();
|
this.initTable();
|
||||||
},
|
},
|
||||||
watch: {
|
currentProtocol() {
|
||||||
selectNodeIds() {
|
this.initTable();
|
||||||
this.initTable();
|
},
|
||||||
},
|
planId() {
|
||||||
currentProtocol() {
|
this.initTable();
|
||||||
this.initTable();
|
}
|
||||||
},
|
},
|
||||||
planId() {
|
computed: {
|
||||||
this.initTable();
|
// 测试计划关联测试列表
|
||||||
|
isRelevanceModel() {
|
||||||
|
return this.model === 'relevance'
|
||||||
|
},
|
||||||
|
// 测试计划接口用例列表
|
||||||
|
isPlanModel() {
|
||||||
|
return this.model === 'plan'
|
||||||
|
},
|
||||||
|
// 接口定义用例列表
|
||||||
|
isApiModel() {
|
||||||
|
return this.model === 'api'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
isApiListEnableChange(data) {
|
||||||
|
this.$emit('isApiListEnableChange', data);
|
||||||
|
},
|
||||||
|
initTable() {
|
||||||
|
this.selectRows = new Set();
|
||||||
|
this.condition.status = "";
|
||||||
|
this.condition.moduleIds = this.selectNodeIds;
|
||||||
|
|
||||||
|
this.condition.planId = this.planId;
|
||||||
|
|
||||||
|
if (this.currentProtocol != null) {
|
||||||
|
this.condition.protocol = this.currentProtocol;
|
||||||
|
}
|
||||||
|
this.result = this.$post('/test/plan/api/case/list/' + this.currentPage + "/" + this.pageSize, this.condition, response => {
|
||||||
|
this.total = response.data.itemCount;
|
||||||
|
this.tableData = response.data.listObject;
|
||||||
|
this.tableData.forEach(row => {
|
||||||
|
row.showTags = JSON.parse(row.tags);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleSelect(selection, row) {
|
||||||
|
row.hashTree = [];
|
||||||
|
if (this.selectRows.has(row)) {
|
||||||
|
this.$set(row, "showMore", false);
|
||||||
|
this.selectRows.delete(row);
|
||||||
|
} else {
|
||||||
|
this.$set(row, "showMore", true);
|
||||||
|
this.selectRows.add(row);
|
||||||
|
}
|
||||||
|
let arr = Array.from(this.selectRows);
|
||||||
|
// 选中1个以上的用例时显示更多操作
|
||||||
|
if (this.selectRows.size === 1) {
|
||||||
|
this.$set(arr[0], "showMore", false);
|
||||||
|
} else if (this.selectRows.size === 2) {
|
||||||
|
arr.forEach(row => {
|
||||||
|
this.$set(row, "showMore", true);
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
showExecResult(row) {
|
||||||
// 测试计划关联测试列表
|
this.$emit('showExecResult', row);
|
||||||
isRelevanceModel() {
|
|
||||||
return this.model === 'relevance'
|
|
||||||
},
|
|
||||||
// 测试计划接口用例列表
|
|
||||||
isPlanModel() {
|
|
||||||
return this.model === 'plan'
|
|
||||||
},
|
|
||||||
// 接口定义用例列表
|
|
||||||
isApiModel() {
|
|
||||||
return this.model === 'api'
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
methods: {
|
filter(filters) {
|
||||||
isApiListEnableChange(data) {
|
_filter(filters, this.condition);
|
||||||
this.$emit('isApiListEnableChange', data);
|
this.initTable();
|
||||||
},
|
},
|
||||||
initTable() {
|
sort(column) {
|
||||||
this.selectRows = new Set();
|
// 每次只对一个字段排序
|
||||||
this.condition.status = "";
|
if (this.condition.orders) {
|
||||||
this.condition.moduleIds = this.selectNodeIds;
|
this.condition.orders = [];
|
||||||
|
}
|
||||||
this.condition.planId = this.planId;
|
_sort(column, this.condition);
|
||||||
|
this.initTable();
|
||||||
if (this.currentProtocol != null) {
|
},
|
||||||
this.condition.protocol = this.currentProtocol;
|
handleSelectAll(selection) {
|
||||||
}
|
if (selection.length > 0) {
|
||||||
this.result = this.$post('/test/plan/api/case/list/' + this.currentPage + "/" + this.pageSize, this.condition, response => {
|
if (selection.length === 1) {
|
||||||
this.total = response.data.itemCount;
|
selection.hashTree = [];
|
||||||
this.tableData = response.data.listObject;
|
this.selectRows.add(selection[0]);
|
||||||
});
|
|
||||||
},
|
|
||||||
handleSelect(selection, row) {
|
|
||||||
row.hashTree = [];
|
|
||||||
if (this.selectRows.has(row)) {
|
|
||||||
this.$set(row, "showMore", false);
|
|
||||||
this.selectRows.delete(row);
|
|
||||||
} else {
|
} else {
|
||||||
this.$set(row, "showMore", true);
|
this.tableData.forEach(item => {
|
||||||
this.selectRows.add(row);
|
item.hashTree = [];
|
||||||
|
this.$set(item, "showMore", true);
|
||||||
|
this.selectRows.add(item);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
let arr = Array.from(this.selectRows);
|
} else {
|
||||||
// 选中1个以上的用例时显示更多操作
|
this.selectRows.clear();
|
||||||
if (this.selectRows.size === 1) {
|
this.tableData.forEach(row => {
|
||||||
this.$set(arr[0], "showMore", false);
|
this.$set(row, "showMore", false);
|
||||||
} else if (this.selectRows.size === 2) {
|
})
|
||||||
arr.forEach(row => {
|
}
|
||||||
this.$set(row, "showMore", true);
|
},
|
||||||
})
|
search() {
|
||||||
}
|
this.initTable();
|
||||||
},
|
},
|
||||||
showExecResult(row) {
|
buildPagePath(path) {
|
||||||
this.$emit('showExecResult', row);
|
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||||
},
|
},
|
||||||
filter(filters) {
|
reductionApi(row) {
|
||||||
_filter(filters, this.condition);
|
let ids = [row.id];
|
||||||
this.initTable();
|
this.$post('/api/testcase/reduction/', ids, () => {
|
||||||
},
|
this.$success(this.$t('commons.save_success'));
|
||||||
sort(column) {
|
this.search();
|
||||||
// 每次只对一个字段排序
|
});
|
||||||
if (this.condition.orders) {
|
},
|
||||||
this.condition.orders = [];
|
handleDeleteBatch() {
|
||||||
}
|
this.$alert(this.$t('api_test.definition.request.delete_confirm') + "?", '', {
|
||||||
_sort(column, this.condition);
|
confirmButtonText: this.$t('commons.confirm'),
|
||||||
this.initTable();
|
callback: (action) => {
|
||||||
},
|
if (action === 'confirm') {
|
||||||
handleSelectAll(selection) {
|
let param = {};
|
||||||
if (selection.length > 0) {
|
param.ids = Array.from(this.selectRows).map(row => row.id);
|
||||||
if (selection.length === 1) {
|
param.planId = this.planId;
|
||||||
selection.hashTree = [];
|
this.$post('/test/plan/api/case/batch/delete', param, () => {
|
||||||
this.selectRows.add(selection[0]);
|
this.selectRows.clear();
|
||||||
} else {
|
this.initTable();
|
||||||
this.tableData.forEach(item => {
|
this.$emit('refresh');
|
||||||
item.hashTree = [];
|
this.$success(this.$t('test_track.cancel_relevance_success'));
|
||||||
this.$set(item, "showMore", true);
|
|
||||||
this.selectRows.add(item);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
this.selectRows.clear();
|
|
||||||
this.tableData.forEach(row => {
|
|
||||||
this.$set(row, "showMore", false);
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
});
|
||||||
search() {
|
},
|
||||||
this.initTable();
|
getResult(data) {
|
||||||
},
|
if (RESULT_MAP.get(data)) {
|
||||||
buildPagePath(path) {
|
return RESULT_MAP.get(data);
|
||||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
} else {
|
||||||
},
|
return RESULT_MAP.get("default");
|
||||||
reductionApi(row) {
|
}
|
||||||
let ids = [row.id];
|
},
|
||||||
this.$post('/api/testcase/reduction/', ids, () => {
|
runRefresh(data) {
|
||||||
this.$success(this.$t('commons.save_success'));
|
this.rowLoading = "";
|
||||||
this.search();
|
this.$success(this.$t('schedule.event_success'));
|
||||||
});
|
this.initTable();
|
||||||
},
|
},
|
||||||
handleDeleteBatch() {
|
singleRun(row) {
|
||||||
this.$alert(this.$t('api_test.definition.request.delete_confirm') + "?", '', {
|
if (!row.environmentId) {
|
||||||
confirmButtonText: this.$t('commons.confirm'),
|
this.$warning(this.$t('api_test.environment.select_environment'));
|
||||||
callback: (action) => {
|
return;
|
||||||
if (action === 'confirm') {
|
}
|
||||||
let param = {};
|
this.runData = [];
|
||||||
param.ids = Array.from(this.selectRows).map(row => row.id);
|
|
||||||
param.planId = this.planId;
|
|
||||||
this.$post('/test/plan/api/case/batch/delete', param, () => {
|
|
||||||
this.selectRows.clear();
|
|
||||||
this.initTable();
|
|
||||||
this.$emit('refresh');
|
|
||||||
this.$success(this.$t('test_track.cancel_relevance_success'));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
getResult(data) {
|
|
||||||
if (RESULT_MAP.get(data)) {
|
|
||||||
return RESULT_MAP.get(data);
|
|
||||||
} else {
|
|
||||||
return RESULT_MAP.get("default");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
runRefresh(data) {
|
|
||||||
this.rowLoading = "";
|
|
||||||
this.$success(this.$t('schedule.event_success'));
|
|
||||||
this.initTable();
|
|
||||||
},
|
|
||||||
singleRun(row) {
|
|
||||||
if (!row.environmentId) {
|
|
||||||
this.$warning(this.$t('api_test.environment.select_environment'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.runData = [];
|
|
||||||
|
|
||||||
this.rowLoading = row.id;
|
this.rowLoading = row.id;
|
||||||
|
|
||||||
|
this.$get('/api/testcase/get/' + row.caseId, (response) => {
|
||||||
|
let apiCase = response.data;
|
||||||
|
let request = JSON.parse(apiCase.request);
|
||||||
|
request.name = row.id;
|
||||||
|
request.id = row.id;
|
||||||
|
request.useEnvironment = row.environmentId;
|
||||||
|
this.runData.push(request);
|
||||||
|
/*触发执行操作*/
|
||||||
|
this.reportId = getUUID().substring(0, 8);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
batchEdit(form) {
|
||||||
|
let arr = Array.from(this.selectRows);
|
||||||
|
let ids = arr.map(row => row.id);
|
||||||
|
let param = {};
|
||||||
|
param[form.type] = form.value;
|
||||||
|
param.ids = ids;
|
||||||
|
this.$post('/api/testcase/batch/edit', param, () => {
|
||||||
|
this.$success(this.$t('commons.save_success'));
|
||||||
|
this.initTable();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleBatchExecute() {
|
||||||
|
this.selectRows.forEach(row => {
|
||||||
this.$get('/api/testcase/get/' + row.caseId, (response) => {
|
this.$get('/api/testcase/get/' + row.caseId, (response) => {
|
||||||
let apiCase = response.data;
|
let apiCase = response.data;
|
||||||
let request = JSON.parse(apiCase.request);
|
let request = JSON.parse(apiCase.request);
|
||||||
request.name = row.id;
|
request.name = row.id;
|
||||||
request.id = row.id;
|
request.id = row.id;
|
||||||
request.useEnvironment = row.environmentId;
|
request.useEnvironment = row.environmentId;
|
||||||
this.runData.push(request);
|
let runData = [];
|
||||||
/*触发执行操作*/
|
runData.push(request);
|
||||||
this.reportId = getUUID().substring(0, 8);
|
this.batchRun(runData, getUUID().substring(0, 8));
|
||||||
});
|
});
|
||||||
},
|
});
|
||||||
batchEdit(form) {
|
this.$message('任务执行中,请稍后刷新查看结果');
|
||||||
let arr = Array.from(this.selectRows);
|
this.search();
|
||||||
let ids = arr.map(row => row.id);
|
|
||||||
let param = {};
|
|
||||||
param[form.type] = form.value;
|
|
||||||
param.ids = ids;
|
|
||||||
this.$post('/api/testcase/batch/edit', param, () => {
|
|
||||||
this.$success(this.$t('commons.save_success'));
|
|
||||||
this.initTable();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
handleBatchExecute() {
|
|
||||||
this.selectRows.forEach(row => {
|
|
||||||
this.$get('/api/testcase/get/' + row.caseId, (response) => {
|
|
||||||
let apiCase = response.data;
|
|
||||||
let request = JSON.parse(apiCase.request);
|
|
||||||
request.name = row.id;
|
|
||||||
request.id = row.id;
|
|
||||||
request.useEnvironment = row.environmentId;
|
|
||||||
let runData = [];
|
|
||||||
runData.push(request);
|
|
||||||
this.batchRun(runData, getUUID().substring(0, 8));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
this.$message('任务执行中,请稍后刷新查看结果');
|
|
||||||
this.search();
|
|
||||||
},
|
|
||||||
batchRun(runData, reportId) {
|
|
||||||
let testPlan = new TestPlan();
|
|
||||||
let threadGroup = new ThreadGroup();
|
|
||||||
threadGroup.hashTree = [];
|
|
||||||
testPlan.hashTree = [threadGroup];
|
|
||||||
runData.forEach(item => {
|
|
||||||
threadGroup.hashTree.push(item);
|
|
||||||
});
|
|
||||||
let reqObj = {id: reportId, testElement: testPlan, type: 'API_PLAN', reportId: "run"};
|
|
||||||
let bodyFiles = getBodyUploadFiles(reqObj, runData);
|
|
||||||
this.$fileUpload("/api/definition/run", null, bodyFiles, reqObj, response => {
|
|
||||||
});
|
|
||||||
},
|
|
||||||
handleDelete(apiCase) {
|
|
||||||
this.$get('/test/plan/api/case/delete/' + apiCase.id, () => {
|
|
||||||
this.$success(this.$t('test_track.cancel_relevance_success'));
|
|
||||||
this.$emit('refresh');
|
|
||||||
this.initTable();
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
},
|
|
||||||
getProjectId() {
|
|
||||||
if (!this.isRelevanceModel) {
|
|
||||||
return getCurrentProjectID();
|
|
||||||
} else {
|
|
||||||
return this.currentCaseProjectId;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
setEnvironment(data) {
|
|
||||||
// this.environmentId = data.id;
|
|
||||||
},
|
|
||||||
getReportResult(apiCase) {
|
|
||||||
let url = "/api/definition/report/getReport/" + apiCase.id + '/' + 'API_PLAN';
|
|
||||||
this.$get(url, response => {
|
|
||||||
if (response.data) {
|
|
||||||
this.response = JSON.parse(response.data.content);
|
|
||||||
this.$refs.apiCaseResult.open();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
batchRun(runData, reportId) {
|
||||||
|
let testPlan = new TestPlan();
|
||||||
|
let threadGroup = new ThreadGroup();
|
||||||
|
threadGroup.hashTree = [];
|
||||||
|
testPlan.hashTree = [threadGroup];
|
||||||
|
runData.forEach(item => {
|
||||||
|
threadGroup.hashTree.push(item);
|
||||||
|
});
|
||||||
|
let reqObj = {id: reportId, testElement: testPlan, type: 'API_PLAN', reportId: "run"};
|
||||||
|
let bodyFiles = getBodyUploadFiles(reqObj, runData);
|
||||||
|
this.$fileUpload("/api/definition/run", null, bodyFiles, reqObj, response => {
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDelete(apiCase) {
|
||||||
|
this.$get('/test/plan/api/case/delete/' + apiCase.id, () => {
|
||||||
|
this.$success(this.$t('test_track.cancel_relevance_success'));
|
||||||
|
this.$emit('refresh');
|
||||||
|
this.initTable();
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
getProjectId() {
|
||||||
|
if (!this.isRelevanceModel) {
|
||||||
|
return getCurrentProjectID();
|
||||||
|
} else {
|
||||||
|
return this.currentCaseProjectId;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setEnvironment(data) {
|
||||||
|
// this.environmentId = data.id;
|
||||||
|
},
|
||||||
|
getReportResult(apiCase) {
|
||||||
|
let url = "/api/definition/report/getReport/" + apiCase.id + '/' + 'API_PLAN';
|
||||||
|
this.$get(url, response => {
|
||||||
|
if (response.data) {
|
||||||
|
this.response = JSON.parse(response.data.content);
|
||||||
|
this.$refs.apiCaseResult.open();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.operate-button > div {
|
.operate-button > div {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.request-method {
|
.request-method {
|
||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
color: #1E90FF;
|
color: #1E90FF;
|
||||||
}
|
}
|
||||||
|
|
||||||
.api-el-tag {
|
.api-el-tag {
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-input {
|
.search-input {
|
||||||
float: right;
|
float: right;
|
||||||
width: 300px;
|
width: 300px;
|
||||||
/*margin-bottom: 20px;*/
|
/*margin-bottom: 20px;*/
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.el-tag {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
<template>
|
||||||
|
<el-drawer
|
||||||
|
class="load-case-report-drawer"
|
||||||
|
:visible.sync="drawer"
|
||||||
|
direction="ltr"
|
||||||
|
@close="handleClose"
|
||||||
|
size="80%">
|
||||||
|
<load-case-report-view :report-id="reportId" ref="loadCaseReportView"/>
|
||||||
|
</el-drawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import LoadCaseReportView from "@/business/components/track/plan/view/comonents/load/LoadCaseReportView";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "LoadCaseReport",
|
||||||
|
components: {LoadCaseReportView},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
drawer: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
reportId: String
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleClose() {
|
||||||
|
this.drawer = false;
|
||||||
|
this.$emit('refresh');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.load-case-report-drawer >>> .el-drawer__header {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,376 @@
|
||||||
|
<template>
|
||||||
|
<ms-container>
|
||||||
|
<ms-main-container>
|
||||||
|
<el-card v-loading="result.loading" v-if="show">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="16">
|
||||||
|
<el-row>
|
||||||
|
<el-breadcrumb separator-class="el-icon-arrow-right">
|
||||||
|
<el-breadcrumb-item :to="{ path: '/performance/test/' + this.projectId }">{{ projectName }}
|
||||||
|
</el-breadcrumb-item>
|
||||||
|
<el-breadcrumb-item :to="{ path: '/performance/test/edit/' + this.testId }">{{ testName }}
|
||||||
|
</el-breadcrumb-item>
|
||||||
|
<el-breadcrumb-item>{{ reportName }}</el-breadcrumb-item>
|
||||||
|
</el-breadcrumb>
|
||||||
|
</el-row>
|
||||||
|
<el-row class="ms-report-view-btns">
|
||||||
|
<el-button :disabled="isReadOnly || report.status !== 'Running'" type="primary" plain size="mini"
|
||||||
|
@click="dialogFormVisible=true">
|
||||||
|
{{ $t('report.test_stop_now') }}
|
||||||
|
</el-button>
|
||||||
|
<el-button :disabled="isReadOnly || report.status !== 'Completed'" type="success" plain size="mini"
|
||||||
|
@click="rerun(testId)">
|
||||||
|
{{ $t('report.test_execute_again') }}
|
||||||
|
</el-button>
|
||||||
|
<el-button :disabled="isReadOnly" type="info" plain size="mini" @click="handleExport(reportName)">
|
||||||
|
{{ $t('test_track.plan_view.export_report') }}
|
||||||
|
</el-button>
|
||||||
|
<el-button :disabled="isReadOnly" type="warning" plain size="mini" @click="downloadJtl()">
|
||||||
|
{{ $t('report.downloadJtl') }}
|
||||||
|
</el-button>
|
||||||
|
|
||||||
|
<!--<el-button :disabled="isReadOnly" type="warning" plain size="mini">-->
|
||||||
|
<!--{{$t('report.compare')}}-->
|
||||||
|
<!--</el-button>-->
|
||||||
|
</el-row>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<span class="ms-report-time-desc">
|
||||||
|
{{ $t('report.test_duration', [this.minutes, this.seconds]) }}
|
||||||
|
</span>
|
||||||
|
<span class="ms-report-time-desc">
|
||||||
|
{{ $t('report.test_start_time') }}:{{ startTime }}
|
||||||
|
</span>
|
||||||
|
<span class="ms-report-time-desc">
|
||||||
|
{{ $t('report.test_end_time') }}:{{ endTime }}
|
||||||
|
</span>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-divider/>
|
||||||
|
<div ref="resume">
|
||||||
|
<el-tabs v-model="active" type="border-card" :stretch="true">
|
||||||
|
<el-tab-pane :label="$t('load_test.pressure_config')">
|
||||||
|
<ms-performance-pressure-config :is-read-only="true" :report="report"/>
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane :label="$t('report.test_overview')">
|
||||||
|
<ms-report-test-overview :report="report" ref="testOverview"/>
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane :label="$t('report.test_request_statistics')">
|
||||||
|
<ms-report-request-statistics :report="report" ref="requestStatistics"/>
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane :label="$t('report.test_error_log')">
|
||||||
|
<ms-report-error-log :report="report" ref="errorLog"/>
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane :label="$t('report.test_log_details')">
|
||||||
|
<ms-report-log-details :report="report"/>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ms-performance-report-export :title="reportName" id="performanceReportExport" v-show="reportExportVisible"
|
||||||
|
:report="report"/>
|
||||||
|
|
||||||
|
</el-card>
|
||||||
|
<el-dialog :title="$t('report.test_stop_now_confirm')" :visible.sync="dialogFormVisible" width="30%">
|
||||||
|
<p v-html="$t('report.force_stop_tips')"/>
|
||||||
|
<p v-html="$t('report.stop_tips')"/>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="danger" size="small" @click="stopTest(true)">{{ $t('report.force_stop_btn') }}
|
||||||
|
</el-button>
|
||||||
|
<el-button type="primary" size="small" @click="stopTest(false)">{{ $t('report.stop_btn') }}
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</ms-main-container>
|
||||||
|
</ms-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import {checkoutTestManagerOrTestUser, exportPdf} from "@/common/js/utils";
|
||||||
|
import html2canvas from 'html2canvas';
|
||||||
|
import {Message} from "element-ui";
|
||||||
|
import MsPerformanceReportExport from "@/business/components/performance/report/PerformanceReportExport";
|
||||||
|
import MsReportErrorLog from "@/business/components/performance/report/components/ErrorLog";
|
||||||
|
import MsReportLogDetails from "@/business/components/performance/report/components/LogDetails";
|
||||||
|
import MsReportRequestStatistics from "@/business/components/performance/report/components/RequestStatistics";
|
||||||
|
import MsReportTestOverview from "@/business/components/performance/report/components/TestOverview";
|
||||||
|
import MsContainer from "@/business/components/common/components/MsContainer";
|
||||||
|
import MsMainContainer from "@/business/components/common/components/MsMainContainer";
|
||||||
|
import MsPerformancePressureConfig from "@/business/components/performance/report/components/PerformancePressureConfig";
|
||||||
|
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "LoadCaseReportView",
|
||||||
|
components: {
|
||||||
|
MsPerformanceReportExport,
|
||||||
|
MsReportErrorLog,
|
||||||
|
MsReportLogDetails,
|
||||||
|
MsReportRequestStatistics,
|
||||||
|
MsReportTestOverview,
|
||||||
|
MsContainer,
|
||||||
|
MsMainContainer,
|
||||||
|
MsPerformancePressureConfig
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
result: {},
|
||||||
|
active: '1',
|
||||||
|
status: '',
|
||||||
|
reportName: '',
|
||||||
|
testId: '',
|
||||||
|
testName: '',
|
||||||
|
projectId: '',
|
||||||
|
projectName: '',
|
||||||
|
startTime: '0',
|
||||||
|
endTime: '0',
|
||||||
|
minutes: '0',
|
||||||
|
seconds: '0',
|
||||||
|
title: 'Logging',
|
||||||
|
report: {},
|
||||||
|
websocket: null,
|
||||||
|
dialogFormVisible: false,
|
||||||
|
reportExportVisible: false,
|
||||||
|
testPlan: {testResourcePoolId: null},
|
||||||
|
show: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
reportId: String,
|
||||||
|
isReadOnly: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
reportId() {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
initBreadcrumb(callback) {
|
||||||
|
if (this.reportId) {
|
||||||
|
this.result = this.$get("/performance/report/test/pro/info/" + this.reportId, res => {
|
||||||
|
let data = res.data;
|
||||||
|
if (data) {
|
||||||
|
this.reportName = data.name;
|
||||||
|
this.testId = data.testId;
|
||||||
|
this.testName = data.testName;
|
||||||
|
this.projectId = data.projectId;
|
||||||
|
this.projectName = data.projectName;
|
||||||
|
//
|
||||||
|
if (callback) callback(res);
|
||||||
|
} else {
|
||||||
|
this.$error(this.$t('report.not_exist'));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
initReportTimeInfo() {
|
||||||
|
if (this.status === 'Starting') {
|
||||||
|
this.clearData();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.reportId) {
|
||||||
|
this.result = this.$get("/performance/report/content/report_time/" + this.reportId)
|
||||||
|
.then(res => {
|
||||||
|
let data = res.data.data;
|
||||||
|
if (data) {
|
||||||
|
this.startTime = data.startTime;
|
||||||
|
this.endTime = data.endTime;
|
||||||
|
let duration = data.duration;
|
||||||
|
this.minutes = Math.floor(duration / 60);
|
||||||
|
this.seconds = duration % 60;
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
this.clearData();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
initWebSocket() {
|
||||||
|
let protocol = "ws://";
|
||||||
|
if (window.location.protocol === 'https:') {
|
||||||
|
protocol = "wss://";
|
||||||
|
}
|
||||||
|
const uri = protocol + window.location.host + "/performance/report/" + this.reportId;
|
||||||
|
this.websocket = new WebSocket(uri);
|
||||||
|
this.websocket.onmessage = this.onMessage;
|
||||||
|
this.websocket.onopen = this.onOpen;
|
||||||
|
this.websocket.onerror = this.onError;
|
||||||
|
this.websocket.onclose = this.onClose;
|
||||||
|
},
|
||||||
|
checkReportStatus(status) {
|
||||||
|
switch (status) {
|
||||||
|
case 'Error':
|
||||||
|
// this.$warning(this.$t('report.generation_error'));
|
||||||
|
this.active = '4';
|
||||||
|
break;
|
||||||
|
case 'Starting':
|
||||||
|
this.$alert(this.$t('report.start_status'));
|
||||||
|
break;
|
||||||
|
case 'Reporting':
|
||||||
|
case 'Running':
|
||||||
|
case 'Completed':
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
clearData() {
|
||||||
|
this.startTime = '0';
|
||||||
|
this.endTime = '0';
|
||||||
|
this.minutes = '0';
|
||||||
|
this.seconds = '0';
|
||||||
|
},
|
||||||
|
stopTest(forceStop) {
|
||||||
|
this.result = this.$get('/performance/stop/' + this.reportId + '/' + forceStop, () => {
|
||||||
|
this.$success(this.$t('report.test_stop_success'));
|
||||||
|
if (forceStop) {
|
||||||
|
this.$router.push('/performance/report/all');
|
||||||
|
} else {
|
||||||
|
this.report.status = 'Completed';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.dialogFormVisible = false;
|
||||||
|
},
|
||||||
|
rerun(testId) {
|
||||||
|
this.$confirm(this.$t('report.test_rerun_confirm'), '', {
|
||||||
|
confirmButtonText: this.$t('commons.confirm'),
|
||||||
|
cancelButtonText: this.$t('commons.cancel'),
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
// this.result = this.$post('/performance/run', {id: testId, triggerMode: 'MANUAL'}, (response) => {
|
||||||
|
// this.reportId = response.data;
|
||||||
|
// this.$router.push({path: '/performance/report/view/' + this.reportId});
|
||||||
|
// // 注册 socket
|
||||||
|
// this.initWebSocket();
|
||||||
|
// })
|
||||||
|
}).catch(() => {
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onOpen() {
|
||||||
|
// window.console.log("socket opening.");
|
||||||
|
},
|
||||||
|
onError(e) {
|
||||||
|
// window.console.error(e)
|
||||||
|
},
|
||||||
|
onMessage(e) {
|
||||||
|
this.$set(this.report, "refresh", e.data); // 触发刷新
|
||||||
|
if (e.data.startsWith('Error')) {
|
||||||
|
this.$set(this.report, "status", 'Error');
|
||||||
|
this.$warning(e.data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$set(this.report, "status", 'Running');
|
||||||
|
this.status = 'Running';
|
||||||
|
this.initReportTimeInfo();
|
||||||
|
// window.console.log('receive a message:', e.data);
|
||||||
|
},
|
||||||
|
onClose(e) {
|
||||||
|
if (e.code === 1005) {
|
||||||
|
// 强制删除之后关闭socket,不用刷新report
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$set(this.report, "refresh", Math.random()); // 触发刷新
|
||||||
|
this.$set(this.report, "status", 'Completed');
|
||||||
|
this.initReportTimeInfo();
|
||||||
|
// window.console.log("socket closed.");
|
||||||
|
},
|
||||||
|
handleExport(name) {
|
||||||
|
this.result.loading = true;
|
||||||
|
this.reportExportVisible = true;
|
||||||
|
let reset = this.exportReportReset;
|
||||||
|
|
||||||
|
this.$nextTick(function () {
|
||||||
|
setTimeout(() => {
|
||||||
|
html2canvas(document.getElementById('performanceReportExport'), {
|
||||||
|
scale: 2
|
||||||
|
}).then(function (canvas) {
|
||||||
|
exportPdf(name, [canvas]);
|
||||||
|
reset();
|
||||||
|
});
|
||||||
|
}, 1000);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
exportReportReset() {
|
||||||
|
this.reportExportVisible = false;
|
||||||
|
this.result.loading = false;
|
||||||
|
},
|
||||||
|
downloadJtl() {
|
||||||
|
let config = {
|
||||||
|
url: "/performance/report/jtl/download/" + this.reportId,
|
||||||
|
method: 'get',
|
||||||
|
responseType: 'blob'
|
||||||
|
};
|
||||||
|
this.result = this.$request(config).then(response => {
|
||||||
|
const content = response.data;
|
||||||
|
const blob = new Blob([content]);
|
||||||
|
if ("download" in document.createElement("a")) {
|
||||||
|
// 非IE下载
|
||||||
|
// chrome/firefox
|
||||||
|
let aTag = document.createElement('a');
|
||||||
|
aTag.download = this.reportId + ".jtl";
|
||||||
|
aTag.href = URL.createObjectURL(blob);
|
||||||
|
aTag.click();
|
||||||
|
URL.revokeObjectURL(aTag.href)
|
||||||
|
} else {
|
||||||
|
// IE10+下载
|
||||||
|
navigator.msSaveBlob(blob, this.filename)
|
||||||
|
}
|
||||||
|
}).catch(e => {
|
||||||
|
let text = e.response.data.text();
|
||||||
|
text.then((data) => {
|
||||||
|
Message.error({message: JSON.parse(data).message || e.message, showClose: true});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
init() {
|
||||||
|
this.isReadOnly = false;
|
||||||
|
if (!checkoutTestManagerOrTestUser()) {
|
||||||
|
this.isReadOnly = true;
|
||||||
|
}
|
||||||
|
this.clearData();
|
||||||
|
this.result = this.$get("/performance/report/" + this.reportId, res => {
|
||||||
|
let data = res.data;
|
||||||
|
if (data) {
|
||||||
|
this.status = data.status;
|
||||||
|
this.$set(this.report, "id", this.reportId);
|
||||||
|
this.$set(this.report, "status", data.status);
|
||||||
|
this.$set(this.report, "testId", data.testId);
|
||||||
|
this.$set(this.report, "loadConfiguration", data.loadConfiguration);
|
||||||
|
this.checkReportStatus(data.status);
|
||||||
|
if (this.status === "Completed" || this.status === "Running") {
|
||||||
|
this.initReportTimeInfo();
|
||||||
|
}
|
||||||
|
this.initBreadcrumb();
|
||||||
|
this.initWebSocket();
|
||||||
|
} else {
|
||||||
|
this.$error(this.$t('report.not_exist'))
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
.ms-report-view-btns {
|
||||||
|
margin-top: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ms-report-time-desc {
|
||||||
|
text-align: left;
|
||||||
|
display: block;
|
||||||
|
color: #5C7878;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-export .el-card {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
|
@ -0,0 +1,241 @@
|
||||||
|
<template>
|
||||||
|
<test-case-relevance-base
|
||||||
|
@setProject="setProject"
|
||||||
|
@save="saveCaseRelevance"
|
||||||
|
:plan-id="planId"
|
||||||
|
ref="baseRelevance">
|
||||||
|
|
||||||
|
<template v-slot:aside>
|
||||||
|
<node-tree class="node-tree"
|
||||||
|
v-loading="result.loading"
|
||||||
|
@nodeSelectEvent="nodeChange"
|
||||||
|
:tree-nodes="treeNodes"
|
||||||
|
ref="nodeTree"/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- <ms-table-header :condition.sync="condition" @search="search" title="" :show-create="false"/>-->
|
||||||
|
|
||||||
|
<el-table
|
||||||
|
v-loading="result.loading"
|
||||||
|
:data="testCases"
|
||||||
|
row-key="id"
|
||||||
|
@select-all="handleSelectAll"
|
||||||
|
@select="handleSelectionChange"
|
||||||
|
height="50vh"
|
||||||
|
ref="table">
|
||||||
|
<el-table-column
|
||||||
|
type="selection"/>
|
||||||
|
<el-table-column
|
||||||
|
prop="name"
|
||||||
|
:label="$t('commons.name')"
|
||||||
|
show-overflow-tooltip>
|
||||||
|
</el-table-column>
|
||||||
|
<!-- <el-table-column-->
|
||||||
|
<!-- prop="userName"-->
|
||||||
|
<!-- :label="$t('load_test.user_name')"-->
|
||||||
|
<!-- show-overflow-tooltip>-->
|
||||||
|
<!-- </el-table-column>-->
|
||||||
|
<el-table-column
|
||||||
|
prop="status"
|
||||||
|
column-key="status"
|
||||||
|
:filters="statusFilters"
|
||||||
|
:label="$t('commons.status')">
|
||||||
|
<template v-slot:default="{row}">
|
||||||
|
<ms-performance-test-status :row="row"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
sortable
|
||||||
|
prop="createTime"
|
||||||
|
:label="$t('commons.create_time')">
|
||||||
|
<template v-slot:default="scope">
|
||||||
|
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
sortable
|
||||||
|
prop="updateTime"
|
||||||
|
:label="$t('commons.update_time')">
|
||||||
|
<template v-slot:default="scope">
|
||||||
|
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<ms-table-pagination :change="getTestCases" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||||
|
:total="total"/>
|
||||||
|
</test-case-relevance-base>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import TestCaseRelevanceBase from "@/business/components/track/plan/view/comonents/base/TestCaseRelevanceBase";
|
||||||
|
import NodeTree from "@/business/components/track/common/NodeTree";
|
||||||
|
import PriorityTableItem from "@/business/components/track/common/tableItems/planview/PriorityTableItem";
|
||||||
|
import TypeTableItem from "@/business/components/track/common/tableItems/planview/TypeTableItem";
|
||||||
|
import MsTableSearchBar from "@/business/components/common/components/MsTableSearchBar";
|
||||||
|
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
|
||||||
|
import MsTableHeader from "@/business/components/common/components/MsTableHeader";
|
||||||
|
import MsPerformanceTestStatus from "@/business/components/performance/test/PerformanceTestStatus";
|
||||||
|
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "TestCaseLoadRelevance",
|
||||||
|
components: {
|
||||||
|
TestCaseRelevanceBase,
|
||||||
|
NodeTree,
|
||||||
|
PriorityTableItem,
|
||||||
|
TypeTableItem,
|
||||||
|
MsTableSearchBar,
|
||||||
|
MsTableAdvSearchBar,
|
||||||
|
MsTableHeader,
|
||||||
|
MsPerformanceTestStatus,
|
||||||
|
MsTablePagination
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
result: {},
|
||||||
|
testCases: [],
|
||||||
|
selectIds: new Set(),
|
||||||
|
treeNodes: [],
|
||||||
|
selectNodeIds: [],
|
||||||
|
selectNodeNames: [],
|
||||||
|
projectId: '',
|
||||||
|
projectName: '',
|
||||||
|
projects: [],
|
||||||
|
pageSize: 10,
|
||||||
|
currentPage: 1,
|
||||||
|
total: 0,
|
||||||
|
condition: {},
|
||||||
|
statusFilters: [
|
||||||
|
{text: 'Saved', value: 'Saved'},
|
||||||
|
{text: 'Starting', value: 'Starting'},
|
||||||
|
{text: 'Running', value: 'Running'},
|
||||||
|
{text: 'Reporting', value: 'Reporting'},
|
||||||
|
{text: 'Completed', value: 'Completed'},
|
||||||
|
{text: 'Error', value: 'Error'}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
planId: {
|
||||||
|
type: String
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
planId() {
|
||||||
|
this.condition.planId = this.planId;
|
||||||
|
},
|
||||||
|
selectNodeIds() {
|
||||||
|
this.search();
|
||||||
|
},
|
||||||
|
projectId() {
|
||||||
|
this.condition.projectId = this.projectId;
|
||||||
|
this.getProjectNode();
|
||||||
|
this.search();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
open() {
|
||||||
|
this.$refs.baseRelevance.open();
|
||||||
|
},
|
||||||
|
setProject(projectId) {
|
||||||
|
this.projectId = projectId;
|
||||||
|
},
|
||||||
|
saveCaseRelevance() {
|
||||||
|
let param = {};
|
||||||
|
param.testPlanId = this.planId;
|
||||||
|
param.caseIds = [...this.selectIds];
|
||||||
|
this.result = this.$post('/test/plan/load/case/relevance', param, () => {
|
||||||
|
this.selectIds.clear();
|
||||||
|
this.$success(this.$t('commons.save_success'));
|
||||||
|
|
||||||
|
this.$refs.baseRelevance.close();
|
||||||
|
|
||||||
|
this.$emit('refresh');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
buildPagePath(path) {
|
||||||
|
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||||
|
},
|
||||||
|
search() {
|
||||||
|
this.currentPage = 1;
|
||||||
|
this.testCases = [];
|
||||||
|
this.getTestCases(true);
|
||||||
|
},
|
||||||
|
getTestCases() {
|
||||||
|
if (this.planId) {
|
||||||
|
this.condition.testPlanId = this.planId;
|
||||||
|
}
|
||||||
|
if (this.projectId) {
|
||||||
|
this.condition.projectId = this.projectId;
|
||||||
|
this.result = this.$post(this.buildPagePath('/test/plan/load/case/relevance/list'), this.condition, response => {
|
||||||
|
let data = response.data;
|
||||||
|
this.total = data.itemCount;
|
||||||
|
this.testCases = data.listObject;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleSelectAll(selection) {
|
||||||
|
if (selection.length > 0) {
|
||||||
|
this.testCases.forEach(item => {
|
||||||
|
this.selectIds.add(item.id);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.testCases.forEach(item => {
|
||||||
|
if (this.selectIds.has(item.id)) {
|
||||||
|
this.selectIds.delete(item.id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleSelectionChange(selection, row) {
|
||||||
|
if (this.selectIds.has(row.id)) {
|
||||||
|
this.selectIds.delete(row.id);
|
||||||
|
} else {
|
||||||
|
this.selectIds.add(row.id);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
nodeChange(node, nodeIds, nodeNames) {
|
||||||
|
this.selectNodeIds = nodeIds;
|
||||||
|
this.selectNodeNames = nodeNames;
|
||||||
|
},
|
||||||
|
refresh() {
|
||||||
|
this.close();
|
||||||
|
},
|
||||||
|
getAllNodeTreeByPlanId() {
|
||||||
|
if (this.planId) {
|
||||||
|
let param = {
|
||||||
|
testPlanId: this.planId,
|
||||||
|
projectId: this.projectId
|
||||||
|
};
|
||||||
|
this.result = this.$post("/case/node/list/all/plan", param, response => {
|
||||||
|
this.treeNodes = response.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.selectIds.clear();
|
||||||
|
this.selectNodeIds = [];
|
||||||
|
this.selectNodeNames = [];
|
||||||
|
},
|
||||||
|
getProjectNode(projectId) {
|
||||||
|
const index = this.projects.findIndex(project => project.id === projectId);
|
||||||
|
if (index !== -1) {
|
||||||
|
this.projectName = this.projects[index].name;
|
||||||
|
}
|
||||||
|
if (projectId) {
|
||||||
|
this.projectId = projectId;
|
||||||
|
}
|
||||||
|
this.$refs.nodeTree.result = this.$post("/case/node/list/all/plan",
|
||||||
|
{testPlanId: this.planId, projectId: this.projectId}, response => {
|
||||||
|
this.treeNodes = response.data;
|
||||||
|
});
|
||||||
|
this.selectNodeIds = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
|
@ -0,0 +1,96 @@
|
||||||
|
<template>
|
||||||
|
<ms-test-plan-common-component>
|
||||||
|
<template v-slot:aside>
|
||||||
|
<node-tree class="node-tree"
|
||||||
|
v-loading="result.loading"
|
||||||
|
@nodeSelectEvent="nodeChange"
|
||||||
|
:tree-nodes="treeNodes"
|
||||||
|
ref="nodeTree"/>
|
||||||
|
</template>
|
||||||
|
<template v-slot:main>
|
||||||
|
<test-plan-load-case-list
|
||||||
|
class="table-list"
|
||||||
|
@refresh="refresh"
|
||||||
|
:plan-id="planId"
|
||||||
|
:select-node-ids="selectNodeIds"
|
||||||
|
:select-parent-nodes="selectParentNodes"
|
||||||
|
@relevanceCase="openTestCaseRelevanceDialog"
|
||||||
|
ref="testPlanLoadCaseList"/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<test-case-load-relevance
|
||||||
|
@refresh="refresh"
|
||||||
|
:plan-id="planId"
|
||||||
|
ref="testCaseLoadRelevance"/>
|
||||||
|
</ms-test-plan-common-component>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
|
||||||
|
import MsTestPlanCommonComponent from "@/business/components/track/plan/view/comonents/base/TestPlanCommonComponent";
|
||||||
|
import NodeTree from "@/business/components/track/common/NodeTree";
|
||||||
|
import TestPlanLoadCaseList from "@/business/components/track/plan/view/comonents/load/TestPlanLoadCaseList";
|
||||||
|
import TestCaseLoadRelevance from "@/business/components/track/plan/view/comonents/load/TestCaseLoadRelevance";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "TestPlanLoad",
|
||||||
|
components: {
|
||||||
|
MsTestPlanCommonComponent,
|
||||||
|
NodeTree,
|
||||||
|
TestPlanLoadCaseList,
|
||||||
|
TestCaseLoadRelevance,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
result: {},
|
||||||
|
selectNodeIds: [],
|
||||||
|
selectParentNodes: [],
|
||||||
|
treeNodes: [],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: [
|
||||||
|
'planId'
|
||||||
|
],
|
||||||
|
watch: {
|
||||||
|
planId() {
|
||||||
|
this.initData();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.initData();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
refresh() {
|
||||||
|
this.selectNodeIds = [];
|
||||||
|
this.selectParentNodes = [];
|
||||||
|
this.$refs.testCaseLoadRelevance.search();
|
||||||
|
this.getNodeTreeByPlanId();
|
||||||
|
},
|
||||||
|
initData() {
|
||||||
|
this.getNodeTreeByPlanId();
|
||||||
|
},
|
||||||
|
openTestCaseRelevanceDialog() {
|
||||||
|
this.$refs.testCaseLoadRelevance.open();
|
||||||
|
},
|
||||||
|
nodeChange(node, nodeIds, pNodes) {
|
||||||
|
this.selectNodeIds = nodeIds;
|
||||||
|
this.selectParentNodes = pNodes;
|
||||||
|
// 切换node后,重置分页数
|
||||||
|
this.$refs.testPlanLoadCaseList.currentPage = 1;
|
||||||
|
this.$refs.testPlanLoadCaseList.pageSize = 10;
|
||||||
|
},
|
||||||
|
getNodeTreeByPlanId() {
|
||||||
|
if (this.planId) {
|
||||||
|
this.result = this.$get("/case/node/list/plan/" + this.planId, response => {
|
||||||
|
this.treeNodes = response.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
|
@ -0,0 +1,264 @@
|
||||||
|
<template>
|
||||||
|
<div class="card-container">
|
||||||
|
<el-card class="card-content" v-loading="result.loading">
|
||||||
|
<template v-slot:header>
|
||||||
|
<test-plan-load-case-list-header
|
||||||
|
:condition="condition"
|
||||||
|
:plan-id="planId"
|
||||||
|
@refresh="initTable"
|
||||||
|
@relevanceCase="$emit('relevanceCase')"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<el-table v-loading="result.loading"
|
||||||
|
border
|
||||||
|
:data="tableData" row-key="id" class="test-content adjust-table"
|
||||||
|
@select-all="handleSelectAll"
|
||||||
|
@filter-change="filter"
|
||||||
|
@sort-change="sort"
|
||||||
|
@select="handleSelectionChange" :height="screenHeight">
|
||||||
|
<el-table-column type="selection"/>
|
||||||
|
<el-table-column width="40" :resizable="false" align="center">
|
||||||
|
<template v-slot:default="scope">
|
||||||
|
<show-more-btn :is-show="scope.row.showMore && !isReadOnly" :buttons="buttons" :size="selectRows.size"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<!-- <el-table-column prop="num" label="ID" show-overflow-tooltip/>-->
|
||||||
|
<el-table-column
|
||||||
|
prop="caseName"
|
||||||
|
:label="$t('commons.name')"
|
||||||
|
show-overflow-tooltip>
|
||||||
|
</el-table-column>
|
||||||
|
<!-- <el-table-column-->
|
||||||
|
<!-- prop="projectName"-->
|
||||||
|
<!-- :label="$t('load_test.project_name')"-->
|
||||||
|
<!-- width="150"-->
|
||||||
|
<!-- show-overflow-tooltip>-->
|
||||||
|
<!-- </el-table-column>-->
|
||||||
|
<el-table-column
|
||||||
|
prop="userName"
|
||||||
|
:label="$t('load_test.user_name')"
|
||||||
|
show-overflow-tooltip>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
sortable
|
||||||
|
prop="createTime"
|
||||||
|
:label="$t('commons.create_time')">
|
||||||
|
<template v-slot:default="scope">
|
||||||
|
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
sortable
|
||||||
|
prop="updateTime"
|
||||||
|
:label="$t('commons.update_time')">
|
||||||
|
<template v-slot:default="scope">
|
||||||
|
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="status"
|
||||||
|
column-key="status"
|
||||||
|
:filters="statusFilters"
|
||||||
|
:label="$t('commons.status')">
|
||||||
|
<template v-slot:default="{row}">
|
||||||
|
<ms-performance-test-status :row="row"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="报告"
|
||||||
|
show-overflow-tooltip>
|
||||||
|
<template v-slot:default="scope">
|
||||||
|
<div v-loading="loading === scope.row.id">
|
||||||
|
<el-link type="info" @click="getReport(scope.row)" v-if="scope.row.loadReportId">查看报告</el-link>
|
||||||
|
<span v-else> - </span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column v-if="!isReadOnly" :label="$t('commons.operating')" align="center">
|
||||||
|
<template v-slot:default="scope">
|
||||||
|
<ms-table-operator-button class="run-button" :is-tester-permission="true" :tip="$t('api_test.run')"
|
||||||
|
icon="el-icon-video-play"
|
||||||
|
@exec="run(scope.row)" v-tester/>
|
||||||
|
<ms-table-operator-button :is-tester-permission="true" :tip="$t('test_track.plan_view.cancel_relevance')"
|
||||||
|
icon="el-icon-unlock" type="danger" @exec="handleDelete(scope.row)" v-tester/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<ms-table-pagination :change="initTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||||
|
:total="total"/>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<load-case-report :report-id="reportId" ref="loadCaseReport" @refresh="initTable"/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import TestPlanLoadCaseListHeader
|
||||||
|
from "@/business/components/track/plan/view/comonents/load/TestPlanLoadCaseListHeader";
|
||||||
|
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
|
||||||
|
import {_filter, _sort} from "@/common/js/utils";
|
||||||
|
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
|
||||||
|
import MsPerformanceTestStatus from "@/business/components/performance/test/PerformanceTestStatus";
|
||||||
|
import MsTableOperatorButton from "@/business/components/common/components/MsTableOperatorButton";
|
||||||
|
import LoadCaseReport from "@/business/components/track/plan/view/comonents/load/LoadCaseReport";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "TestPlanLoadCaseList",
|
||||||
|
components: {
|
||||||
|
LoadCaseReport,
|
||||||
|
TestPlanLoadCaseListHeader,
|
||||||
|
ShowMoreBtn,
|
||||||
|
MsTablePagination,
|
||||||
|
MsPerformanceTestStatus,
|
||||||
|
MsTableOperatorButton
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
condition: {},
|
||||||
|
result: {},
|
||||||
|
tableData: [],
|
||||||
|
selectRows: new Set(),
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
total: 0,
|
||||||
|
screenHeight: document.documentElement.clientHeight - 330,//屏幕高度
|
||||||
|
buttons: [
|
||||||
|
// {
|
||||||
|
// name: "批量编辑用例", handleClick: this.handleBatchEdit
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
name: "批量取消关联", handleClick: this.handleDeleteBatch
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "批量执行用例", handleClick: this.handleRunBatch
|
||||||
|
}
|
||||||
|
],
|
||||||
|
statusFilters: [
|
||||||
|
{text: 'Saved', value: 'Saved'},
|
||||||
|
{text: 'Starting', value: 'Starting'},
|
||||||
|
{text: 'Running', value: 'Running'},
|
||||||
|
{text: 'Reporting', value: 'Reporting'},
|
||||||
|
{text: 'Completed', value: 'Completed'},
|
||||||
|
{text: 'Error', value: 'Error'}
|
||||||
|
],
|
||||||
|
reportId: '',
|
||||||
|
loading: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
selectNodeIds: Array,
|
||||||
|
isReadOnly: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
planId: String
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.initTable();
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
selectNodeIds() {
|
||||||
|
this.initTable();
|
||||||
|
},
|
||||||
|
planId() {
|
||||||
|
this.initTable();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
initTable() {
|
||||||
|
this.$post("/test/plan/load/case/list/" + this.currentPage + "/" + this.pageSize, {testPlanId: this.planId}, response => {
|
||||||
|
let data = response.data;
|
||||||
|
this.total = data.itemCount;
|
||||||
|
this.tableData = data.listObject;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleSelectAll(selection) {
|
||||||
|
if (selection.length > 0) {
|
||||||
|
this.tableData.forEach(item => {
|
||||||
|
this.$set(item, "showMore", true);
|
||||||
|
this.selectRows.add(item);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.selectRows.clear();
|
||||||
|
this.tableData.forEach(row => {
|
||||||
|
this.$set(row, "showMore", false);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleSelectionChange(selection, row) {
|
||||||
|
if (this.selectRows.has(row)) {
|
||||||
|
this.$set(row, "showMore", false);
|
||||||
|
this.selectRows.delete(row);
|
||||||
|
} else {
|
||||||
|
this.$set(row, "showMore", true);
|
||||||
|
this.selectRows.add(row);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// handleBatchEdit() {
|
||||||
|
//
|
||||||
|
// },
|
||||||
|
handleDeleteBatch() {
|
||||||
|
|
||||||
|
},
|
||||||
|
handleRunBatch() {
|
||||||
|
|
||||||
|
},
|
||||||
|
run(loadCase) {
|
||||||
|
this.$post('/test/plan/load/case/run', {
|
||||||
|
id: loadCase.loadCaseId,
|
||||||
|
testPlanLoadId: loadCase.id,
|
||||||
|
triggerMode: 'MANUAL'
|
||||||
|
}, response => {
|
||||||
|
let reportId = response.data;
|
||||||
|
this.initTable();
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleDelete(loadCase) {
|
||||||
|
this.$get('/test/plan/load/case/delete/' + loadCase.id, () => {
|
||||||
|
this.$success(this.$t('test_track.cancel_relevance_success'));
|
||||||
|
this.$emit('refresh');
|
||||||
|
this.initTable();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
sort(column) {
|
||||||
|
// 每次只对一个字段排序
|
||||||
|
if (this.condition.orders) {
|
||||||
|
this.condition.orders = [];
|
||||||
|
}
|
||||||
|
_sort(column, this.condition);
|
||||||
|
this.initTableData();
|
||||||
|
},
|
||||||
|
filter(filters) {
|
||||||
|
_filter(filters, this.condition);
|
||||||
|
this.initTableData();
|
||||||
|
},
|
||||||
|
getReport(data) {
|
||||||
|
const {loadReportId} = data;
|
||||||
|
this.reportId = loadReportId;
|
||||||
|
this.loading = data.id;
|
||||||
|
this.$post('/test/plan/load/case/report/exist', {
|
||||||
|
testPlanLoadCaseId: data.id,
|
||||||
|
reportId: loadReportId
|
||||||
|
}, response => {
|
||||||
|
let exist = response.data;
|
||||||
|
this.loading = "";
|
||||||
|
if (exist) {
|
||||||
|
this.$refs.loadCaseReport.drawer = true;
|
||||||
|
} else {
|
||||||
|
this.$warning("报告不存在");
|
||||||
|
// this.initTable();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/deep/ .run-button {
|
||||||
|
background-color: #409EFF;
|
||||||
|
border-color: #409EFF;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,32 @@
|
||||||
|
<template>
|
||||||
|
<ms-table-header :is-tester-permission="true"
|
||||||
|
:condition="condition"
|
||||||
|
@search="$emit('refresh')"
|
||||||
|
:show-create="false"
|
||||||
|
:tip="$t('commons.search_by_name_or_id')">
|
||||||
|
<template v-slot:title>
|
||||||
|
性能用例
|
||||||
|
</template>
|
||||||
|
<template v-slot:button>
|
||||||
|
<ms-table-button :is-tester-permission="true" icon="el-icon-connection"
|
||||||
|
:content="$t('test_track.plan_view.relevance_test_case')"
|
||||||
|
@click="$emit('relevanceCase')"/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</ms-table-header>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import MsTableButton from "@/business/components/common/components/MsTableButton";
|
||||||
|
import MsTableHeader from "@/business/components/common/components/MsTableHeader";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "TestPlanLoadCaseListHeader",
|
||||||
|
components: {MsTableButton, MsTableHeader},
|
||||||
|
props: ['condition'],
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
|
@ -174,7 +174,8 @@ export default {
|
||||||
case: "all",
|
case: "all",
|
||||||
review: "all"
|
review: "all"
|
||||||
},
|
},
|
||||||
image: 'Image'
|
image: 'Image',
|
||||||
|
tag: 'Tag'
|
||||||
},
|
},
|
||||||
license: {
|
license: {
|
||||||
title: 'Authorization management',
|
title: 'Authorization management',
|
||||||
|
|
|
@ -174,7 +174,8 @@ export default {
|
||||||
case: "全部用例",
|
case: "全部用例",
|
||||||
review: "全部评审"
|
review: "全部评审"
|
||||||
},
|
},
|
||||||
image: '镜像'
|
image: '镜像',
|
||||||
|
tag: '标签'
|
||||||
},
|
},
|
||||||
license: {
|
license: {
|
||||||
title: '授权管理',
|
title: '授权管理',
|
||||||
|
|
|
@ -174,7 +174,8 @@ export default {
|
||||||
case: "全部用例",
|
case: "全部用例",
|
||||||
review: "全部評審"
|
review: "全部評審"
|
||||||
},
|
},
|
||||||
image: '鏡像'
|
image: '鏡像',
|
||||||
|
tag: '標簽'
|
||||||
},
|
},
|
||||||
license: {
|
license: {
|
||||||
title: '授權管理',
|
title: '授權管理',
|
||||||
|
|
Loading…
Reference in New Issue