fix(测试跟踪): 测试计划报告增加未执行的tab

--bug=1011516 --user=宋天阳 【测试计划】-测试报告 接口测试部分 没有显示 未执行列
https://www.tapd.cn/55049933/s/1123098
This commit is contained in:
song-tianyang 2022-03-22 15:11:27 +08:00 committed by CountryBuilder
parent a73c70813c
commit ae2028910a
19 changed files with 214 additions and 53 deletions

View File

@ -47,5 +47,9 @@ public class TestPlanReportContentWithBLOBs extends TestPlanReportContent implem
private String errorReportScenarios; private String errorReportScenarios;
private String unExecuteCases;
private String unExecuteScenarios;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -31,6 +31,8 @@
<result column="plan_load_case_report_struct" jdbcType="LONGVARCHAR" property="planLoadCaseReportStruct" /> <result column="plan_load_case_report_struct" jdbcType="LONGVARCHAR" property="planLoadCaseReportStruct" />
<result column="error_report_cases" jdbcType="LONGVARCHAR" property="errorReportCases" /> <result column="error_report_cases" jdbcType="LONGVARCHAR" property="errorReportCases" />
<result column="error_report_scenarios" jdbcType="LONGVARCHAR" property="errorReportScenarios" /> <result column="error_report_scenarios" jdbcType="LONGVARCHAR" property="errorReportScenarios" />
<result column="un_execute_cases" jdbcType="LONGVARCHAR" property="unExecuteCases" />
<result column="un_execute_scenarios" jdbcType="LONGVARCHAR" property="unExecuteScenarios" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
@ -98,7 +100,8 @@
config, summary, function_result, api_result, load_result, function_all_cases, function_failure_cases, config, summary, function_result, api_result, load_result, function_all_cases, function_failure_cases,
issue_list, api_all_cases, api_failure_cases, scenario_all_cases, scenario_failure_cases, issue_list, api_all_cases, api_failure_cases, scenario_all_cases, scenario_failure_cases,
load_all_Cases, load_failure_cases, plan_scenario_report_struct, plan_api_case_report_struct, load_all_Cases, load_failure_cases, plan_scenario_report_struct, plan_api_case_report_struct,
plan_load_case_report_struct, error_report_cases, error_report_scenarios plan_load_case_report_struct, error_report_cases, error_report_scenarios, un_execute_cases,
un_execute_scenarios
</sql> </sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.TestPlanReportContentExample" resultMap="ResultMapWithBLOBs"> <select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.TestPlanReportContentExample" resultMap="ResultMapWithBLOBs">
select select
@ -159,7 +162,8 @@
load_all_Cases, load_failure_cases, load_all_Cases, load_failure_cases,
plan_scenario_report_struct, plan_api_case_report_struct, plan_scenario_report_struct, plan_api_case_report_struct,
plan_load_case_report_struct, error_report_cases, plan_load_case_report_struct, error_report_cases,
error_report_scenarios) error_report_scenarios, un_execute_cases,
un_execute_scenarios)
values (#{id,jdbcType=VARCHAR}, #{testPlanReportId,jdbcType=VARCHAR}, #{startTime,jdbcType=BIGINT}, values (#{id,jdbcType=VARCHAR}, #{testPlanReportId,jdbcType=VARCHAR}, #{startTime,jdbcType=BIGINT},
#{caseCount,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT}, #{executeRate,jdbcType=DOUBLE}, #{caseCount,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT}, #{executeRate,jdbcType=DOUBLE},
#{passRate,jdbcType=DOUBLE}, #{isThirdPartIssue,jdbcType=BIT}, #{config,jdbcType=LONGVARCHAR}, #{passRate,jdbcType=DOUBLE}, #{isThirdPartIssue,jdbcType=BIT}, #{config,jdbcType=LONGVARCHAR},
@ -170,7 +174,8 @@
#{loadAllCases,jdbcType=LONGVARCHAR}, #{loadFailureCases,jdbcType=LONGVARCHAR}, #{loadAllCases,jdbcType=LONGVARCHAR}, #{loadFailureCases,jdbcType=LONGVARCHAR},
#{planScenarioReportStruct,jdbcType=LONGVARCHAR}, #{planApiCaseReportStruct,jdbcType=LONGVARCHAR}, #{planScenarioReportStruct,jdbcType=LONGVARCHAR}, #{planApiCaseReportStruct,jdbcType=LONGVARCHAR},
#{planLoadCaseReportStruct,jdbcType=LONGVARCHAR}, #{errorReportCases,jdbcType=LONGVARCHAR}, #{planLoadCaseReportStruct,jdbcType=LONGVARCHAR}, #{errorReportCases,jdbcType=LONGVARCHAR},
#{errorReportScenarios,jdbcType=LONGVARCHAR}) #{errorReportScenarios,jdbcType=LONGVARCHAR}, #{unExecuteCases,jdbcType=LONGVARCHAR},
#{unExecuteScenarios,jdbcType=LONGVARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlanReportContentWithBLOBs"> <insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlanReportContentWithBLOBs">
insert into test_plan_report_content insert into test_plan_report_content
@ -256,6 +261,12 @@
<if test="errorReportScenarios != null"> <if test="errorReportScenarios != null">
error_report_scenarios, error_report_scenarios,
</if> </if>
<if test="unExecuteCases != null">
un_execute_cases,
</if>
<if test="unExecuteScenarios != null">
un_execute_scenarios,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
@ -339,6 +350,12 @@
<if test="errorReportScenarios != null"> <if test="errorReportScenarios != null">
#{errorReportScenarios,jdbcType=LONGVARCHAR}, #{errorReportScenarios,jdbcType=LONGVARCHAR},
</if> </if>
<if test="unExecuteCases != null">
#{unExecuteCases,jdbcType=LONGVARCHAR},
</if>
<if test="unExecuteScenarios != null">
#{unExecuteScenarios,jdbcType=LONGVARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.TestPlanReportContentExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="io.metersphere.base.domain.TestPlanReportContentExample" resultType="java.lang.Long">
@ -431,6 +448,12 @@
<if test="record.errorReportScenarios != null"> <if test="record.errorReportScenarios != null">
error_report_scenarios = #{record.errorReportScenarios,jdbcType=LONGVARCHAR}, error_report_scenarios = #{record.errorReportScenarios,jdbcType=LONGVARCHAR},
</if> </if>
<if test="record.unExecuteCases != null">
un_execute_cases = #{record.unExecuteCases,jdbcType=LONGVARCHAR},
</if>
<if test="record.unExecuteScenarios != null">
un_execute_scenarios = #{record.unExecuteScenarios,jdbcType=LONGVARCHAR},
</if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
@ -464,7 +487,9 @@
plan_api_case_report_struct = #{record.planApiCaseReportStruct,jdbcType=LONGVARCHAR}, plan_api_case_report_struct = #{record.planApiCaseReportStruct,jdbcType=LONGVARCHAR},
plan_load_case_report_struct = #{record.planLoadCaseReportStruct,jdbcType=LONGVARCHAR}, plan_load_case_report_struct = #{record.planLoadCaseReportStruct,jdbcType=LONGVARCHAR},
error_report_cases = #{record.errorReportCases,jdbcType=LONGVARCHAR}, error_report_cases = #{record.errorReportCases,jdbcType=LONGVARCHAR},
error_report_scenarios = #{record.errorReportScenarios,jdbcType=LONGVARCHAR} error_report_scenarios = #{record.errorReportScenarios,jdbcType=LONGVARCHAR},
un_execute_cases = #{record.unExecuteCases,jdbcType=LONGVARCHAR},
un_execute_scenarios = #{record.unExecuteScenarios,jdbcType=LONGVARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
@ -564,6 +589,12 @@
<if test="errorReportScenarios != null"> <if test="errorReportScenarios != null">
error_report_scenarios = #{errorReportScenarios,jdbcType=LONGVARCHAR}, error_report_scenarios = #{errorReportScenarios,jdbcType=LONGVARCHAR},
</if> </if>
<if test="unExecuteCases != null">
un_execute_cases = #{unExecuteCases,jdbcType=LONGVARCHAR},
</if>
<if test="unExecuteScenarios != null">
un_execute_scenarios = #{unExecuteScenarios,jdbcType=LONGVARCHAR},
</if>
</set> </set>
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
@ -594,7 +625,9 @@
plan_api_case_report_struct = #{planApiCaseReportStruct,jdbcType=LONGVARCHAR}, plan_api_case_report_struct = #{planApiCaseReportStruct,jdbcType=LONGVARCHAR},
plan_load_case_report_struct = #{planLoadCaseReportStruct,jdbcType=LONGVARCHAR}, plan_load_case_report_struct = #{planLoadCaseReportStruct,jdbcType=LONGVARCHAR},
error_report_cases = #{errorReportCases,jdbcType=LONGVARCHAR}, error_report_cases = #{errorReportCases,jdbcType=LONGVARCHAR},
error_report_scenarios = #{errorReportScenarios,jdbcType=LONGVARCHAR} error_report_scenarios = #{errorReportScenarios,jdbcType=LONGVARCHAR},
un_execute_cases = #{unExecuteCases,jdbcType=LONGVARCHAR},
un_execute_scenarios = #{unExecuteScenarios,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestPlanReportContent"> <update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestPlanReportContent">

View File

@ -302,7 +302,10 @@
api_test_case c api_test_case c
on t.api_case_id = c.id on t.api_case_id = c.id
and t.test_plan_id = #{planId} and t.test_plan_id = #{planId}
<if test="status != null"> <if test="status == 'unExecute'">
and (t.status in ('Stop','unExecute') or t.status IS NULL)
</if>
<if test="status != null and status != 'unExecute'">
and t.status = #{status} and t.status = #{status}
</if> </if>
and (c.status != 'Trash' or c.status is null) and (c.status != 'Trash' or c.status is null)

View File

@ -248,12 +248,15 @@
api_scenario c api_scenario c
on t.api_scenario_id = c.id and (c.status != 'Trash' or c.status is null) on t.api_scenario_id = c.id and (c.status != 'Trash' or c.status is null)
and t.test_plan_id = #{planId} and t.test_plan_id = #{planId}
<if test="status != null and status != 'Fail'"> <if test="status != null and status != 'Fail' and status != 'unExecute'">
and t.last_result = #{status} and t.last_result = #{status}
</if> </if>
<if test="status == 'Fail'"> <if test="status == 'unExecute'">
and (t.last_result in ('Stop','unExecute') or t.last_result IS NULL)
</if>
<if test="status == 'Fail'">
and t.last_result in ('Fail','Error') and t.last_result in ('Fail','Error')
</if> </if>
where t.test_plan_id = #{planId} where t.test_plan_id = #{planId}
ORDER BY t.order DESC ORDER BY t.order DESC
</select> </select>

View File

@ -125,6 +125,12 @@ public class ShareController {
return testPlanApiCaseService.getErrorReportCases(planId); return testPlanApiCaseService.getErrorReportCases(planId);
} }
@GetMapping("/test/plan/api/case/list/unExecute/{shareId}/{planId}")
public List<TestPlanFailureApiDTO> getUnExecuteCases(@PathVariable String shareId, @PathVariable String planId) {
shareInfoService.validate(shareId, planId);
return testPlanApiCaseService.getUnExecuteCases(planId);
}
@GetMapping("/test/plan/api/case/list/all/{shareId}/{planId}") @GetMapping("/test/plan/api/case/list/all/{shareId}/{planId}")
public List<TestPlanFailureApiDTO> getApiAllList(@PathVariable String shareId, @PathVariable String planId) { public List<TestPlanFailureApiDTO> getApiAllList(@PathVariable String shareId, @PathVariable String planId) {
shareInfoService.validate(shareId, planId); shareInfoService.validate(shareId, planId);
@ -149,6 +155,12 @@ public class ShareController {
return testPlanScenarioCaseService.getErrorReportCases(planId); return testPlanScenarioCaseService.getErrorReportCases(planId);
} }
@GetMapping("/test/plan/scenario/case/list/unExecute/{shareId}/{planId}")
public List<TestPlanFailureScenarioDTO> getUnExecuteScenarioCases(@PathVariable String shareId, @PathVariable String planId) {
shareInfoService.validate(shareId, planId);
return testPlanScenarioCaseService.getUnExecuteCases(planId);
}
@GetMapping("/api/definition/report/getReport/{shareId}/{testId}") @GetMapping("/api/definition/report/getReport/{shareId}/{testId}")
public APIReportResult getApiReport(@PathVariable String shareId, @PathVariable String testId) { public APIReportResult getApiReport(@PathVariable String shareId, @PathVariable String testId) {
// shareInfoService.apiReportValidate(shareId, testId); // shareInfoService.apiReportValidate(shareId, testId);

View File

@ -45,6 +45,10 @@ public class TestPlanApiCaseController {
public List<TestPlanFailureApiDTO> getErrorReportList(@PathVariable String planId) { public List<TestPlanFailureApiDTO> getErrorReportList(@PathVariable String planId) {
return testPlanApiCaseService.getErrorReportCases(planId); return testPlanApiCaseService.getErrorReportCases(planId);
} }
@GetMapping("/list/unExecute/{planId}")
public List<TestPlanFailureApiDTO> getUnExecuteCases(@PathVariable String planId) {
return testPlanApiCaseService.getUnExecuteCases(planId);
}
@GetMapping("/list/all/{planId}") @GetMapping("/list/all/{planId}")
public List<TestPlanFailureApiDTO> getAllList(@PathVariable String planId) { public List<TestPlanFailureApiDTO> getAllList(@PathVariable String planId) {

View File

@ -46,6 +46,11 @@ public class TestPlanScenarioCaseController {
return testPlanScenarioCaseService.getErrorReportCases(planId); return testPlanScenarioCaseService.getErrorReportCases(planId);
} }
@GetMapping("/list/unExecute/{planId}")
public List<TestPlanFailureScenarioDTO> getUnExecuteCases(@PathVariable String planId) {
return testPlanScenarioCaseService.getUnExecuteCases(planId);
}
@GetMapping("/list/all/{planId}") @GetMapping("/list/all/{planId}")
public List<TestPlanFailureScenarioDTO> getAllList(@PathVariable String planId) { public List<TestPlanFailureScenarioDTO> getAllList(@PathVariable String planId) {
return testPlanScenarioCaseService.getAllCases(planId); return testPlanScenarioCaseService.getAllCases(planId);

View File

@ -35,4 +35,6 @@ public class TestPlanSimpleReportDTO extends TestPlanReportContent {
List<TestPlanLoadCaseDTO> loadFailureCases; List<TestPlanLoadCaseDTO> loadFailureCases;
List<TestPlanFailureApiDTO> errorReportCases; List<TestPlanFailureApiDTO> errorReportCases;
List<TestPlanFailureScenarioDTO> errorReportScenarios; List<TestPlanFailureScenarioDTO> errorReportScenarios;
List<TestPlanFailureApiDTO> unExecuteCases;
List<TestPlanFailureScenarioDTO> unExecuteScenarios;
} }

View File

@ -443,4 +443,9 @@ public class TestPlanApiCaseService {
List<TestPlanFailureApiDTO> apiTestCases = extTestPlanApiCaseMapper.getFailureList(planId, ExecuteResult.errorReportResult.name()); List<TestPlanFailureApiDTO> apiTestCases = extTestPlanApiCaseMapper.getFailureList(planId, ExecuteResult.errorReportResult.name());
return buildCases(apiTestCases); return buildCases(apiTestCases);
} }
public List<TestPlanFailureApiDTO> getUnExecuteCases(String planId) {
List<TestPlanFailureApiDTO> apiTestCases = extTestPlanApiCaseMapper.getFailureList(planId, "unExecute");
return buildCases(apiTestCases);
}
} }

View File

@ -564,6 +564,12 @@ public class TestPlanReportService {
if (reportDTO.getErrorReportScenarios() != null) { if (reportDTO.getErrorReportScenarios() != null) {
testPlanReportContentWithBLOBs.setErrorReportScenarios(JSONObject.toJSONString(reportDTO.getErrorReportScenarios())); testPlanReportContentWithBLOBs.setErrorReportScenarios(JSONObject.toJSONString(reportDTO.getErrorReportScenarios()));
} }
if(reportDTO.getUnExecuteCases() != null){
testPlanReportContentWithBLOBs.setUnExecuteCases(JSONObject.toJSONString(reportDTO.getUnExecuteCases()));
}
if(reportDTO.getUnExecuteScenarios() != null){
testPlanReportContentWithBLOBs.setUnExecuteScenarios(JSONObject.toJSONString(reportDTO.getUnExecuteScenarios()));
}
// 更新测试计划报告通过率字段 passRate // 更新测试计划报告通过率字段 passRate
TestPlanReportContentExample contentExample = new TestPlanReportContentExample(); TestPlanReportContentExample contentExample = new TestPlanReportContentExample();
@ -912,6 +918,12 @@ public class TestPlanReportService {
if (StringUtils.isNotBlank(testPlanReportContent.getErrorReportScenarios())) { if (StringUtils.isNotBlank(testPlanReportContent.getErrorReportScenarios())) {
testPlanReportDTO.setErrorReportScenarios(JSONObject.parseArray(testPlanReportContent.getErrorReportScenarios(), TestPlanFailureScenarioDTO.class)); testPlanReportDTO.setErrorReportScenarios(JSONObject.parseArray(testPlanReportContent.getErrorReportScenarios(), TestPlanFailureScenarioDTO.class));
} }
if (StringUtils.isNotBlank(testPlanReportContent.getUnExecuteCases())) {
testPlanReportDTO.setUnExecuteCases(JSONObject.parseArray(testPlanReportContent.getUnExecuteCases(), TestPlanFailureApiDTO.class));
}
if (StringUtils.isNotBlank(testPlanReportContent.getUnExecuteScenarios())) {
testPlanReportDTO.setUnExecuteScenarios(JSONObject.parseArray(testPlanReportContent.getUnExecuteScenarios(), TestPlanFailureScenarioDTO.class));
}
testPlanReportDTO.setId(reportId); testPlanReportDTO.setId(reportId);
TestPlanReport testPlanReport = testPlanReportMapper.selectByPrimaryKey(testPlanReportContent.getTestPlanReportId()); TestPlanReport testPlanReport = testPlanReportMapper.selectByPrimaryKey(testPlanReportContent.getTestPlanReportId());
testPlanReportDTO.setName(testPlanReport.getName()); testPlanReportDTO.setName(testPlanReport.getName());

View File

@ -596,4 +596,10 @@ public class TestPlanScenarioCaseService {
extTestPlanScenarioCaseMapper.getFailureList(planId, ExecuteResult.errorReportResult.name()); extTestPlanScenarioCaseMapper.getFailureList(planId, ExecuteResult.errorReportResult.name());
return buildCases(apiTestCases); return buildCases(apiTestCases);
} }
public List<TestPlanFailureScenarioDTO> getUnExecuteCases(String planId) {
List<TestPlanFailureScenarioDTO> apiTestCases =
extTestPlanScenarioCaseMapper.getFailureList(planId, "unExecute");
return buildCases(apiTestCases);
}
} }

View File

@ -1599,11 +1599,14 @@ public class TestPlanService {
if (!CollectionUtils.isEmpty(scenarios)) { if (!CollectionUtils.isEmpty(scenarios)) {
List<TestPlanFailureScenarioDTO> failureScenarios = new ArrayList<>(); List<TestPlanFailureScenarioDTO> failureScenarios = new ArrayList<>();
List<TestPlanFailureScenarioDTO> errorReportScenarios = new ArrayList<>(); List<TestPlanFailureScenarioDTO> errorReportScenarios = new ArrayList<>();
List<TestPlanFailureScenarioDTO> unExecuteScenarios = new ArrayList<>();
for (TestPlanFailureScenarioDTO scenario : scenarios) { for (TestPlanFailureScenarioDTO scenario : scenarios) {
if (StringUtils.equalsAnyIgnoreCase(scenario.getLastResult(), "Fail", "Error")) { if (StringUtils.equalsAnyIgnoreCase(scenario.getLastResult(), "Fail", "Error")) {
failureScenarios.add(scenario); failureScenarios.add(scenario);
} else if (StringUtils.equalsIgnoreCase(scenario.getLastResult(), ExecuteResult.errorReportResult.name())) { } else if (StringUtils.equalsIgnoreCase(scenario.getLastResult(), ExecuteResult.errorReportResult.name())) {
errorReportScenarios.add(scenario); errorReportScenarios.add(scenario);
} else if (StringUtils.equalsAnyIgnoreCase(scenario.getLastResult(), "stop","unexecute")) {
unExecuteScenarios.add(scenario);
} }
} }
if (checkReportConfig(reportConfig, "api", "failure")) { if (checkReportConfig(reportConfig, "api", "failure")) {
@ -1612,6 +1615,9 @@ public class TestPlanService {
if (checkReportConfig(reportConfig, "api", "errorReport")) { if (checkReportConfig(reportConfig, "api", "errorReport")) {
report.setErrorReportScenarios(errorReportScenarios); report.setErrorReportScenarios(errorReportScenarios);
} }
if (checkReportConfig(reportConfig, "api", "unExecute")) {
report.setUnExecuteScenarios(unExecuteScenarios);
}
} }
} }
@ -1619,11 +1625,14 @@ public class TestPlanService {
if (!CollectionUtils.isEmpty(apiAllCases)) { if (!CollectionUtils.isEmpty(apiAllCases)) {
List<TestPlanFailureApiDTO> apiFailureCases = new ArrayList<>(); List<TestPlanFailureApiDTO> apiFailureCases = new ArrayList<>();
List<TestPlanFailureApiDTO> apiErrorReportCases = new ArrayList<>(); List<TestPlanFailureApiDTO> apiErrorReportCases = new ArrayList<>();
List<TestPlanFailureApiDTO> apiUnExecuteCases = new ArrayList<>();
for (TestPlanFailureApiDTO apiDTO : apiAllCases) { for (TestPlanFailureApiDTO apiDTO : apiAllCases) {
if (StringUtils.equalsIgnoreCase(apiDTO.getExecResult(), "error")) { if (StringUtils.equalsIgnoreCase(apiDTO.getExecResult(), "error")) {
apiFailureCases.add(apiDTO); apiFailureCases.add(apiDTO);
} else if (StringUtils.equalsIgnoreCase(apiDTO.getExecResult(), ExecuteResult.errorReportResult.name())) { } else if (StringUtils.equalsIgnoreCase(apiDTO.getExecResult(), ExecuteResult.errorReportResult.name())) {
apiErrorReportCases.add(apiDTO); apiErrorReportCases.add(apiDTO);
} else if (StringUtils.equalsAnyIgnoreCase(apiDTO.getExecResult(), "stop","unexecute")) {
apiUnExecuteCases.add(apiDTO);
} }
} }
@ -1633,6 +1642,10 @@ public class TestPlanService {
if (checkReportConfig(reportConfig, "api", "errorReport")) { if (checkReportConfig(reportConfig, "api", "errorReport")) {
report.setErrorReportCases(apiErrorReportCases); report.setErrorReportCases(apiErrorReportCases);
} }
if (checkReportConfig(reportConfig, "api", "unExecute")) {
report.setUnExecuteCases(apiUnExecuteCases);
}
} }
} }

View File

@ -689,3 +689,7 @@ ALTER TABLE api_definition MODIFY COLUMN path varchar (1000);
# #
DELETE FROM user_group_permission DELETE FROM user_group_permission
WHERE group_id = 'project_app_manager'; WHERE group_id = 'project_app_manager';
ALTER TABLE `test_plan_report_content` ADD COLUMN `un_execute_cases` LONGTEXT COMMENT '未执行状态接口用例';
ALTER TABLE `test_plan_report_content` ADD COLUMN `un_execute_scenarios` LONGTEXT COMMENT '未执行状态场景用例';

View File

@ -18,7 +18,15 @@
<api-cases :is-db="isDb" :is-error-report="true" :share-id="shareId" :is-share="isShare" :report="report" <api-cases :is-db="isDb" :is-error-report="true" :share-id="shareId" :is-share="isShare" :report="report"
:is-template="isTemplate" :plan-id="planId" @setSize="setErrorReportSize"/> :is-template="isTemplate" :plan-id="planId" @setSize="setErrorReportSize"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane style="min-height: 500px" name="fourth" v-if="allEnable"> <el-tab-pane style="min-height: 500px" name="fourth" v-if="unExecuteEnable">
<template v-slot:label>
<tab-pane-count :title="$t('api_test.home_page.detail_card.unexecute')" :count="unExecuteSize"/>
</template>
<api-cases :is-db="isDb" :is-un-execute="true" :share-id="shareId" :is-share="isShare" :report="report"
:is-template="isTemplate" :plan-id="planId" @setSize="setUnExecuteSize"/>
</el-tab-pane>
<el-tab-pane style="min-height: 500px" name="fifth" v-if="allEnable">
<template v-slot:label> <template v-slot:label>
<tab-pane-count :title="$t('test_track.report.all_case')" :count="allSize"/> <tab-pane-count :title="$t('test_track.report.all_case')" :count="allSize"/>
</template> </template>
@ -45,6 +53,7 @@ export default {
activeName: 'first', activeName: 'first',
failureSize: 0, failureSize: 0,
errorReportSize: 0, errorReportSize: 0,
unExecuteSize:0,
allSize: 0, allSize: 0,
}; };
}, },
@ -64,6 +73,10 @@ export default {
let disable = this.report.config && this.report.config.api.children.errorReport && this.report.config.api.children.errorReport.enable === false; let disable = this.report.config && this.report.config.api.children.errorReport && this.report.config.api.children.errorReport.enable === false;
return !disable; return !disable;
}, },
unExecuteEnable() {
let disable = this.report.config && this.report.config.api.children.unExecute && this.report.config.api.children.unExecute.enable === false;
return !disable;
},
allEnable() { allEnable() {
let disable = this.report.config && this.report.config.api.children.all.enable === false; let disable = this.report.config && this.report.config.api.children.all.enable === false;
return !disable; return !disable;
@ -104,6 +117,9 @@ export default {
setErrorReportSize(size) { setErrorReportSize(size) {
this.errorReportSize = size; this.errorReportSize = size;
}, },
setUnExecuteSize(size){
this.unExecuteSize = size;
},
setAllSize(size) { setAllSize(size) {
this.allSize = size; this.allSize = size;
}, },

View File

@ -209,6 +209,10 @@ export default {
enable: true, enable: true,
name: this.$t('error_report_library.option.name'), name: this.$t('error_report_library.option.name'),
}, },
unExecute: {
enable: true,
name: this.$t('api_test.home_page.detail_card.unexecute'),
},
all: { all: {
enable: true, enable: true,
name: this.$t('test_track.report.all_case'), name: this.$t('test_track.report.all_case'),

View File

@ -70,9 +70,9 @@ import MethodTableItem from "../../../../../../common/tableItems/planview/Method
import StatusTableItem from "../../../../../../common/tableItems/planview/StatusTableItem"; import StatusTableItem from "../../../../../../common/tableItems/planview/StatusTableItem";
import { import {
getPlanApiAllCase, getPlanApiErrorReportCase, getPlanApiAllCase, getPlanApiErrorReportCase,
getPlanApiFailureCase, getPlanApiFailureCase, getPlanApiUnExecuteCase,
getSharePlanApiAllCase, getSharePlanApiErrorReportCase, getSharePlanApiAllCase, getSharePlanApiErrorReportCase,
getSharePlanApiFailureCase getSharePlanApiFailureCase, getSharePlanApiUnExecuteCase
} from "@/network/test-plan"; } from "@/network/test-plan";
import MsTable from "@/business/components/common/components/table/MsTable"; import MsTable from "@/business/components/common/components/table/MsTable";
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn"; import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
@ -97,6 +97,7 @@ export default {
shareId: String, shareId: String,
isAll: Boolean, isAll: Boolean,
isErrorReport: Boolean, isErrorReport: Boolean,
isUnExecute: Boolean,
isDb: Boolean isDb: Boolean
}, },
data() { data() {
@ -122,19 +123,25 @@ export default {
methods: { methods: {
getScenarioApiCase() { getScenarioApiCase() {
if (this.isTemplate || this.isDb) { if (this.isTemplate || this.isDb) {
if(this.isErrorReport){ if (this.isErrorReport) {
this.apiCases = this.report.errorReportCases ? this.report.errorReportCases : []; this.apiCases = this.report.errorReportCases ? this.report.errorReportCases : [];
}else if (this.isAll) { } else if (this.isUnExecute) {
this.apiCases = this.report.unExecuteCases ? this.report.unExecuteCases : [];
} else if (this.isAll) {
this.apiCases = this.report.apiAllCases ? this.report.apiAllCases : []; this.apiCases = this.report.apiAllCases ? this.report.apiAllCases : [];
} else { } else {
this.apiCases = this.report.apiFailureCases ? this.report.apiFailureCases : []; this.apiCases = this.report.apiFailureCases ? this.report.apiFailureCases : [];
} }
} else if (this.isShare) { } else if (this.isShare) {
if(this.isErrorReport){ if (this.isErrorReport) {
this.result = getSharePlanApiErrorReportCase(this.shareId, this.planId, (data) => { this.result = getSharePlanApiErrorReportCase(this.shareId, this.planId, (data) => {
this.apiCases = data; this.apiCases = data;
}); });
}else if (this.isAll) { } else if (this.isUnExecute) {
this.result = getSharePlanApiUnExecuteCase(this.shareId, this.planId, (data) => {
this.apiCases = data;
});
} else if (this.isAll) {
this.result = getSharePlanApiAllCase(this.shareId, this.planId, (data) => { this.result = getSharePlanApiAllCase(this.shareId, this.planId, (data) => {
this.apiCases = data; this.apiCases = data;
}); });
@ -144,11 +151,15 @@ export default {
}); });
} }
} else { } else {
if(this.isErrorReport){ if (this.isErrorReport) {
this.result = getPlanApiErrorReportCase(this.planId, (data) => { this.result = getPlanApiErrorReportCase(this.planId, (data) => {
this.apiCases = data; this.apiCases = data;
}); });
}else if (this.isAll) { } else if (this.isUnExecute) {
this.result = getPlanApiUnExecuteCase(this.planId, (data) => {
this.apiCases = data;
});
} else if (this.isAll) {
this.result = getPlanApiAllCase(this.planId, (data) => { this.result = getPlanApiAllCase(this.planId, (data) => {
this.apiCases = data; this.apiCases = data;
}); });

View File

@ -5,14 +5,14 @@
<template v-slot:label> <template v-slot:label>
<tab-pane-count :title="$t('commons.api_case')" :count="apiSize"/> <tab-pane-count :title="$t('commons.api_case')" :count="apiSize"/>
</template> </template>
<api-case-failure-result :is-db="isDb" :is-all="isAll" :is-error-report="isErrorReport" :share-id="shareId" :is-share="isShare" <api-case-failure-result :is-db="isDb" :is-all="isAll" :is-error-report="isErrorReport" :is-un-execute="isUnExecute" :share-id="shareId" :is-share="isShare"
:report="report" :is-template="isTemplate" :plan-id="planId" @setSize="setApiSize"/> :report="report" :is-template="isTemplate" :plan-id="planId" @setSize="setApiSize"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane> <el-tab-pane>
<template v-slot:label> <template v-slot:label>
<tab-pane-count :title="$t('commons.scenario_case')" :count="scenarioSize"/> <tab-pane-count :title="$t('commons.scenario_case')" :count="scenarioSize"/>
</template> </template>
<api-scenario-failure-result :is-db="isDb" :is-all="isAll" :is-error-report="isErrorReport" :share-id="shareId" :is-share="isShare" <api-scenario-failure-result :is-db="isDb" :is-all="isAll" :is-error-report="isErrorReport" :is-un-execute="isUnExecute" :share-id="shareId" :is-share="isShare"
:report="report" :is-template="isTemplate" :plan-id="planId" :report="report" :is-template="isTemplate" :plan-id="planId"
@setSize="setScenarioSize"/> @setSize="setScenarioSize"/>
</el-tab-pane> </el-tab-pane>
@ -46,6 +46,7 @@ export default {
shareId: String, shareId: String,
isAll: Boolean, isAll: Boolean,
isErrorReport: Boolean, isErrorReport: Boolean,
isUnExecute:Boolean,
isDb: Boolean isDb: Boolean
}, },
data() { data() {

View File

@ -13,33 +13,33 @@
:data="scenarioCases"> :data="scenarioCases">
<ms-table-column <ms-table-column
:width="80" :width="80"
:label="$t('commons.id')" :label="$t('commons.id')"
prop="customNum"> prop="customNum">
</ms-table-column> </ms-table-column>
<ms-table-column <ms-table-column
:label="$t('commons.name')" :label="$t('commons.name')"
prop="name"> prop="name">
</ms-table-column> </ms-table-column>
<ms-table-column <ms-table-column
:label="$t('test_track.report.list.creator')" :label="$t('test_track.report.list.creator')"
prop="creatorName"/> prop="creatorName"/>
<ms-table-column <ms-table-column
:label="$t('test_track.case.priority')" :label="$t('test_track.case.priority')"
:width="80"> :width="80">
<template v-slot:default="scope"> <template v-slot:default="scope">
<priority-table-item :value="scope.row.level" ref="priority"/> <priority-table-item :value="scope.row.level" ref="priority"/>
</template> </template>
</ms-table-column> </ms-table-column>
<ms-table-column <ms-table-column
:width="70" :width="70"
:label="$t('api_test.automation.step')" :label="$t('api_test.automation.step')"
prop="stepTotal"> prop="stepTotal">
</ms-table-column> </ms-table-column>
<ms-table-column <ms-table-column
:width="80" :width="80"
:label="$t('test_track.plan_view.execute_result')" :label="$t('test_track.plan_view.execute_result')"
prop="lastResult"> prop="lastResult">
<template v-slot:default="{row}"> <template v-slot:default="{row}">
<status-table-item v-if="row.lastResult === 'Success'" :value="'Pass'"/> <status-table-item v-if="row.lastResult === 'Success'" :value="'Pass'"/>
<status-table-item v-else-if="row.lastResult === 'Fail'" :value="'Failure'"/> <status-table-item v-else-if="row.lastResult === 'Fail'" :value="'Failure'"/>
@ -58,15 +58,15 @@
</ms-aside-container> </ms-aside-container>
<ms-main-container> <ms-main-container>
<ms-api-report <ms-api-report
v-if="showResponse" v-if="showResponse"
:is-plan="true" :is-plan="true"
:share-id="shareId" :share-id="shareId"
:is-share="isShare" :is-share="isShare"
:template-report="response" :template-report="response"
:is-template="isTemplate" :is-template="isTemplate"
:infoDb="true" :infoDb="true"
:report-id="reportId" :report-id="reportId"
@reportNotExist="showResponse = false"/> @reportNotExist="showResponse = false"/>
<div class="empty" v-else>{{ $t('test_track.plan.load_case.content_empty') }}</div> <div class="empty" v-else>{{ $t('test_track.plan.load_case.content_empty') }}</div>
</ms-main-container> </ms-main-container>
</el-container> </el-container>
@ -83,7 +83,7 @@ import {
getSharePlanScenarioAllCase, getSharePlanScenarioAllCase,
getSharePlanScenarioFailureCase, getSharePlanScenarioFailureCase,
getPlanScenarioErrorReportCase, getPlanScenarioErrorReportCase,
getSharePlanScenarioErrorReportCase, getSharePlanScenarioErrorReportCase, getPlanScenarioUnExecuteCase, getSharePlanScenarioUnExecuteCase,
} from "@/network/test-plan"; } from "@/network/test-plan";
import MsTable from "@/business/components/common/components/table/MsTable"; import MsTable from "@/business/components/common/components/table/MsTable";
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn"; import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
@ -107,6 +107,7 @@ export default {
shareId: String, shareId: String,
isAll: Boolean, isAll: Boolean,
isErrorReport: Boolean, isErrorReport: Boolean,
isUnExecute: Boolean,
isDb: Boolean isDb: Boolean
}, },
data() { data() {
@ -131,19 +132,25 @@ export default {
methods: { methods: {
getScenarioApiCase() { getScenarioApiCase() {
if (this.isTemplate || this.isDb) { if (this.isTemplate || this.isDb) {
if(this.isErrorReport){ if (this.isErrorReport) {
this.scenarioCases = this.report.errorReportScenarios ? this.report.errorReportScenarios : []; this.scenarioCases = this.report.errorReportScenarios ? this.report.errorReportScenarios : [];
}else if (this.isAll) { } else if (this.isUnExecute) {
this.scenarioCases = this.report.unExecuteScenarios ? this.report.unExecuteScenarios : [];
} else if (this.isAll) {
this.scenarioCases = this.report.scenarioAllCases ? this.report.scenarioAllCases : []; this.scenarioCases = this.report.scenarioAllCases ? this.report.scenarioAllCases : [];
} else { } else {
this.scenarioCases = this.report.scenarioFailureCases ? this.report.scenarioFailureCases : []; this.scenarioCases = this.report.scenarioFailureCases ? this.report.scenarioFailureCases : [];
} }
} else if (this.isShare) { } else if (this.isShare) {
if(this.isErrorReport){ if (this.isErrorReport) {
this.result = getSharePlanScenarioErrorReportCase(this.shareId, this.planId, (data) => { this.result = getSharePlanScenarioErrorReportCase(this.shareId, this.planId, (data) => {
this.scenarioCases = data; this.scenarioCases = data;
}); });
}else if (this.isAll) { } else if (this.isUnExecute) {
this.result = getSharePlanScenarioUnExecuteCase(this.shareId, this.planId, (data) => {
this.scenarioCases = data;
});
} else if (this.isAll) {
this.result = getSharePlanScenarioAllCase(this.shareId, this.planId, (data) => { this.result = getSharePlanScenarioAllCase(this.shareId, this.planId, (data) => {
this.scenarioCases = data; this.scenarioCases = data;
}); });
@ -153,11 +160,15 @@ export default {
}); });
} }
} else { } else {
if(this.isErrorReport){ if (this.isErrorReport) {
this.result = getPlanScenarioErrorReportCase(this.planId, (data) => { this.result = getPlanScenarioErrorReportCase(this.planId, (data) => {
this.scenarioCases = data; this.scenarioCases = data;
}); });
}else if (this.isAll) { } else if (this.isUnExecute) {
this.result = getPlanScenarioUnExecuteCase(this.planId, (data) => {
this.scenarioCases = data;
});
} else if (this.isAll) {
this.result = getPlanScenarioAllCase(this.planId, (data) => { this.result = getPlanScenarioAllCase(this.planId, (data) => {
this.scenarioCases = data; this.scenarioCases = data;
}); });
@ -176,7 +187,7 @@ export default {
this.response = row.response; this.response = row.response;
} }
} else { } else {
if (row.reportId && row.lastResult !=="Running" && row.lastResult !== "Waiting") { if (row.reportId && row.lastResult !== "Running" && row.lastResult !== "Waiting") {
this.showResponse = true; this.showResponse = true;
this.reportId = row.reportId; this.reportId = row.reportId;
} }

View File

@ -80,6 +80,10 @@ export function getPlanScenarioErrorReportCase(planId, callback) {
return planId ? baseGet('/test/plan/scenario/case/list/errorReport/' + planId, callback) : {}; return planId ? baseGet('/test/plan/scenario/case/list/errorReport/' + planId, callback) : {};
} }
export function getPlanScenarioUnExecuteCase(planId, callback) {
return planId ? baseGet('/test/plan/scenario/case/list/unExecute/' + planId, callback) : {};
}
export function getPlanScenarioAllCase(planId, callback) { export function getPlanScenarioAllCase(planId, callback) {
return planId ? baseGet('/test/plan/scenario/case/list/all/' + planId, callback) : {}; return planId ? baseGet('/test/plan/scenario/case/list/all/' + planId, callback) : {};
} }
@ -95,6 +99,9 @@ export function getSharePlanScenarioAllCase(shareId, planId, callback) {
export function getSharePlanScenarioErrorReportCase(shareId, planId, callback) { export function getSharePlanScenarioErrorReportCase(shareId, planId, callback) {
return planId ? baseGet('/share/test/plan/scenario/case/list/errorReport/' + shareId + '/' + planId, callback) : {}; return planId ? baseGet('/share/test/plan/scenario/case/list/errorReport/' + shareId + '/' + planId, callback) : {};
} }
export function getSharePlanScenarioUnExecuteCase(shareId, planId, callback) {
return planId ? baseGet('/share/test/plan/scenario/case/list/unExecute/' + shareId + '/' + planId, callback) : {};
}
export function getPlanApiFailureCase(planId, callback) { export function getPlanApiFailureCase(planId, callback) {
return planId ? baseGet('/test/plan/api/case/list/failure/' + planId, callback) : {}; return planId ? baseGet('/test/plan/api/case/list/failure/' + planId, callback) : {};
@ -103,6 +110,9 @@ export function getPlanApiFailureCase(planId, callback) {
export function getPlanApiErrorReportCase(planId, callback) { export function getPlanApiErrorReportCase(planId, callback) {
return planId ? baseGet('/test/plan/api/case/list/errorReport/' + planId, callback) : {}; return planId ? baseGet('/test/plan/api/case/list/errorReport/' + planId, callback) : {};
} }
export function getPlanApiUnExecuteCase(planId, callback) {
return planId ? baseGet('/test/plan/api/case/list/unExecute/' + planId, callback) : {};
}
export function getPlanApiAllCase(planId, callback) { export function getPlanApiAllCase(planId, callback) {
return planId ? baseGet('/test/plan/api/case/list/all/' + planId, callback) : {}; return planId ? baseGet('/test/plan/api/case/list/all/' + planId, callback) : {};
} }
@ -114,7 +124,9 @@ export function getSharePlanApiFailureCase(shareId, planId, callback) {
export function getSharePlanApiErrorReportCase(shareId, planId, callback) { export function getSharePlanApiErrorReportCase(shareId, planId, callback) {
return planId ? baseGet('/share/test/plan/api/case/list/errorReport/' + shareId + '/' + planId, callback) : {}; return planId ? baseGet('/share/test/plan/api/case/list/errorReport/' + shareId + '/' + planId, callback) : {};
} }
export function getSharePlanApiUnExecuteCase(shareId, planId, callback) {
return planId ? baseGet('/share/test/plan/api/case/list/unExecute/' + shareId + '/' + planId, callback) : {};
}
export function getSharePlanApiAllCase(shareId, planId, callback) { export function getSharePlanApiAllCase(shareId, planId, callback) {
return planId ? baseGet('/share/test/plan/api/case/list/all/' + shareId + '/' + planId, callback) : {}; return planId ? baseGet('/share/test/plan/api/case/list/all/' + shareId + '/' + planId, callback) : {};
} }