diff --git a/Jenkinsfile b/Jenkinsfile index 56ff1ffba3..5901853f5d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,10 +1,10 @@ pipeline { agent { node { - label 'master' + label 'metersphere' } } - options { quietPeriod(1200) } + options { quietPeriod(600) } parameters { string(name: 'IMAGE_NAME', defaultValue: 'metersphere', description: '构建后的 Docker 镜像名称') string(name: 'IMAGE_FREFIX', defaultValue: 'registry.cn-qingdao.aliyuncs.com/metersphere', description: '构建后的 Docker 镜像带仓库名的前缀') diff --git a/backend/src/main/java/io/metersphere/api/controller/APIScenarioReportController.java b/backend/src/main/java/io/metersphere/api/controller/APIScenarioReportController.java index 560ce4f1ce..2962ffc1b7 100644 --- a/backend/src/main/java/io/metersphere/api/controller/APIScenarioReportController.java +++ b/backend/src/main/java/io/metersphere/api/controller/APIScenarioReportController.java @@ -2,10 +2,10 @@ package io.metersphere.api.controller; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; -import io.metersphere.api.dto.APIReportResult; import io.metersphere.api.dto.DeleteAPIReportRequest; import io.metersphere.api.dto.QueryAPIReportRequest; import io.metersphere.api.dto.automation.APIScenarioReportResult; +import io.metersphere.api.dto.automation.ExecuteType; import io.metersphere.api.service.ApiScenarioReportService; import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.utils.PageUtils; @@ -27,8 +27,8 @@ public class APIScenarioReportController { private ApiScenarioReportService apiReportService; @GetMapping("/get/{reportId}/{infoDb}") - public APIReportResult get(@PathVariable String reportId,@PathVariable Boolean infoDb) { - if(infoDb){ + public APIScenarioReportResult get(@PathVariable String reportId, @PathVariable Boolean infoDb) { + if (infoDb) { return apiReportService.get(reportId); } return apiReportService.getCacheResult(reportId); @@ -44,12 +44,14 @@ public class APIScenarioReportController { @PostMapping("/add") @RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR) public String add(@RequestBody APIScenarioReportResult node) { - return apiReportService.add(node); + node.setExecuteType(ExecuteType.Saved.name()); + return apiReportService.save(node); } @PostMapping("/update") @RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR) public String update(@RequestBody APIScenarioReportResult node) { + node.setExecuteType(ExecuteType.Saved.name()); return apiReportService.update(node); } diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java b/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java index c409627fc8..844d6138b6 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java @@ -6,6 +6,7 @@ import io.metersphere.api.dto.automation.*; import io.metersphere.api.dto.definition.RunDefinitionRequest; import io.metersphere.api.service.ApiAutomationService; import io.metersphere.base.domain.ApiScenario; +import io.metersphere.base.domain.ApiScenarioWithBLOBs; import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.Pager; @@ -69,17 +70,19 @@ public class ApiAutomationController { } @PostMapping("/getApiScenarios") - public List getApiScenarios(@RequestBody List ids) { + public List getApiScenarios(@RequestBody List ids) { return apiAutomationService.getApiScenarios(ids); } @PostMapping(value = "/run/debug") public void runDebug(@RequestPart("request") RunDefinitionRequest request, @RequestPart(value = "files") List bodyFiles) { + request.setExecuteType(ExecuteType.Debug.name()); apiAutomationService.run(request, bodyFiles); } @PostMapping(value = "/run") public void run(@RequestBody RunScenarioRequest request) { + request.setExecuteType(ExecuteType.Completed.name()); apiAutomationService.run(request); } diff --git a/backend/src/main/java/io/metersphere/api/dto/automation/APIScenarioReportResult.java b/backend/src/main/java/io/metersphere/api/dto/automation/APIScenarioReportResult.java index dae152bd5a..0f2b531f08 100644 --- a/backend/src/main/java/io/metersphere/api/dto/automation/APIScenarioReportResult.java +++ b/backend/src/main/java/io/metersphere/api/dto/automation/APIScenarioReportResult.java @@ -4,6 +4,8 @@ import io.metersphere.base.domain.ApiScenarioReport; import lombok.Getter; import lombok.Setter; +import java.util.List; + @Setter @Getter public class APIScenarioReportResult extends ApiScenarioReport { @@ -12,7 +14,11 @@ public class APIScenarioReportResult extends ApiScenarioReport { private String projectName; + private String testId; + private String userName; + private List scenarioIds; + private String content; } diff --git a/backend/src/main/java/io/metersphere/api/dto/automation/ExecuteType.java b/backend/src/main/java/io/metersphere/api/dto/automation/ExecuteType.java new file mode 100644 index 0000000000..090f902228 --- /dev/null +++ b/backend/src/main/java/io/metersphere/api/dto/automation/ExecuteType.java @@ -0,0 +1,5 @@ +package io.metersphere.api.dto.automation; + +public enum ExecuteType { + Saved, Completed, Debug +} diff --git a/backend/src/main/java/io/metersphere/api/dto/automation/RunScenarioRequest.java b/backend/src/main/java/io/metersphere/api/dto/automation/RunScenarioRequest.java index 623f1bd371..088b05d1b9 100644 --- a/backend/src/main/java/io/metersphere/api/dto/automation/RunScenarioRequest.java +++ b/backend/src/main/java/io/metersphere/api/dto/automation/RunScenarioRequest.java @@ -13,9 +13,13 @@ public class RunScenarioRequest { private String reportId; + private String projectId; + private String environmentId; private String triggerMode; + private String executeType; + private List scenarioIds; } diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/RunDefinitionRequest.java b/backend/src/main/java/io/metersphere/api/dto/definition/RunDefinitionRequest.java index 5a5d2bb923..3d55ac5acc 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/RunDefinitionRequest.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/RunDefinitionRequest.java @@ -15,10 +15,14 @@ public class RunDefinitionRequest { private String reportId; + private String projectId; + private String environmentId; private MsTestElement testElement; + private String executeType; + private Response response; private List bodyUploadIds; diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java index 29f8835dae..ea31fda093 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java @@ -11,17 +11,17 @@ import io.metersphere.api.dto.scenario.KeyValue; import io.metersphere.api.dto.scenario.environment.EnvironmentConfig; import io.metersphere.api.service.ApiAutomationService; import io.metersphere.api.service.ApiTestEnvironmentService; -import io.metersphere.base.domain.ApiScenario; +import io.metersphere.base.domain.ApiScenarioWithBLOBs; import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs; import io.metersphere.commons.utils.CommonBeanFactory; import lombok.Data; import lombok.EqualsAndHashCode; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.jmeter.config.Arguments; import org.apache.jmeter.save.SaveService; import org.apache.jmeter.testelement.TestElement; import org.apache.jorphan.collections.HashTree; -import org.apache.jmeter.config.Arguments; import java.util.LinkedList; import java.util.List; @@ -67,7 +67,7 @@ public class MsScenario extends MsTestElement { ApiAutomationService apiAutomationService = CommonBeanFactory.getBean(ApiAutomationService.class); ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - ApiScenario scenario = apiAutomationService.getApiScenario(this.getId()); + ApiScenarioWithBLOBs scenario = apiAutomationService.getApiScenario(this.getId()); JSONObject element = JSON.parseObject(scenario.getScenarioDefinition()); LinkedList elements = mapper.readValue(element.getString("hashTree"), new TypeReference>() { }); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java index 79ae051156..363cd867a6 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java @@ -101,7 +101,7 @@ public abstract class MsTestElement { return baos.toString(); } catch (Exception e) { e.printStackTrace(); - LogUtil.warn("HashTree error, can't log jmx content"); + LogUtil.warn("HashTree error, can't log jmx scenarioDefinition"); } return null; } diff --git a/backend/src/main/java/io/metersphere/api/parse/ApiImportAbstractParser.java b/backend/src/main/java/io/metersphere/api/parse/ApiImportAbstractParser.java index b1e20d8260..e455e98637 100644 --- a/backend/src/main/java/io/metersphere/api/parse/ApiImportAbstractParser.java +++ b/backend/src/main/java/io/metersphere/api/parse/ApiImportAbstractParser.java @@ -141,7 +141,7 @@ public abstract class ApiImportAbstractParser implements ApiImportParser { // } // } // if (!hasContentType) { -// headers.add(new KeyValue(key, value)); +// headers.save(new KeyValue(key, value)); // } // request.setHeaders(headers); // } diff --git a/backend/src/main/java/io/metersphere/api/parse/old/Swagger2Parser.java b/backend/src/main/java/io/metersphere/api/parse/old/Swagger2Parser.java index 5aaac94a95..c3048a8e41 100644 --- a/backend/src/main/java/io/metersphere/api/parse/old/Swagger2Parser.java +++ b/backend/src/main/java/io/metersphere/api/parse/old/Swagger2Parser.java @@ -26,7 +26,6 @@ import io.swagger.models.properties.Property; import io.swagger.models.properties.RefProperty; import io.swagger.parser.SwaggerParser; import org.apache.commons.lang3.StringUtils; -import org.apache.jorphan.collections.HashTree; import java.io.InputStream; import java.util.*; @@ -80,7 +79,7 @@ public class Swagger2Parser extends ApiImportAbstractParser { headerManager.setName(res.getName() + "Postman MsHeaderManager"); headerManager.setHeaders(res.getHeaders()); // HashTree tree = new HashTree(); -// tree.add(headerManager); +// tree.save(headerManager); LinkedList list = new LinkedList<>(); list.add(headerManager); requestElement.setHashTree(list); diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index 058977e68a..a4dcd19059 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -6,7 +6,6 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.gson.Gson; -import io.metersphere.api.dto.APIReportResult; import io.metersphere.api.dto.automation.*; import io.metersphere.api.dto.definition.RunDefinitionRequest; import io.metersphere.api.dto.definition.request.*; @@ -104,8 +103,8 @@ public class ApiAutomationService { public ApiScenario create(SaveApiScenarioRequest request, List bodyFiles) { request.setId(UUID.randomUUID().toString()); checkNameExist(request); - - final ApiScenario scenario = new ApiScenario(); + + final ApiScenarioWithBLOBs scenario = new ApiScenarioWithBLOBs(); scenario.setId(request.getId()); scenario.setName(request.getName()); scenario.setProjectId(request.getProjectId()); @@ -142,7 +141,7 @@ public class ApiAutomationService { List bodyUploadIds = request.getBodyUploadIds(); apiDefinitionService.createBodyFiles(bodyUploadIds, bodyFiles); - final ApiScenario scenario = new ApiScenario(); + final ApiScenarioWithBLOBs scenario = new ApiScenarioWithBLOBs(); scenario.setId(request.getId()); scenario.setName(request.getName()); scenario.setProjectId(request.getProjectId()); @@ -181,7 +180,7 @@ public class ApiAutomationService { public void reduction(List requests) { List apiIds = new ArrayList<>(); - requests.forEach(item->{ + requests.forEach(item -> { checkNameExist(item); apiIds.add(item.getId()); }); @@ -196,11 +195,11 @@ public class ApiAutomationService { } } - public ApiScenario getApiScenario(String id) { + public ApiScenarioWithBLOBs getApiScenario(String id) { return apiScenarioMapper.selectByPrimaryKey(id); } - public List getApiScenarios(List ids) { + public List getApiScenarios(List ids) { if (CollectionUtils.isNotEmpty(ids)) { return extApiScenarioMapper.selectIds(ids); } @@ -208,7 +207,7 @@ public class ApiAutomationService { } public void deleteTag(String id) { - List list = extApiScenarioMapper.selectByTagId(id); + List list = extApiScenarioMapper.selectByTagId(id); if (!list.isEmpty()) { Gson gs = new Gson(); list.forEach(item -> { @@ -220,17 +219,17 @@ public class ApiAutomationService { } } - private void createAPIReportResult(String id, String triggerMode) { - APIReportResult report = new APIReportResult(); + private void createAPIScenarioReportResult(String id, String triggerMode, String execType, String projectId) { + APIScenarioReportResult report = new APIScenarioReportResult(); report.setId(id); - report.setTestId(id); - report.setName(""); - report.setTriggerMode(null); + report.setName("测试执行结果"); report.setCreateTime(System.currentTimeMillis()); report.setUpdateTime(System.currentTimeMillis()); report.setStatus(APITestStatus.Running.name()); report.setUserId(SessionUtils.getUserId()); report.setTriggerMode(triggerMode); + report.setExecuteType(execType); + report.setProjectId(projectId); apiReportService.addResult(report); } @@ -242,11 +241,11 @@ public class ApiAutomationService { * @return */ public String run(RunScenarioRequest request) { - List apiScenarios = extApiScenarioMapper.selectIds(request.getScenarioIds()); + List apiScenarios = extApiScenarioMapper.selectIds(request.getScenarioIds()); MsTestPlan testPlan = new MsTestPlan(); testPlan.setHashTree(new LinkedList<>()); HashTree jmeterTestPlanHashTree = new ListedHashTree(); - for (ApiScenario item : apiScenarios) { + for (ApiScenarioWithBLOBs item : apiScenarios) { MsThreadGroup group = new MsThreadGroup(); group.setLabel(item.getName()); group.setName(item.getName()); @@ -280,7 +279,8 @@ public class ApiAutomationService { // 调用执行方法 jMeterService.runDefinition(request.getId(), jmeterTestPlanHashTree, request.getReportId(), ApiRunMode.SCENARIO.name()); - createAPIReportResult(request.getId(), request.getTriggerMode() == null ? ReportTriggerMode.MANUAL.name() : request.getTriggerMode()); + createAPIScenarioReportResult(request.getId(), request.getTriggerMode() == null ? ReportTriggerMode.MANUAL.name() : request.getTriggerMode(), + request.getExecuteType(), request.getProjectId()); return request.getId(); } @@ -305,7 +305,7 @@ public class ApiAutomationService { HashTree hashTree = request.getTestElement().generateHashTree(config); // 调用执行方法 jMeterService.runDefinition(request.getId(), hashTree, request.getReportId(), ApiRunMode.SCENARIO.name()); - createAPIReportResult(request.getId(), ReportTriggerMode.MANUAL.name()); + createAPIScenarioReportResult(request.getId(), ReportTriggerMode.MANUAL.name(), request.getExecuteType(), request.getProjectId()); return request.getId(); } @@ -371,10 +371,10 @@ public class ApiAutomationService { Date firstTime = startAndEndDateInWeek.get("firstTime"); Date lastTime = startAndEndDateInWeek.get("lastTime"); - if(firstTime==null || lastTime == null){ - return 0; - }else { - return extApiScenarioMapper.countByProjectIDAndCreatInThisWeek(projectId,firstTime.getTime(),lastTime.getTime()); + if (firstTime == null || lastTime == null) { + return 0; + } else { + return extApiScenarioMapper.countByProjectIDAndCreatInThisWeek(projectId, firstTime.getTime(), lastTime.getTime()); } } } diff --git a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java index e31fa63fd5..a2022b1029 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java @@ -2,10 +2,10 @@ package io.metersphere.api.service; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; -import io.metersphere.api.dto.APIReportResult; import io.metersphere.api.dto.DeleteAPIReportRequest; import io.metersphere.api.dto.QueryAPIReportRequest; import io.metersphere.api.dto.automation.APIScenarioReportResult; +import io.metersphere.api.dto.automation.ExecuteType; import io.metersphere.api.jmeter.TestResult; import io.metersphere.base.domain.*; import io.metersphere.base.mapper.ApiScenarioMapper; @@ -49,11 +49,12 @@ public class ApiScenarioReportService { if (obj == null) { MSException.throwException(Translator.get("api_report_is_null")); } - APIReportResult report = (APIReportResult) obj; + APIScenarioReportResult report = (APIScenarioReportResult) obj; // report detail - ApiTestReportDetail detail = new ApiTestReportDetail(); + ApiScenarioReportDetail detail = new ApiScenarioReportDetail(); detail.setReportId(result.getTestId()); - detail.setTestId(report.getTestId()); + detail.setProjectId(report.getProjectId()); + report.setTestId(result.getTestId()); detail.setContent(JSONObject.toJSONString(result).getBytes(StandardCharsets.UTF_8)); // report report.setUpdateTime(System.currentTimeMillis()); @@ -65,11 +66,8 @@ public class ApiScenarioReportService { } } report.setContent(new String(detail.getContent(), StandardCharsets.UTF_8)); - cache.put(report.getTestId(), report); - } - - public void addResult(APIReportResult res) { - cache.put(res.getTestId(), res); + this.save(report); + cache.put(report.getId(), report); } /** @@ -77,10 +75,10 @@ public class ApiScenarioReportService { * * @param testId */ - public APIReportResult getCacheResult(String testId) { + public APIScenarioReportResult getCacheResult(String testId) { Object res = cache.get(testId); if (res != null) { - APIReportResult reportResult = (APIReportResult) res; + APIScenarioReportResult reportResult = (APIScenarioReportResult) res; if (!reportResult.getStatus().equals(APITestStatus.Running.name())) { cache.remove(testId); } @@ -89,8 +87,13 @@ public class ApiScenarioReportService { return null; } - public APIReportResult get(String reportId) { - APIReportResult reportResult = extApiScenarioReportMapper.get(reportId); + + public void addResult(APIScenarioReportResult res) { + cache.put(res.getId(), res); + } + + public APIScenarioReportResult get(String reportId) { + APIScenarioReportResult reportResult = extApiScenarioReportMapper.get(reportId); ApiScenarioReportDetail detail = apiScenarioReportDetailMapper.selectByPrimaryKey(reportId); if (detail != null) { reportResult.setContent(new String(detail.getContent(), StandardCharsets.UTF_8)); @@ -105,7 +108,7 @@ public class ApiScenarioReportService { private void checkNameExist(APIScenarioReportResult request) { ApiScenarioReportExample example = new ApiScenarioReportExample(); - example.createCriteria().andNameEqualTo(request.getName()).andProjectIdEqualTo(request.getProjectId()).andIdNotEqualTo(request.getId()); + example.createCriteria().andNameEqualTo(request.getName()).andProjectIdEqualTo(request.getProjectId()).andExecuteTypeEqualTo(ExecuteType.Saved.name()).andIdNotEqualTo(request.getId()); if (apiScenarioReportMapper.countByExample(example) > 0) { MSException.throwException(Translator.get("load_test_already_exists")); } @@ -123,6 +126,7 @@ public class ApiScenarioReportService { report.setUpdateTime(System.currentTimeMillis()); report.setStatus(test.getStatus()); report.setUserId(test.getUserId()); + report.setExecuteType(test.getExecuteType()); apiScenarioReportMapper.insert(report); return report; } @@ -139,12 +143,13 @@ public class ApiScenarioReportService { report.setUpdateTime(System.currentTimeMillis()); report.setStatus(test.getStatus()); report.setUserId(test.getUserId()); + report.setExecuteType(test.getExecuteType()); apiScenarioReportMapper.updateByPrimaryKey(report); return report; } - public String add(APIScenarioReportResult test) { + public String save(APIScenarioReportResult test) { ApiScenarioReport report = createReport(test); ApiScenarioReportDetail detail = new ApiScenarioReportDetail(); TestResult result = JSON.parseObject(test.getContent(), TestResult.class); @@ -218,10 +223,10 @@ public class ApiScenarioReportService { Date firstTime = startAndEndDateInWeek.get("firstTime"); Date lastTime = startAndEndDateInWeek.get("lastTime"); - if(firstTime==null || lastTime == null){ - return 0; - }else { - return extApiScenarioReportMapper.countByProjectIDAndCreateInThisWeek(projectId,firstTime.getTime(),lastTime.getTime()); + if (firstTime == null || lastTime == null) { + return 0; + } else { + return extApiScenarioReportMapper.countByProjectIDAndCreateInThisWeek(projectId, firstTime.getTime(), lastTime.getTime()); } } } diff --git a/backend/src/main/java/io/metersphere/base/domain/ApiDefinition.java b/backend/src/main/java/io/metersphere/base/domain/ApiDefinition.java index 7fad6708c5..64a40d007e 100644 --- a/backend/src/main/java/io/metersphere/base/domain/ApiDefinition.java +++ b/backend/src/main/java/io/metersphere/base/domain/ApiDefinition.java @@ -1,8 +1,7 @@ package io.metersphere.base.domain; -import lombok.Data; - import java.io.Serializable; +import lombok.Data; @Data public class ApiDefinition implements Serializable { @@ -16,8 +15,6 @@ public class ApiDefinition implements Serializable { private String modulePath; - private String description; - private String environmentId; private String schedule; diff --git a/backend/src/main/java/io/metersphere/base/domain/ApiDefinitionExample.java b/backend/src/main/java/io/metersphere/base/domain/ApiDefinitionExample.java index fa6f5008ef..09c23da720 100644 --- a/backend/src/main/java/io/metersphere/base/domain/ApiDefinitionExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/ApiDefinitionExample.java @@ -454,76 +454,6 @@ public class ApiDefinitionExample { return (Criteria) this; } - public Criteria andDescriptionIsNull() { - addCriterion("description is null"); - return (Criteria) this; - } - - public Criteria andDescriptionIsNotNull() { - addCriterion("description is not null"); - return (Criteria) this; - } - - public Criteria andDescriptionEqualTo(String value) { - addCriterion("description =", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotEqualTo(String value) { - addCriterion("description <>", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionGreaterThan(String value) { - addCriterion("description >", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionGreaterThanOrEqualTo(String value) { - addCriterion("description >=", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionLessThan(String value) { - addCriterion("description <", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionLessThanOrEqualTo(String value) { - addCriterion("description <=", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionLike(String value) { - addCriterion("description like", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotLike(String value) { - addCriterion("description not like", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionIn(List values) { - addCriterion("description in", values, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotIn(List values) { - addCriterion("description not in", values, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionBetween(String value1, String value2) { - addCriterion("description between", value1, value2, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotBetween(String value1, String value2) { - addCriterion("description not between", value1, value2, "description"); - return (Criteria) this; - } - public Criteria andEnvironmentIdIsNull() { addCriterion("environment_id is null"); return (Criteria) this; diff --git a/backend/src/main/java/io/metersphere/base/domain/ApiDefinitionWithBLOBs.java b/backend/src/main/java/io/metersphere/base/domain/ApiDefinitionWithBLOBs.java index 4df5126099..2cf8975d43 100644 --- a/backend/src/main/java/io/metersphere/base/domain/ApiDefinitionWithBLOBs.java +++ b/backend/src/main/java/io/metersphere/base/domain/ApiDefinitionWithBLOBs.java @@ -9,6 +9,8 @@ import lombok.ToString; @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class ApiDefinitionWithBLOBs extends ApiDefinition implements Serializable { + private String description; + private String request; private String response; diff --git a/backend/src/main/java/io/metersphere/base/domain/ApiScenario.java b/backend/src/main/java/io/metersphere/base/domain/ApiScenario.java index 0ed46c37e2..61680351e2 100644 --- a/backend/src/main/java/io/metersphere/base/domain/ApiScenario.java +++ b/backend/src/main/java/io/metersphere/base/domain/ApiScenario.java @@ -31,8 +31,6 @@ public class ApiScenario implements Serializable { private String schedule; - private String description; - private Long createTime; private Long updateTime; @@ -43,7 +41,5 @@ public class ApiScenario implements Serializable { private String reportId; - private String scenarioDefinition; - private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/ApiScenarioExample.java b/backend/src/main/java/io/metersphere/base/domain/ApiScenarioExample.java index b1a2df8872..6d369644a3 100644 --- a/backend/src/main/java/io/metersphere/base/domain/ApiScenarioExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/ApiScenarioExample.java @@ -1004,76 +1004,6 @@ public class ApiScenarioExample { return (Criteria) this; } - public Criteria andDescriptionIsNull() { - addCriterion("description is null"); - return (Criteria) this; - } - - public Criteria andDescriptionIsNotNull() { - addCriterion("description is not null"); - return (Criteria) this; - } - - public Criteria andDescriptionEqualTo(String value) { - addCriterion("description =", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotEqualTo(String value) { - addCriterion("description <>", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionGreaterThan(String value) { - addCriterion("description >", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionGreaterThanOrEqualTo(String value) { - addCriterion("description >=", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionLessThan(String value) { - addCriterion("description <", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionLessThanOrEqualTo(String value) { - addCriterion("description <=", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionLike(String value) { - addCriterion("description like", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotLike(String value) { - addCriterion("description not like", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionIn(List values) { - addCriterion("description in", values, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotIn(List values) { - addCriterion("description not in", values, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionBetween(String value1, String value2) { - addCriterion("description between", value1, value2, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotBetween(String value1, String value2) { - addCriterion("description not between", value1, value2, "description"); - return (Criteria) this; - } - public Criteria andCreateTimeIsNull() { addCriterion("create_time is null"); return (Criteria) this; diff --git a/backend/src/main/java/io/metersphere/base/domain/ApiScenarioReport.java b/backend/src/main/java/io/metersphere/base/domain/ApiScenarioReport.java index 5c7a12abd6..70996bbc9f 100644 --- a/backend/src/main/java/io/metersphere/base/domain/ApiScenarioReport.java +++ b/backend/src/main/java/io/metersphere/base/domain/ApiScenarioReport.java @@ -1,8 +1,9 @@ package io.metersphere.base.domain; -import java.io.Serializable; import lombok.Data; +import java.io.Serializable; + @Data public class ApiScenarioReport implements Serializable { private String id; @@ -11,8 +12,6 @@ public class ApiScenarioReport implements Serializable { private String name; - private String description; - private Long createTime; private Long updateTime; @@ -23,5 +22,9 @@ public class ApiScenarioReport implements Serializable { private String triggerMode; + private String executeType; + + private String description; + private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/ApiScenarioReportExample.java b/backend/src/main/java/io/metersphere/base/domain/ApiScenarioReportExample.java index 843e0efac1..d09d4f4c19 100644 --- a/backend/src/main/java/io/metersphere/base/domain/ApiScenarioReportExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/ApiScenarioReportExample.java @@ -314,76 +314,6 @@ public class ApiScenarioReportExample { return (Criteria) this; } - public Criteria andDescriptionIsNull() { - addCriterion("description is null"); - return (Criteria) this; - } - - public Criteria andDescriptionIsNotNull() { - addCriterion("description is not null"); - return (Criteria) this; - } - - public Criteria andDescriptionEqualTo(String value) { - addCriterion("description =", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotEqualTo(String value) { - addCriterion("description <>", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionGreaterThan(String value) { - addCriterion("description >", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionGreaterThanOrEqualTo(String value) { - addCriterion("description >=", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionLessThan(String value) { - addCriterion("description <", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionLessThanOrEqualTo(String value) { - addCriterion("description <=", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionLike(String value) { - addCriterion("description like", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotLike(String value) { - addCriterion("description not like", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionIn(List values) { - addCriterion("description in", values, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotIn(List values) { - addCriterion("description not in", values, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionBetween(String value1, String value2) { - addCriterion("description between", value1, value2, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotBetween(String value1, String value2) { - addCriterion("description not between", value1, value2, "description"); - return (Criteria) this; - } - public Criteria andCreateTimeIsNull() { addCriterion("create_time is null"); return (Criteria) this; @@ -713,6 +643,76 @@ public class ApiScenarioReportExample { addCriterion("trigger_mode not between", value1, value2, "triggerMode"); return (Criteria) this; } + + public Criteria andExecuteTypeIsNull() { + addCriterion("execute_type is null"); + return (Criteria) this; + } + + public Criteria andExecuteTypeIsNotNull() { + addCriterion("execute_type is not null"); + return (Criteria) this; + } + + public Criteria andExecuteTypeEqualTo(String value) { + addCriterion("execute_type =", value, "executeType"); + return (Criteria) this; + } + + public Criteria andExecuteTypeNotEqualTo(String value) { + addCriterion("execute_type <>", value, "executeType"); + return (Criteria) this; + } + + public Criteria andExecuteTypeGreaterThan(String value) { + addCriterion("execute_type >", value, "executeType"); + return (Criteria) this; + } + + public Criteria andExecuteTypeGreaterThanOrEqualTo(String value) { + addCriterion("execute_type >=", value, "executeType"); + return (Criteria) this; + } + + public Criteria andExecuteTypeLessThan(String value) { + addCriterion("execute_type <", value, "executeType"); + return (Criteria) this; + } + + public Criteria andExecuteTypeLessThanOrEqualTo(String value) { + addCriterion("execute_type <=", value, "executeType"); + return (Criteria) this; + } + + public Criteria andExecuteTypeLike(String value) { + addCriterion("execute_type like", value, "executeType"); + return (Criteria) this; + } + + public Criteria andExecuteTypeNotLike(String value) { + addCriterion("execute_type not like", value, "executeType"); + return (Criteria) this; + } + + public Criteria andExecuteTypeIn(List values) { + addCriterion("execute_type in", values, "executeType"); + return (Criteria) this; + } + + public Criteria andExecuteTypeNotIn(List values) { + addCriterion("execute_type not in", values, "executeType"); + return (Criteria) this; + } + + public Criteria andExecuteTypeBetween(String value1, String value2) { + addCriterion("execute_type between", value1, value2, "executeType"); + return (Criteria) this; + } + + public Criteria andExecuteTypeNotBetween(String value1, String value2) { + addCriterion("execute_type not between", value1, value2, "executeType"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { diff --git a/backend/src/main/java/io/metersphere/base/domain/ApiScenarioWithBLOBs.java b/backend/src/main/java/io/metersphere/base/domain/ApiScenarioWithBLOBs.java new file mode 100644 index 0000000000..13c5a1533f --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/ApiScenarioWithBLOBs.java @@ -0,0 +1,17 @@ +package io.metersphere.base.domain; + +import java.io.Serializable; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ApiScenarioWithBLOBs extends ApiScenario implements Serializable { + private String scenarioDefinition; + + private String description; + + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/ApiTestCase.java b/backend/src/main/java/io/metersphere/base/domain/ApiTestCase.java index 1957508b83..67c9715a57 100644 --- a/backend/src/main/java/io/metersphere/base/domain/ApiTestCase.java +++ b/backend/src/main/java/io/metersphere/base/domain/ApiTestCase.java @@ -1,8 +1,7 @@ package io.metersphere.base.domain; -import lombok.Data; - import java.io.Serializable; +import lombok.Data; @Data public class ApiTestCase implements Serializable { @@ -16,8 +15,6 @@ public class ApiTestCase implements Serializable { private String apiDefinitionId; - private String description; - private String createUserId; private String updateUserId; diff --git a/backend/src/main/java/io/metersphere/base/domain/ApiTestCaseExample.java b/backend/src/main/java/io/metersphere/base/domain/ApiTestCaseExample.java index 4523cc9680..c8aebfb60c 100644 --- a/backend/src/main/java/io/metersphere/base/domain/ApiTestCaseExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/ApiTestCaseExample.java @@ -454,76 +454,6 @@ public class ApiTestCaseExample { return (Criteria) this; } - public Criteria andDescriptionIsNull() { - addCriterion("description is null"); - return (Criteria) this; - } - - public Criteria andDescriptionIsNotNull() { - addCriterion("description is not null"); - return (Criteria) this; - } - - public Criteria andDescriptionEqualTo(String value) { - addCriterion("description =", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotEqualTo(String value) { - addCriterion("description <>", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionGreaterThan(String value) { - addCriterion("description >", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionGreaterThanOrEqualTo(String value) { - addCriterion("description >=", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionLessThan(String value) { - addCriterion("description <", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionLessThanOrEqualTo(String value) { - addCriterion("description <=", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionLike(String value) { - addCriterion("description like", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotLike(String value) { - addCriterion("description not like", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionIn(List values) { - addCriterion("description in", values, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotIn(List values) { - addCriterion("description not in", values, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionBetween(String value1, String value2) { - addCriterion("description between", value1, value2, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotBetween(String value1, String value2) { - addCriterion("description not between", value1, value2, "description"); - return (Criteria) this; - } - public Criteria andCreateUserIdIsNull() { addCriterion("create_user_id is null"); return (Criteria) this; diff --git a/backend/src/main/java/io/metersphere/base/domain/ApiTestCaseWithBLOBs.java b/backend/src/main/java/io/metersphere/base/domain/ApiTestCaseWithBLOBs.java index 366a0a6a4b..04611f6d57 100644 --- a/backend/src/main/java/io/metersphere/base/domain/ApiTestCaseWithBLOBs.java +++ b/backend/src/main/java/io/metersphere/base/domain/ApiTestCaseWithBLOBs.java @@ -9,6 +9,8 @@ import lombok.ToString; @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class ApiTestCaseWithBLOBs extends ApiTestCase implements Serializable { + private String description; + private String request; private String response; diff --git a/backend/src/main/java/io/metersphere/base/mapper/ApiDefinitionMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ApiDefinitionMapper.java index 3d8114d198..ec5362093f 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ApiDefinitionMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ApiDefinitionMapper.java @@ -1,14 +1,10 @@ package io.metersphere.base.mapper; -import io.metersphere.api.dto.dataCount.ApiDataCountResult; -import io.metersphere.api.dto.dataCount.response.ApiDataCountDTO; import io.metersphere.base.domain.ApiDefinition; import io.metersphere.base.domain.ApiDefinitionExample; import io.metersphere.base.domain.ApiDefinitionWithBLOBs; -import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Select; - import java.util.List; +import org.apache.ibatis.annotations.Param; public interface ApiDefinitionMapper { long countByExample(ApiDefinitionExample example); @@ -38,5 +34,4 @@ public interface ApiDefinitionMapper { int updateByPrimaryKeyWithBLOBs(ApiDefinitionWithBLOBs record); int updateByPrimaryKey(ApiDefinition record); - } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ApiDefinitionMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ApiDefinitionMapper.xml index dc4d946fe7..b9581ed987 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ApiDefinitionMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ApiDefinitionMapper.xml @@ -7,7 +7,6 @@ - @@ -19,6 +18,7 @@ + @@ -81,11 +81,11 @@ - id, project_id, `name`, `method`, module_path, description, environment_id, schedule, - `status`, module_id, user_id, create_time, update_time, protocol, `path` + id, project_id, `name`, `method`, module_path, environment_id, schedule, `status`, + module_id, user_id, create_time, update_time, protocol, `path` - request, response + description, request, response select @@ -139,23 +139,25 @@ - + insert into api_scenario (id, project_id, tag_id, user_id, api_scenario_module_id, module_path, `name`, `level`, `status`, principal, step_total, follow_people, - schedule, description, create_time, - update_time, pass_rate, last_result, - report_id, scenario_definition) + schedule, create_time, update_time, + pass_rate, last_result, report_id, + scenario_definition, description + ) values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{tagId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{apiScenarioModuleId,jdbcType=VARCHAR}, #{modulePath,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{level,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{principal,jdbcType=VARCHAR}, #{stepTotal,jdbcType=INTEGER}, #{followPeople,jdbcType=VARCHAR}, - #{schedule,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, - #{updateTime,jdbcType=BIGINT}, #{passRate,jdbcType=VARCHAR}, #{lastResult,jdbcType=VARCHAR}, - #{reportId,jdbcType=VARCHAR}, #{scenarioDefinition,jdbcType=LONGVARCHAR}) + #{schedule,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, + #{passRate,jdbcType=VARCHAR}, #{lastResult,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR}, + #{scenarioDefinition,jdbcType=LONGVARCHAR}, #{description,jdbcType=LONGVARCHAR} + ) - + insert into api_scenario @@ -197,9 +199,6 @@ schedule, - - description, - create_time, @@ -218,6 +217,9 @@ scenario_definition, + + description, + @@ -259,9 +261,6 @@ #{schedule,jdbcType=VARCHAR}, - - #{description,jdbcType=VARCHAR}, - #{createTime,jdbcType=BIGINT}, @@ -280,6 +279,9 @@ #{scenarioDefinition,jdbcType=LONGVARCHAR}, + + #{description,jdbcType=LONGVARCHAR}, + + select + + distinct + + + , + + from api_scenario_report + + + + + order by ${orderByClause} + + - select + , + from api_scenario_report where id = #{id,jdbcType=VARCHAR} @@ -106,13 +130,13 @@ insert into api_scenario_report (id, project_id, `name`, - description, create_time, update_time, - `status`, user_id, trigger_mode - ) + create_time, update_time, `status`, + user_id, trigger_mode, execute_type, + description) values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, - #{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, - #{status,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{triggerMode,jdbcType=VARCHAR} - ) + #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{status,jdbcType=VARCHAR}, + #{userId,jdbcType=VARCHAR}, #{triggerMode,jdbcType=VARCHAR}, #{executeType,jdbcType=VARCHAR}, + #{description,jdbcType=LONGVARCHAR}) insert into api_scenario_report @@ -126,9 +150,6 @@ `name`, - - description, - create_time, @@ -144,6 +165,12 @@ trigger_mode, + + execute_type, + + + description, + @@ -155,9 +182,6 @@ #{name,jdbcType=VARCHAR}, - - #{description,jdbcType=VARCHAR}, - #{createTime,jdbcType=BIGINT}, @@ -173,6 +197,12 @@ #{triggerMode,jdbcType=VARCHAR}, + + #{executeType,jdbcType=VARCHAR}, + + + #{description,jdbcType=LONGVARCHAR}, + select @@ -132,14 +132,14 @@ insert into api_test_case (id, project_id, `name`, - priority, api_definition_id, description, - create_user_id, update_user_id, create_time, - update_time, request, response + priority, api_definition_id, create_user_id, + update_user_id, create_time, update_time, + description, request, response ) values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, - #{priority,jdbcType=VARCHAR}, #{apiDefinitionId,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, - #{createUserId,jdbcType=VARCHAR}, #{updateUserId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, - #{updateTime,jdbcType=BIGINT}, #{request,jdbcType=LONGVARCHAR}, #{response,jdbcType=LONGVARCHAR} + #{priority,jdbcType=VARCHAR}, #{apiDefinitionId,jdbcType=VARCHAR}, #{createUserId,jdbcType=VARCHAR}, + #{updateUserId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, + #{description,jdbcType=LONGVARCHAR}, #{request,jdbcType=LONGVARCHAR}, #{response,jdbcType=LONGVARCHAR} ) @@ -160,9 +160,6 @@ api_definition_id, - - description, - create_user_id, @@ -175,6 +172,9 @@ update_time, + + description, + request, @@ -198,9 +198,6 @@ #{apiDefinitionId,jdbcType=VARCHAR}, - - #{description,jdbcType=VARCHAR}, - #{createUserId,jdbcType=VARCHAR}, @@ -213,6 +210,9 @@ #{updateTime,jdbcType=BIGINT}, + + #{description,jdbcType=LONGVARCHAR}, + #{request,jdbcType=LONGVARCHAR}, @@ -245,9 +245,6 @@ api_definition_id = #{record.apiDefinitionId,jdbcType=VARCHAR}, - - description = #{record.description,jdbcType=VARCHAR}, - create_user_id = #{record.createUserId,jdbcType=VARCHAR}, @@ -260,6 +257,9 @@ update_time = #{record.updateTime,jdbcType=BIGINT}, + + description = #{record.description,jdbcType=LONGVARCHAR}, + request = #{record.request,jdbcType=LONGVARCHAR}, @@ -278,11 +278,11 @@ `name` = #{record.name,jdbcType=VARCHAR}, priority = #{record.priority,jdbcType=VARCHAR}, api_definition_id = #{record.apiDefinitionId,jdbcType=VARCHAR}, - description = #{record.description,jdbcType=VARCHAR}, create_user_id = #{record.createUserId,jdbcType=VARCHAR}, update_user_id = #{record.updateUserId,jdbcType=VARCHAR}, create_time = #{record.createTime,jdbcType=BIGINT}, update_time = #{record.updateTime,jdbcType=BIGINT}, + description = #{record.description,jdbcType=LONGVARCHAR}, request = #{record.request,jdbcType=LONGVARCHAR}, response = #{record.response,jdbcType=LONGVARCHAR} @@ -296,7 +296,6 @@ `name` = #{record.name,jdbcType=VARCHAR}, priority = #{record.priority,jdbcType=VARCHAR}, api_definition_id = #{record.apiDefinitionId,jdbcType=VARCHAR}, - description = #{record.description,jdbcType=VARCHAR}, create_user_id = #{record.createUserId,jdbcType=VARCHAR}, update_user_id = #{record.updateUserId,jdbcType=VARCHAR}, create_time = #{record.createTime,jdbcType=BIGINT}, @@ -320,9 +319,6 @@ api_definition_id = #{apiDefinitionId,jdbcType=VARCHAR}, - - description = #{description,jdbcType=VARCHAR}, - create_user_id = #{createUserId,jdbcType=VARCHAR}, @@ -335,6 +331,9 @@ update_time = #{updateTime,jdbcType=BIGINT}, + + description = #{description,jdbcType=LONGVARCHAR}, + request = #{request,jdbcType=LONGVARCHAR}, @@ -350,11 +349,11 @@ `name` = #{name,jdbcType=VARCHAR}, priority = #{priority,jdbcType=VARCHAR}, api_definition_id = #{apiDefinitionId,jdbcType=VARCHAR}, - description = #{description,jdbcType=VARCHAR}, create_user_id = #{createUserId,jdbcType=VARCHAR}, update_user_id = #{updateUserId,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT}, + description = #{description,jdbcType=LONGVARCHAR}, request = #{request,jdbcType=LONGVARCHAR}, response = #{response,jdbcType=LONGVARCHAR} where id = #{id,jdbcType=VARCHAR} @@ -365,7 +364,6 @@ `name` = #{name,jdbcType=VARCHAR}, priority = #{priority,jdbcType=VARCHAR}, api_definition_id = #{apiDefinitionId,jdbcType=VARCHAR}, - description = #{description,jdbcType=VARCHAR}, create_user_id = #{createUserId,jdbcType=VARCHAR}, update_user_id = #{updateUserId,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=BIGINT}, diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.java index f449472cc7..371a2b2196 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.java @@ -3,6 +3,7 @@ package io.metersphere.base.mapper.ext; import io.metersphere.api.dto.automation.ApiScenarioDTO; import io.metersphere.api.dto.automation.ApiScenarioRequest; import io.metersphere.base.domain.ApiScenario; +import io.metersphere.base.domain.ApiScenarioWithBLOBs; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; @@ -11,9 +12,9 @@ import java.util.List; public interface ExtApiScenarioMapper { List list(@Param("request") ApiScenarioRequest request); - List selectByTagId(@Param("id") String id); + List selectByTagId(@Param("id") String id); - List selectIds(@Param("ids") List ids); + List selectIds(@Param("ids") List ids); List selectReference(@Param("request") ApiScenarioRequest request); diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml index e7c638e10c..809cb89733 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml @@ -61,11 +61,11 @@ - select * from api_scenario where tag_id like CONCAT('%', #{id},'%') - select * from api_scenario where id in #{v} diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.java index 122fb7789f..d9d7581f2c 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.java @@ -1,6 +1,5 @@ package io.metersphere.base.mapper.ext; -import io.metersphere.api.dto.APIReportResult; import io.metersphere.api.dto.QueryAPIReportRequest; import io.metersphere.api.dto.automation.APIScenarioReportResult; import org.apache.ibatis.annotations.Param; @@ -11,7 +10,7 @@ import java.util.List; public interface ExtApiScenarioReportMapper { List list(@Param("request") QueryAPIReportRequest request); - APIReportResult get(@Param("reportId") String reportId); + APIScenarioReportResult get(@Param("reportId") String reportId); @Select("SELECT count(id) AS countNumber FROM api_scenario_report WHERE project_id = #{0} ") long countByProjectID(String projectId); diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.xml index e5349f836e..9a0a064a9b 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.xml @@ -145,7 +145,7 @@ - AND r.status != 'Debug' + AND r.execute_type = 'Saved' order by @@ -155,7 +155,7 @@ - SELECT r.*,r.id As testId, r.name AS test_name, project.name AS project_name, user.name AS user_name FROM api_scenario_report r LEFT JOIN project ON project.id = r.project_id diff --git a/backend/src/main/resources/db/migration/V53__modify_api_scenario.sql b/backend/src/main/resources/db/migration/V53__modify_api_scenario.sql new file mode 100644 index 0000000000..d783a7bea8 --- /dev/null +++ b/backend/src/main/resources/db/migration/V53__modify_api_scenario.sql @@ -0,0 +1,5 @@ +ALTER TABLE api_scenario_report ADD execute_type varchar(200) NULL; +ALTER TABLE api_definition MODIFY COLUMN description LONGTEXT NULL COMMENT 'Test description'; +ALTER TABLE api_test_case MODIFY COLUMN description LONGTEXT NULL COMMENT 'Test case description'; +ALTER TABLE api_scenario MODIFY COLUMN description LONGTEXT NULL COMMENT 'Api scenario description'; +ALTER TABLE api_scenario_report MODIFY COLUMN description LONGTEXT NULL COMMENT 'Api scenario report description'; \ No newline at end of file diff --git a/frontend/src/business/components/api/automation/report/ApiReportDetail.vue b/frontend/src/business/components/api/automation/report/ApiReportDetail.vue index 8f987d24be..80efadb5fb 100644 --- a/frontend/src/business/components/api/automation/report/ApiReportDetail.vue +++ b/frontend/src/business/components/api/automation/report/ApiReportDetail.vue @@ -103,6 +103,7 @@ if (this.isNotRunning) { try { this.content = JSON.parse(this.report.content); + this.$emit('refresh'); } catch (e) { throw e; } diff --git a/frontend/src/business/components/api/automation/report/components/RequestResult.vue b/frontend/src/business/components/api/automation/report/components/RequestResult.vue index 7c6c064e19..28efc6cbea 100644 --- a/frontend/src/business/components/api/automation/report/components/RequestResult.vue +++ b/frontend/src/business/components/api/automation/report/components/RequestResult.vue @@ -17,7 +17,7 @@ -
{{ request.responseResult.responseCode }}
+
{{ request.responseResult.responseCode }}
{{ request.responseResult.responseCode }}
diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue index af86b9bf19..1e1bea9afc 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue @@ -199,6 +199,7 @@ let scenarioIds = this.selection; run.id = getUUID(); run.scenarioIds = scenarioIds; + run.projectId = getCurrentProjectID(); this.$post(url, run, response => { let data = response.data; this.runVisible = true; @@ -233,6 +234,7 @@ let scenarioIds = []; scenarioIds.push(row.id); run.id = getUUID(); + run.projectId = getCurrentProjectID(); run.scenarioIds = scenarioIds; this.$post(url, run, response => { let data = response.data; diff --git a/frontend/src/business/components/api/automation/scenario/DebugRun.vue b/frontend/src/business/components/api/automation/scenario/DebugRun.vue index 39c711878f..3b4ba69e7b 100644 --- a/frontend/src/business/components/api/automation/scenario/DebugRun.vue +++ b/frontend/src/business/components/api/automation/scenario/DebugRun.vue @@ -2,7 +2,7 @@