refactor(接口自动化): 重构场景加入到测试计划方法
This commit is contained in:
parent
08dbb9f59a
commit
be6d3e9e66
|
@ -5,6 +5,7 @@ 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.DeleteAPIReportRequest;
|
||||
import io.metersphere.api.dto.automation.*;
|
||||
import io.metersphere.api.dto.datacount.ApiDataCountResult;
|
||||
import io.metersphere.api.dto.definition.RunDefinitionRequest;
|
||||
|
@ -14,6 +15,7 @@ import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
|
|||
import io.metersphere.api.jmeter.JMeterService;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.ApiScenarioMapper;
|
||||
import io.metersphere.base.mapper.ApiScenarioReportMapper;
|
||||
import io.metersphere.base.mapper.TestPlanApiScenarioMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtApiScenarioMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtTestPlanApiCaseMapper;
|
||||
|
@ -37,13 +39,13 @@ import org.apache.ibatis.session.SqlSession;
|
|||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
import org.apache.jorphan.collections.ListedHashTree;
|
||||
import org.python.antlr.ast.Str;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
@ -68,6 +70,8 @@ public class ApiAutomationService {
|
|||
private ExtTestPlanMapper extTestPlanMapper;
|
||||
@Resource
|
||||
SqlSessionFactory sqlSessionFactory;
|
||||
@Resource
|
||||
private ApiScenarioReportMapper apiScenarioReportMapper;
|
||||
|
||||
public List<ApiScenarioDTO> list(ApiScenarioRequest request) {
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
|
@ -157,6 +161,10 @@ public class ApiAutomationService {
|
|||
}
|
||||
|
||||
public void preDelete(String scenarioID) {
|
||||
ApiScenarioReportExample scenarioReportExample = new ApiScenarioReportExample();
|
||||
scenarioReportExample.createCriteria().andScenarioIdEqualTo(scenarioID);
|
||||
List<ApiScenarioReport> list = apiScenarioReportMapper.selectByExample(scenarioReportExample);
|
||||
deleteApiScenarioReport(list);
|
||||
scheduleService.deleteByResourceId(scenarioID);
|
||||
|
||||
TestPlanApiScenarioExample example = new TestPlanApiScenarioExample();
|
||||
|
@ -177,9 +185,21 @@ public class ApiAutomationService {
|
|||
|
||||
}
|
||||
|
||||
public void preDelete(List<String> scenarioIDList) {
|
||||
private void deleteApiScenarioReport(List<ApiScenarioReport> list) {
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
List<String> ids = list.stream().map(ApiScenarioReport::getId).collect(Collectors.toList());
|
||||
DeleteAPIReportRequest reportRequest = new DeleteAPIReportRequest();
|
||||
reportRequest.setIds(ids);
|
||||
apiReportService.deleteAPIReportBatch(reportRequest);
|
||||
}
|
||||
}
|
||||
|
||||
public void preDeleteBatch(List<String> scenarioIDList) {
|
||||
ApiScenarioReportExample scenarioReportExample = new ApiScenarioReportExample();
|
||||
scenarioReportExample.createCriteria().andScenarioIdIn(scenarioIDList);
|
||||
List<ApiScenarioReport> list = apiScenarioReportMapper.selectByExample(scenarioReportExample);
|
||||
deleteApiScenarioReport(list);
|
||||
List<String> testPlanApiScenarioIdList = new ArrayList<>();
|
||||
List<String> scheduleIdList = new ArrayList<>();
|
||||
for (String id : scenarioIDList) {
|
||||
TestPlanApiScenarioExample example = new TestPlanApiScenarioExample();
|
||||
example.createCriteria().andApiScenarioIdEqualTo(id);
|
||||
|
@ -201,9 +221,8 @@ public class ApiAutomationService {
|
|||
}
|
||||
|
||||
public void deleteBatch(List<String> ids) {
|
||||
//及连删除外键表
|
||||
preDelete(ids);
|
||||
;
|
||||
// 删除外键表
|
||||
preDeleteBatch(ids);
|
||||
ApiScenarioExample example = new ApiScenarioExample();
|
||||
example.createCriteria().andIdIn(ids);
|
||||
apiScenarioMapper.deleteByExample(example);
|
||||
|
@ -388,40 +407,7 @@ public class ApiAutomationService {
|
|||
apiCaseBatchMapper.insertIfNotExists(testPlanApiCase);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// testPlan的ID先不存储
|
||||
// list.forEach(item -> {
|
||||
// if (CollectionUtils.isNotEmpty(request.getApiIds())) {
|
||||
// if (CollectionUtils.isNotEmpty(request.getApiIds())) {
|
||||
// if (StringUtils.isEmpty(item.getApiIds())) {
|
||||
// item.setApiIds(JSON.toJSONString(request.getApiIds()));
|
||||
// } else {
|
||||
// // 合并api
|
||||
// List<String> dbApiIDs = JSON.parseArray(item.getApiIds(), String.class);
|
||||
// List<String> result = Stream.of(request.getApiIds(), dbApiIDs)
|
||||
// .flatMap(Collection::stream).distinct().collect(Collectors.toList());
|
||||
// item.setApiIds(JSON.toJSONString(result));
|
||||
// }
|
||||
// item.setScenarioIds(null);
|
||||
// }
|
||||
// }
|
||||
// if (CollectionUtils.isNotEmpty(request.getScenarioIds())) {
|
||||
// if (CollectionUtils.isNotEmpty(request.getScenarioIds())) {
|
||||
// if (StringUtils.isEmpty(item.getScenarioIds())) {
|
||||
// item.setScenarioIds(JSON.toJSONString(request.getScenarioIds()));
|
||||
// } else {
|
||||
// // 合并场景ID
|
||||
// List<String> dbScenarioIDs = JSON.parseArray(item.getScenarioIds(), String.class);
|
||||
// List<String> result = Stream.of(request.getScenarioIds(), dbScenarioIDs)
|
||||
// .flatMap(Collection::stream).distinct().collect(Collectors.toList());
|
||||
// item.setScenarioIds(JSON.toJSONString(result));
|
||||
// }
|
||||
// item.setApiIds(null);
|
||||
// }
|
||||
// }
|
||||
// mapper.updatePlan(item);
|
||||
// });
|
||||
sqlSession.flushStatements();
|
||||
return "success";
|
||||
}
|
||||
|
@ -432,10 +418,8 @@ public class ApiAutomationService {
|
|||
|
||||
public long countScenarioByProjectIDAndCreatInThisWeek(String projectId) {
|
||||
Map<String, Date> startAndEndDateInWeek = DateUtils.getWeedFirstTimeAndLastTime(new Date());
|
||||
|
||||
Date firstTime = startAndEndDateInWeek.get("firstTime");
|
||||
Date lastTime = startAndEndDateInWeek.get("lastTime");
|
||||
|
||||
if (firstTime == null || lastTime == null) {
|
||||
return 0;
|
||||
} else {
|
||||
|
|
|
@ -204,8 +204,7 @@ public class ApiScenarioReportService {
|
|||
}
|
||||
|
||||
public void updatePlanCase(TestResult result, APIScenarioReportResult test) {
|
||||
TestPlanApiScenario testPlanApiScenario = new TestPlanApiScenario();
|
||||
testPlanApiScenario.setId(test.getId());
|
||||
TestPlanApiScenario testPlanApiScenario = testPlanApiScenarioMapper.selectByPrimaryKey(test.getId());
|
||||
ScenarioResult scenarioResult = result.getScenarios().get(0);
|
||||
if (scenarioResult.getError() > 0) {
|
||||
testPlanApiScenario.setLastResult("Fail");
|
||||
|
@ -214,7 +213,6 @@ public class ApiScenarioReportService {
|
|||
}
|
||||
String passRate = new DecimalFormat("0%").format((float) scenarioResult.getSuccess() / (scenarioResult.getSuccess() + scenarioResult.getError()));
|
||||
testPlanApiScenario.setPassRate(passRate);
|
||||
|
||||
// 存储场景报告
|
||||
ApiScenarioReport report = createReport(test, scenarioResult.getName(), testPlanApiScenario.getApiScenarioId(), scenarioResult.getError() == 0 ? "Success" : "Error");
|
||||
// 报告详情内容
|
||||
|
|
|
@ -105,7 +105,6 @@ public class ApiTestCaseService {
|
|||
public void update(SaveApiTestCaseRequest request, List<MultipartFile> bodyFiles) {
|
||||
|
||||
deleteFileByTestId(request.getId());
|
||||
|
||||
List<String> bodyUploadIds = new ArrayList<>(request.getBodyUploadIds());
|
||||
request.setBodyUploadIds(null);
|
||||
ApiTestCase test = updateTest(request);
|
||||
|
@ -134,12 +133,9 @@ public class ApiTestCaseService {
|
|||
}
|
||||
|
||||
public void delete(String testId) {
|
||||
|
||||
extTestPlanTestCaseMapper.deleteByTestCaseID(testId);
|
||||
|
||||
deleteFileByTestId(testId);
|
||||
extApiDefinitionExecResultMapper.deleteByResourceId(testId);
|
||||
|
||||
apiTestCaseMapper.deleteByPrimaryKey(testId);
|
||||
deleteBodyFiles(testId);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class TestPlan implements Serializable {
|
||||
private String id;
|
||||
|
@ -39,10 +40,6 @@ public class TestPlan implements Serializable {
|
|||
|
||||
private String creator;
|
||||
|
||||
private String apiIds;
|
||||
|
||||
private String scenarioIds;
|
||||
|
||||
private String tags;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
@ -1233,146 +1233,6 @@ public class TestPlanExample {
|
|||
addCriterion("creator not between", value1, value2, "creator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdsIsNull() {
|
||||
addCriterion("api_ids is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdsIsNotNull() {
|
||||
addCriterion("api_ids is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdsEqualTo(String value) {
|
||||
addCriterion("api_ids =", value, "apiIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdsNotEqualTo(String value) {
|
||||
addCriterion("api_ids <>", value, "apiIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdsGreaterThan(String value) {
|
||||
addCriterion("api_ids >", value, "apiIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdsGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("api_ids >=", value, "apiIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdsLessThan(String value) {
|
||||
addCriterion("api_ids <", value, "apiIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdsLessThanOrEqualTo(String value) {
|
||||
addCriterion("api_ids <=", value, "apiIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdsLike(String value) {
|
||||
addCriterion("api_ids like", value, "apiIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdsNotLike(String value) {
|
||||
addCriterion("api_ids not like", value, "apiIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdsIn(List<String> values) {
|
||||
addCriterion("api_ids in", values, "apiIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdsNotIn(List<String> values) {
|
||||
addCriterion("api_ids not in", values, "apiIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdsBetween(String value1, String value2) {
|
||||
addCriterion("api_ids between", value1, value2, "apiIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdsNotBetween(String value1, String value2) {
|
||||
addCriterion("api_ids not between", value1, value2, "apiIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioIdsIsNull() {
|
||||
addCriterion("scenario_ids is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioIdsIsNotNull() {
|
||||
addCriterion("scenario_ids is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioIdsEqualTo(String value) {
|
||||
addCriterion("scenario_ids =", value, "scenarioIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioIdsNotEqualTo(String value) {
|
||||
addCriterion("scenario_ids <>", value, "scenarioIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioIdsGreaterThan(String value) {
|
||||
addCriterion("scenario_ids >", value, "scenarioIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioIdsGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("scenario_ids >=", value, "scenarioIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioIdsLessThan(String value) {
|
||||
addCriterion("scenario_ids <", value, "scenarioIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioIdsLessThanOrEqualTo(String value) {
|
||||
addCriterion("scenario_ids <=", value, "scenarioIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioIdsLike(String value) {
|
||||
addCriterion("scenario_ids like", value, "scenarioIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioIdsNotLike(String value) {
|
||||
addCriterion("scenario_ids not like", value, "scenarioIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioIdsIn(List<String> values) {
|
||||
addCriterion("scenario_ids in", values, "scenarioIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioIdsNotIn(List<String> values) {
|
||||
addCriterion("scenario_ids not in", values, "scenarioIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioIdsBetween(String value1, String value2) {
|
||||
addCriterion("scenario_ids between", value1, value2, "scenarioIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioIdsNotBetween(String value1, String value2) {
|
||||
addCriterion("scenario_ids not between", value1, value2, "scenarioIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
<result column="planned_end_time" jdbcType="BIGINT" property="plannedEndTime" />
|
||||
<result column="actual_start_time" jdbcType="BIGINT" property="actualStartTime" />
|
||||
<result column="creator" jdbcType="VARCHAR" property="creator" />
|
||||
<result column="api_ids" jdbcType="VARCHAR" property="apiIds" />
|
||||
<result column="scenario_ids" jdbcType="VARCHAR" property="scenarioIds" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestPlan">
|
||||
<result column="tags" jdbcType="LONGVARCHAR" property="tags" />
|
||||
|
@ -86,7 +84,7 @@
|
|||
<sql id="Base_Column_List">
|
||||
id, workspace_id, report_id, `name`, description, `status`, stage, principal, test_case_match_rule,
|
||||
executor_match_rule, create_time, update_time, actual_end_time, planned_start_time,
|
||||
planned_end_time, actual_start_time, creator, api_ids, scenario_ids
|
||||
planned_end_time, actual_start_time, creator
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
tags
|
||||
|
@ -145,15 +143,15 @@
|
|||
stage, principal, test_case_match_rule,
|
||||
executor_match_rule, create_time, update_time,
|
||||
actual_end_time, planned_start_time, planned_end_time,
|
||||
actual_start_time, creator, api_ids,
|
||||
scenario_ids, tags)
|
||||
actual_start_time, creator, tags
|
||||
)
|
||||
values (#{id,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR},
|
||||
#{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
|
||||
#{stage,jdbcType=VARCHAR}, #{principal,jdbcType=VARCHAR}, #{testCaseMatchRule,jdbcType=VARCHAR},
|
||||
#{executorMatchRule,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||
#{actualEndTime,jdbcType=BIGINT}, #{plannedStartTime,jdbcType=BIGINT}, #{plannedEndTime,jdbcType=BIGINT},
|
||||
#{actualStartTime,jdbcType=BIGINT}, #{creator,jdbcType=VARCHAR}, #{apiIds,jdbcType=VARCHAR},
|
||||
#{scenarioIds,jdbcType=VARCHAR}, #{tags,jdbcType=LONGVARCHAR})
|
||||
#{actualStartTime,jdbcType=BIGINT}, #{creator,jdbcType=VARCHAR}, #{tags,jdbcType=LONGVARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlan">
|
||||
insert into test_plan
|
||||
|
@ -209,12 +207,6 @@
|
|||
<if test="creator != null">
|
||||
creator,
|
||||
</if>
|
||||
<if test="apiIds != null">
|
||||
api_ids,
|
||||
</if>
|
||||
<if test="scenarioIds != null">
|
||||
scenario_ids,
|
||||
</if>
|
||||
<if test="tags != null">
|
||||
tags,
|
||||
</if>
|
||||
|
@ -271,12 +263,6 @@
|
|||
<if test="creator != null">
|
||||
#{creator,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="apiIds != null">
|
||||
#{apiIds,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="scenarioIds != null">
|
||||
#{scenarioIds,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="tags != null">
|
||||
#{tags,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -342,12 +328,6 @@
|
|||
<if test="record.creator != null">
|
||||
creator = #{record.creator,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.apiIds != null">
|
||||
api_ids = #{record.apiIds,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.scenarioIds != null">
|
||||
scenario_ids = #{record.scenarioIds,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.tags != null">
|
||||
tags = #{record.tags,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -375,8 +355,6 @@
|
|||
planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
|
||||
actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
|
||||
creator = #{record.creator,jdbcType=VARCHAR},
|
||||
api_ids = #{record.apiIds,jdbcType=VARCHAR},
|
||||
scenario_ids = #{record.scenarioIds,jdbcType=VARCHAR},
|
||||
tags = #{record.tags,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
|
@ -400,9 +378,7 @@
|
|||
planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
|
||||
planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
|
||||
actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
|
||||
creator = #{record.creator,jdbcType=VARCHAR},
|
||||
api_ids = #{record.apiIds,jdbcType=VARCHAR},
|
||||
scenario_ids = #{record.scenarioIds,jdbcType=VARCHAR}
|
||||
creator = #{record.creator,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -458,12 +434,6 @@
|
|||
<if test="creator != null">
|
||||
creator = #{creator,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="apiIds != null">
|
||||
api_ids = #{apiIds,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="scenarioIds != null">
|
||||
scenario_ids = #{scenarioIds,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="tags != null">
|
||||
tags = #{tags,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -488,8 +458,6 @@
|
|||
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
|
||||
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
|
||||
creator = #{creator,jdbcType=VARCHAR},
|
||||
api_ids = #{apiIds,jdbcType=VARCHAR},
|
||||
scenario_ids = #{scenarioIds,jdbcType=VARCHAR},
|
||||
tags = #{tags,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
@ -510,9 +478,7 @@
|
|||
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
|
||||
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
|
||||
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
|
||||
creator = #{creator,jdbcType=VARCHAR},
|
||||
api_ids = #{apiIds,jdbcType=VARCHAR},
|
||||
scenario_ids = #{scenarioIds,jdbcType=VARCHAR}
|
||||
creator = #{creator,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -100,7 +100,7 @@
|
|||
|
||||
<select id="list" resultMap="BaseResultMap">
|
||||
SELECT r.name AS test_name,
|
||||
r.name, r.description, r.id, r.project_id, r.create_time, r.update_time, r.status, r.trigger_mode,
|
||||
r.name, r.description, r.id, r.project_id, r.create_time, r.update_time, r.status, r.trigger_mode,r.scenario_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
|
||||
|
|
|
@ -17,12 +17,9 @@ public interface ExtTestPlanMapper {
|
|||
|
||||
List<TestPlanDTO> selectByIds(@Param("list") List<String> ids);
|
||||
|
||||
int updatePlan(@Param("plan") TestPlanDTO plan);
|
||||
|
||||
List<TestPlanDTO> selectReference(@Param("request") QueryTestPlanRequest params);
|
||||
|
||||
/**
|
||||
* 通过关联表(test_plan_api_case/test_plan_api_scenario)查询testPlan
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
|
|
|
@ -182,21 +182,6 @@
|
|||
order by test_plan.update_time desc
|
||||
</select>
|
||||
|
||||
<update id="updatePlan" parameterType="io.metersphere.track.dto.TestPlanDTO">
|
||||
update test_plan
|
||||
<set>
|
||||
<if test="plan.apiIds != null">
|
||||
api_ids = #{plan.apiIds,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="plan.scenarioIds != null">
|
||||
scenario_ids = #{plan.scenarioIds,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</set>
|
||||
<where>
|
||||
id = #{plan.id}
|
||||
</where>
|
||||
</update>
|
||||
|
||||
<select id="selectByIds" resultMap="BaseResultMap" parameterType="java.util.List">
|
||||
SELECT * FROM TEST_PLAN p where p.id in
|
||||
<foreach collection="list" item="planId" open="(" close=")" separator=",">
|
||||
|
@ -204,18 +189,6 @@
|
|||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectReference" resultMap="BaseResultMap" parameterType="io.metersphere.track.request.testcase.QueryTestPlanRequest">
|
||||
SELECT * FROM TEST_PLAN p LEFT JOIN test_plan_project t ON t.test_plan_id=p.id
|
||||
<where>
|
||||
<if test="request.scenarioId != null">
|
||||
AND p.scenario_ids like CONCAT('%', #{request.scenarioId},'%')
|
||||
</if>
|
||||
<if test="request.apiId != null">
|
||||
AND p.api_ids like CONCAT('%', #{request.apiId},'%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="checkIsHave" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM test_plan_project, project
|
||||
|
|
|
@ -55,7 +55,7 @@ public class ApiScenarioTestJob extends MsScheduleJob {
|
|||
request.setReportId(id);
|
||||
request.setProjectId(projectID);
|
||||
request.setTriggerMode(ReportTriggerMode.SCHEDULE.name());
|
||||
request.setExecuteType(ExecuteType.Completed.name());
|
||||
request.setExecuteType(ExecuteType.Saved.name());
|
||||
request.setScenarioIds(this.scenarioIds);
|
||||
request.setReportUserID(this.userId);
|
||||
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
ALTER TABLE api_scenario_report ADD scenario_name varchar(255) NULL;
|
||||
ALTER TABLE api_scenario_report ADD scenario_id varchar(100) NULL;
|
||||
ALTER TABLE api_scenario_report ADD scenario_id varchar(100) NULL;
|
||||
ALTER TABLE test_plan DROP COLUMN api_ids;
|
||||
ALTER TABLE test_plan DROP COLUMN scenario_ids;
|
||||
|
|
|
@ -20,10 +20,8 @@
|
|||
</el-table-column>
|
||||
<el-table-column :label="$t('commons.name')" width="200" show-overflow-tooltip prop="name">
|
||||
</el-table-column>
|
||||
<!--
|
||||
<el-table-column prop="testName" :label="$t('api_report.test_name')" width="200" show-overflow-tooltip/>
|
||||
-->
|
||||
<el-table-column prop="projectName" :label="$t('load_test.project_name')" width="150" show-overflow-tooltip/>
|
||||
|
||||
<el-table-column prop="scenarioName" :label="$t('api_test.automation.scenario_name')" width="150" show-overflow-tooltip/>
|
||||
<el-table-column prop="userName" :label="$t('api_test.creator')" width="150" show-overflow-tooltip/>
|
||||
<el-table-column prop="createTime" width="250" :label="$t('commons.create_time')" sortable>
|
||||
<template v-slot:default="scope">
|
||||
|
@ -69,7 +67,7 @@
|
|||
import MsContainer from "../../../common/components/MsContainer";
|
||||
import MsMainContainer from "../../../common/components/MsMainContainer";
|
||||
import MsApiReportStatus from "./ApiReportStatus";
|
||||
import {_filter, _sort,getCurrentProjectID} from "@/common/js/utils";
|
||||
import {_filter, _sort, getCurrentProjectID} from "@/common/js/utils";
|
||||
import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton";
|
||||
import ReportTriggerModeItem from "../../../common/tableItem/ReportTriggerModeItem";
|
||||
import {REPORT_CONFIGS} from "../../../common/components/search/search-components";
|
||||
|
|
Loading…
Reference in New Issue