创建用例绑定测试
This commit is contained in:
parent
48eafa2be0
commit
bceade43a9
|
@ -7,7 +7,9 @@ import io.metersphere.api.dto.DeleteAPITestRequest;
|
|||
import io.metersphere.api.dto.QueryAPITestRequest;
|
||||
import io.metersphere.api.dto.SaveAPITestRequest;
|
||||
import io.metersphere.api.service.APITestService;
|
||||
import io.metersphere.base.domain.ApiTest;
|
||||
import io.metersphere.base.domain.ApiTestWithBLOBs;
|
||||
import io.metersphere.base.domain.LoadTest;
|
||||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
|
@ -44,6 +46,11 @@ public class APITestController {
|
|||
return PageUtils.setPageInfo(page, apiTestService.list(request));
|
||||
}
|
||||
|
||||
@GetMapping("/list/{projectId}")
|
||||
public List<ApiTest> list(@PathVariable String projectId) {
|
||||
return apiTestService.getApiTestByProjectId(projectId);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/create", consumes = {"multipart/form-data"})
|
||||
public void create(@RequestPart("request") SaveAPITestRequest request, @RequestPart(value = "files") List<MultipartFile> files) {
|
||||
apiTestService.create(request, files);
|
||||
|
|
|
@ -167,4 +167,7 @@ public class APITestService {
|
|||
}
|
||||
}
|
||||
|
||||
public List<ApiTest> getApiTestByProjectId(String projectId) {
|
||||
return extApiTestMapper.getApiTestByProjectId(projectId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,5 +29,7 @@ public class TestCase implements Serializable {
|
|||
|
||||
private Long updateTime;
|
||||
|
||||
private String testId;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -923,6 +923,76 @@ public class TestCaseExample {
|
|||
addCriterion("update_time not between", value1, value2, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestIdIsNull() {
|
||||
addCriterion("test_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestIdIsNotNull() {
|
||||
addCriterion("test_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestIdEqualTo(String value) {
|
||||
addCriterion("test_id =", value, "testId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestIdNotEqualTo(String value) {
|
||||
addCriterion("test_id <>", value, "testId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestIdGreaterThan(String value) {
|
||||
addCriterion("test_id >", value, "testId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("test_id >=", value, "testId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestIdLessThan(String value) {
|
||||
addCriterion("test_id <", value, "testId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("test_id <=", value, "testId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestIdLike(String value) {
|
||||
addCriterion("test_id like", value, "testId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestIdNotLike(String value) {
|
||||
addCriterion("test_id not like", value, "testId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestIdIn(List<String> values) {
|
||||
addCriterion("test_id in", values, "testId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestIdNotIn(List<String> values) {
|
||||
addCriterion("test_id not in", values, "testId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestIdBetween(String value1, String value2) {
|
||||
addCriterion("test_id between", value1, value2, "testId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTestIdNotBetween(String value1, String value2) {
|
||||
addCriterion("test_id not between", value1, value2, "testId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
|
|
@ -21,5 +21,7 @@ public class TestPlanTestCase implements Serializable {
|
|||
|
||||
private Long updateTime;
|
||||
|
||||
private String reportId;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -643,6 +643,76 @@ public class TestPlanTestCaseExample {
|
|||
addCriterion("update_time not between", value1, value2, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdIsNull() {
|
||||
addCriterion("report_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdIsNotNull() {
|
||||
addCriterion("report_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdEqualTo(String value) {
|
||||
addCriterion("report_id =", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdNotEqualTo(String value) {
|
||||
addCriterion("report_id <>", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdGreaterThan(String value) {
|
||||
addCriterion("report_id >", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("report_id >=", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdLessThan(String value) {
|
||||
addCriterion("report_id <", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("report_id <=", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdLike(String value) {
|
||||
addCriterion("report_id like", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdNotLike(String value) {
|
||||
addCriterion("report_id not like", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdIn(List<String> values) {
|
||||
addCriterion("report_id in", values, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdNotIn(List<String> values) {
|
||||
addCriterion("report_id not in", values, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdBetween(String value1, String value2) {
|
||||
addCriterion("report_id between", value1, value2, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdNotBetween(String value1, String value2) {
|
||||
addCriterion("report_id not between", value1, value2, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<result column="prerequisite" jdbcType="VARCHAR" property="prerequisite" />
|
||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||
<result column="test_id" jdbcType="VARCHAR" property="testId" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestCaseWithBLOBs">
|
||||
<result column="remark" jdbcType="LONGVARCHAR" property="remark" />
|
||||
|
@ -79,7 +80,7 @@
|
|||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, node_id, node_path, project_id, name, type, maintainer, priority, method, prerequisite,
|
||||
create_time, update_time
|
||||
create_time, update_time, test_id
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
remark, steps
|
||||
|
@ -137,12 +138,14 @@
|
|||
project_id, name, type,
|
||||
maintainer, priority, method,
|
||||
prerequisite, create_time, update_time,
|
||||
remark, steps)
|
||||
test_id, remark, steps
|
||||
)
|
||||
values (#{id,jdbcType=VARCHAR}, #{nodeId,jdbcType=VARCHAR}, #{nodePath,jdbcType=VARCHAR},
|
||||
#{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
|
||||
#{maintainer,jdbcType=VARCHAR}, #{priority,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR},
|
||||
#{prerequisite,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||
#{remark,jdbcType=LONGVARCHAR}, #{steps,jdbcType=LONGVARCHAR})
|
||||
#{testId,jdbcType=VARCHAR}, #{remark,jdbcType=LONGVARCHAR}, #{steps,jdbcType=LONGVARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseWithBLOBs">
|
||||
insert into test_case
|
||||
|
@ -183,6 +186,9 @@
|
|||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="testId != null">
|
||||
test_id,
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
remark,
|
||||
</if>
|
||||
|
@ -227,6 +233,9 @@
|
|||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="testId != null">
|
||||
#{testId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
#{remark,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -280,6 +289,9 @@
|
|||
<if test="record.updateTime != null">
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.testId != null">
|
||||
test_id = #{record.testId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.remark != null">
|
||||
remark = #{record.remark,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -305,6 +317,7 @@
|
|||
prerequisite = #{record.prerequisite,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
test_id = #{record.testId,jdbcType=VARCHAR},
|
||||
remark = #{record.remark,jdbcType=LONGVARCHAR},
|
||||
steps = #{record.steps,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null">
|
||||
|
@ -324,7 +337,8 @@
|
|||
method = #{record.method,jdbcType=VARCHAR},
|
||||
prerequisite = #{record.prerequisite,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT}
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
test_id = #{record.testId,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -365,6 +379,9 @@
|
|||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="testId != null">
|
||||
test_id = #{testId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
remark = #{remark,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -387,6 +404,7 @@
|
|||
prerequisite = #{prerequisite,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
test_id = #{testId,jdbcType=VARCHAR},
|
||||
remark = #{remark,jdbcType=LONGVARCHAR},
|
||||
steps = #{steps,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
|
@ -403,7 +421,8 @@
|
|||
method = #{method,jdbcType=VARCHAR},
|
||||
prerequisite = #{prerequisite,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT}
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
test_id = #{testId,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -10,6 +10,7 @@
|
|||
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||
<result column="report_id" jdbcType="VARCHAR" property="reportId" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestPlanTestCaseWithBLOBs">
|
||||
<result column="results" jdbcType="LONGVARCHAR" property="results" />
|
||||
|
@ -74,7 +75,7 @@
|
|||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, plan_id, case_id, executor, status, remark, create_time, update_time
|
||||
id, plan_id, case_id, executor, status, remark, create_time, update_time, report_id
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
results, issues
|
||||
|
@ -130,12 +131,12 @@
|
|||
<insert id="insert" parameterType="io.metersphere.base.domain.TestPlanTestCaseWithBLOBs">
|
||||
insert into test_plan_test_case (id, plan_id, case_id,
|
||||
executor, status, remark,
|
||||
create_time, update_time, results,
|
||||
issues)
|
||||
create_time, update_time, report_id,
|
||||
results, issues)
|
||||
values (#{id,jdbcType=VARCHAR}, #{planId,jdbcType=VARCHAR}, #{caseId,jdbcType=VARCHAR},
|
||||
#{executor,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{results,jdbcType=LONGVARCHAR},
|
||||
#{issues,jdbcType=LONGVARCHAR})
|
||||
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{reportId,jdbcType=VARCHAR},
|
||||
#{results,jdbcType=LONGVARCHAR}, #{issues,jdbcType=LONGVARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlanTestCaseWithBLOBs">
|
||||
insert into test_plan_test_case
|
||||
|
@ -164,6 +165,9 @@
|
|||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="reportId != null">
|
||||
report_id,
|
||||
</if>
|
||||
<if test="results != null">
|
||||
results,
|
||||
</if>
|
||||
|
@ -196,6 +200,9 @@
|
|||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="reportId != null">
|
||||
#{reportId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="results != null">
|
||||
#{results,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -237,6 +244,9 @@
|
|||
<if test="record.updateTime != null">
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.reportId != null">
|
||||
report_id = #{record.reportId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.results != null">
|
||||
results = #{record.results,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -258,6 +268,7 @@
|
|||
remark = #{record.remark,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
report_id = #{record.reportId,jdbcType=VARCHAR},
|
||||
results = #{record.results,jdbcType=LONGVARCHAR},
|
||||
issues = #{record.issues,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null">
|
||||
|
@ -273,7 +284,8 @@
|
|||
status = #{record.status,jdbcType=VARCHAR},
|
||||
remark = #{record.remark,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT}
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
report_id = #{record.reportId,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -302,6 +314,9 @@
|
|||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="reportId != null">
|
||||
report_id = #{reportId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="results != null">
|
||||
results = #{results,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -320,6 +335,7 @@
|
|||
remark = #{remark,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
report_id = #{reportId,jdbcType=VARCHAR},
|
||||
results = #{results,jdbcType=LONGVARCHAR},
|
||||
issues = #{issues,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
|
@ -332,7 +348,8 @@
|
|||
status = #{status,jdbcType=VARCHAR},
|
||||
remark = #{remark,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT}
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
report_id = #{reportId,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -2,6 +2,7 @@ package io.metersphere.base.mapper.ext;
|
|||
|
||||
import io.metersphere.api.dto.APITestResult;
|
||||
import io.metersphere.api.dto.QueryAPITestRequest;
|
||||
import io.metersphere.base.domain.ApiTest;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -10,4 +11,6 @@ public interface ExtApiTestMapper {
|
|||
List<APITestResult> list(@Param("request") QueryAPITestRequest request);
|
||||
|
||||
Long countByProjectId(String projectId);
|
||||
|
||||
List<ApiTest> getApiTestByProjectId(String projectId);
|
||||
}
|
||||
|
|
|
@ -30,8 +30,13 @@
|
|||
order by api_test.update_time desc
|
||||
</select>
|
||||
<select id="countByProjectId" resultType="java.lang.Long">
|
||||
select count(id) from api_test
|
||||
where project_id = #{projectId};
|
||||
select count(id) from api_test
|
||||
where project_id = #{projectId}
|
||||
</select>
|
||||
<select id="getApiTestByProjectId" resultType="io.metersphere.base.domain.ApiTest">
|
||||
select id,name
|
||||
from api_test
|
||||
where project_id = #{projectId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -1,5 +1,6 @@
|
|||
package io.metersphere.base.mapper.ext;
|
||||
|
||||
import io.metersphere.base.domain.LoadTest;
|
||||
import io.metersphere.track.request.testplan.QueryTestPlanRequest;
|
||||
import io.metersphere.dto.LoadTestDTO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
@ -10,4 +11,6 @@ public interface ExtLoadTestMapper {
|
|||
List<LoadTestDTO> list(@Param("request") QueryTestPlanRequest params);
|
||||
|
||||
Long countByProjectId(String projectId);
|
||||
|
||||
List<LoadTest> getLoadTestByProjectId(String projectId);
|
||||
}
|
||||
|
|
|
@ -31,5 +31,10 @@
|
|||
select count(id) from load_test
|
||||
where project_id = #{projectId};
|
||||
</select>
|
||||
<select id="getLoadTestByProjectId" resultType="io.metersphere.base.domain.LoadTest">
|
||||
select id,name
|
||||
from load_test
|
||||
where project_id = #{projectId};
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -3,6 +3,7 @@ package io.metersphere.performance.controller;
|
|||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.base.domain.FileMetadata;
|
||||
import io.metersphere.base.domain.LoadTest;
|
||||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
|
@ -48,6 +49,11 @@ public class PerformanceTestController {
|
|||
return PageUtils.setPageInfo(page, performanceTestService.list(request));
|
||||
}
|
||||
|
||||
@GetMapping("/list/{projectId}")
|
||||
public List<LoadTest> list(@PathVariable String projectId) {
|
||||
return performanceTestService.getLoadTestByProjectId(projectId);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/save", consumes = {"multipart/form-data"})
|
||||
public String save(
|
||||
@RequestPart("request") SaveTestPlanRequest request,
|
||||
|
|
|
@ -280,4 +280,7 @@ public class PerformanceTestService {
|
|||
return extLoadTestReportMapper.selectDashboardTests(workspaceId, startTimestamp);
|
||||
}
|
||||
|
||||
public List<LoadTest> getLoadTestByProjectId(String projectId) {
|
||||
return extLoadTestMapper.getLoadTestByProjectId(projectId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -286,6 +286,7 @@ CREATE TABLE IF NOT EXISTS `test_case_node` (
|
|||
CREATE TABLE IF NOT EXISTS `test_case` (
|
||||
`id` varchar(50) NOT NULL COMMENT 'Test case ID',
|
||||
`node_id` varchar(50) NOT NULL COMMENT 'Node ID this case belongs to',
|
||||
`test_id` varchar(50) DEFAULT NULL COMMENT 'Test ID relation to',
|
||||
`node_path` varchar(50) NOT NULL COMMENT 'Node path this case belongs to',
|
||||
`project_id` varchar(50) NOT NULL COMMENT 'Project ID this test belongs to',
|
||||
`name` varchar(64) NOT NULL COMMENT 'Case name',
|
||||
|
@ -309,6 +310,7 @@ CREATE TABLE IF NOT EXISTS `test_plan_test_case` (
|
|||
`id` varchar(50) NOT NULL COMMENT 'ID',
|
||||
`plan_id` varchar(50) NOT NULL COMMENT 'Plan ID relation to',
|
||||
`case_id` varchar(50) NOT NULL COMMENT 'Case ID relation to',
|
||||
`report_id` varchar(50) DEFAULT NULL COMMENT 'Test report ID relation to',
|
||||
`executor` varchar(64) NOT NULL COMMENT 'Test case executor',
|
||||
`status` varchar(15) NULL COMMENT 'Test case status',
|
||||
`results` longtext COMMENT 'Test case result',
|
||||
|
|
|
@ -59,8 +59,8 @@
|
|||
|
||||
<!--要生成的数据库表 -->
|
||||
|
||||
<table tableName="load_test_report"/>
|
||||
<table tableName="load_test"/>
|
||||
<table tableName="test_plan_test_case"/>
|
||||
<table tableName="test_case"/>
|
||||
|
||||
</context>
|
||||
</generatorConfiguration>
|
|
@ -64,7 +64,7 @@
|
|||
<el-row>
|
||||
<el-col :span="10" :offset="1">
|
||||
<el-form-item :label="$t('test_track.case.type')" :label-width="formLabelWidth" prop="type">
|
||||
<el-select :disabled="readOnly" v-model="form.type" :placeholder="$t('test_track.case.input_type')">
|
||||
<el-select @change="typeChange" :disabled="readOnly" v-model="form.type" :placeholder="$t('test_track.case.input_type')">
|
||||
<el-option :label="$t('commons.functional')" value="functional"></el-option>
|
||||
<el-option :label="$t('commons.performance')" value="performance"></el-option>
|
||||
<el-option :label="$t('commons.api')" value="api"></el-option>
|
||||
|
@ -81,6 +81,21 @@
|
|||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row v-if="form.method && form.method == 'auto'">
|
||||
<el-col :span="10" :offset="1">
|
||||
<el-form-item :label="'关联测试'" :label-width="formLabelWidth" prop="testId">
|
||||
<el-select filterable :disabled="readOnly" v-model="form.testId" :placeholder="$t('test_track.case.input_type')">
|
||||
<el-option
|
||||
v-for="item in testOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row style="margin-top: 15px;">
|
||||
<el-col :offset="2">{{$t('test_track.case.prerequisite')}}:</el-col>
|
||||
</el-row>
|
||||
|
@ -213,6 +228,7 @@
|
|||
type: '',
|
||||
method: '',
|
||||
prerequisite: '',
|
||||
testId: '',
|
||||
steps: [{
|
||||
num: 1 ,
|
||||
desc: '',
|
||||
|
@ -222,6 +238,7 @@
|
|||
},
|
||||
moduleOptions: [],
|
||||
maintainerOptions: [],
|
||||
testOptions: [],
|
||||
workspaceId: '',
|
||||
rules:{
|
||||
name :[
|
||||
|
@ -232,6 +249,7 @@
|
|||
maintainer :[{required: true, message: this.$t('test_track.case.input_maintainer'), trigger: 'change'}],
|
||||
priority :[{required: true, message: this.$t('test_track.case.input_priority'), trigger: 'change'}],
|
||||
type :[{required: true, message: this.$t('test_track.case.input_type'), trigger: 'change'}],
|
||||
testId :[{required: true, message: '请选择测试', trigger: 'change'}],
|
||||
method :[{required: true, message: this.$t('test_track.case.input_method'), trigger: 'change'}],
|
||||
prerequisite :[{ max: 300, message: this.$t('test_track.length_less_than') + '300', trigger: 'blur'}],
|
||||
remark :[{ max: 300, message: this.$t('test_track.length_less_than') + '300', trigger: 'blur'}]
|
||||
|
@ -258,6 +276,9 @@
|
|||
},
|
||||
mounted() {
|
||||
this.getSelectOptions();
|
||||
},
|
||||
watch: {
|
||||
|
||||
},
|
||||
methods: {
|
||||
open(testCase) {
|
||||
|
@ -315,49 +336,61 @@
|
|||
saveCase(){
|
||||
this.$refs['caseFrom'].validate((valid) => {
|
||||
if (valid) {
|
||||
let param = {};
|
||||
Object.assign(param, this.form);
|
||||
|
||||
for (let i = 0; i < param.steps.length; i++){
|
||||
if ((param.steps[i].desc && param.steps[i].desc.length > 300) ||
|
||||
(param.steps[i].result && param.steps[i].result.length > 300)) {
|
||||
this.$warning(this.$t('test_track.case.step_desc') + ","
|
||||
+ this.$t('test_track.case.expected_results') + this.$t('test_track.length_less_than') + '300');
|
||||
return;
|
||||
}
|
||||
let param = this.buildParam();
|
||||
if (this.validate(param)) {
|
||||
this.result = this.$post('/test/case/' + this.operationType, param, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
if (this.operationType == 'add' && this.isCreateContinue) {
|
||||
this.form.name = '';
|
||||
return;
|
||||
}
|
||||
this.dialogFormVisible = false;
|
||||
this.$emit("refresh");
|
||||
});
|
||||
}
|
||||
|
||||
param.steps = JSON.stringify(this.form.steps);
|
||||
param.nodeId = this.form.module;
|
||||
this.moduleOptions.forEach(item => {
|
||||
if(this.form.module === item.id){
|
||||
param.nodePath = item.path;
|
||||
}
|
||||
});
|
||||
|
||||
if (this.currentProject) {
|
||||
param.projectId = this.currentProject.id;
|
||||
}
|
||||
|
||||
param.name = param.name.trim();
|
||||
if (param.name == '') {
|
||||
this.$warning(this.$t('test_track.case.input_name'));
|
||||
return;
|
||||
}
|
||||
this.result = this.$post('/test/case/' + this.operationType, param, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
if (this.operationType == 'add' && this.isCreateContinue) {
|
||||
this.form.name = '';
|
||||
return;
|
||||
}
|
||||
this.dialogFormVisible = false;
|
||||
this.$emit("refresh");
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
buildParam() {
|
||||
let param = {};
|
||||
Object.assign(param, this.form);
|
||||
param.steps = JSON.stringify(this.form.steps);
|
||||
param.nodeId = this.form.module;
|
||||
this.moduleOptions.forEach(item => {
|
||||
if(this.form.module === item.id){
|
||||
param.nodePath = item.path;
|
||||
}
|
||||
});
|
||||
if (this.currentProject) {
|
||||
param.projectId = this.currentProject.id;
|
||||
}
|
||||
param.name = param.name.trim();
|
||||
if (param.method != 'auto') {
|
||||
param.testId = null;
|
||||
}
|
||||
return param;
|
||||
},
|
||||
validate(param) {
|
||||
for (let i = 0; i < param.steps.length; i++){
|
||||
if ((param.steps[i].desc && param.steps[i].desc.length > 300) ||
|
||||
(param.steps[i].result && param.steps[i].result.length > 300)) {
|
||||
this.$warning(this.$t('test_track.case.step_desc') + ","
|
||||
+ this.$t('test_track.case.expected_results') + this.$t('test_track.length_less_than') + '300');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (param.name == '') {
|
||||
this.$warning(this.$t('test_track.case.input_name'));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
typeChange() {
|
||||
this.form.testId = '';
|
||||
this.getTestOptions()
|
||||
},
|
||||
getModuleOptions() {
|
||||
let moduleOptions = [];
|
||||
this.treeNodes.forEach(node => {
|
||||
|
@ -371,9 +404,18 @@
|
|||
this.maintainerOptions = response.data;
|
||||
});
|
||||
},
|
||||
getTestOptions() {
|
||||
this.testOptions = [];
|
||||
if (this.currentProject && this.form.type != '' && this.form.type != 'functional') {
|
||||
this.$get('/' + this.form.type + '/list/' + this.currentProject.id, response => {
|
||||
this.testOptions = response.data;
|
||||
});
|
||||
}
|
||||
},
|
||||
getSelectOptions() {
|
||||
this.getModuleOptions();
|
||||
this.getMaintainerOptions();
|
||||
this.getTestOptions();
|
||||
},
|
||||
buildNodePath(node, option, moduleOptions) {
|
||||
//递归构建节点路径
|
||||
|
|
Loading…
Reference in New Issue