feat(测试跟踪): UI测试计划报告导出
--bug=1015194 --user=陈建星 【测试跟踪】分享/导出测试计划报告,ui用例统计分析,ui用例展示的其实是接口用例 https://www.tapd.cn/55049933/s/1212180
This commit is contained in:
parent
0e090ba9e0
commit
587b3dc67f
|
@ -2,7 +2,7 @@ package io.metersphere.base.mapper.ext;
|
||||||
|
|
||||||
import io.metersphere.api.dto.automation.TestPlanScenarioRequest;
|
import io.metersphere.api.dto.automation.TestPlanScenarioRequest;
|
||||||
import io.metersphere.base.domain.TestPlanUiScenario;
|
import io.metersphere.base.domain.TestPlanUiScenario;
|
||||||
import io.metersphere.dto.TestPlanFailureUiScenarioDTO;
|
import io.metersphere.dto.TestPlanUiScenarioDTO;
|
||||||
import io.metersphere.dto.UiScenarioDTO;
|
import io.metersphere.dto.UiScenarioDTO;
|
||||||
import io.metersphere.track.dto.PlanReportCaseDTO;
|
import io.metersphere.track.dto.PlanReportCaseDTO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
@ -29,9 +29,9 @@ public interface ExtTestPlanUiScenarioCaseMapper {
|
||||||
|
|
||||||
List<PlanReportCaseDTO> selectForPlanReport(String planId);
|
List<PlanReportCaseDTO> selectForPlanReport(String planId);
|
||||||
|
|
||||||
List<TestPlanFailureUiScenarioDTO> getFailureList(@Param("planId") String planId, @Param("status") String status);
|
List<TestPlanUiScenarioDTO> getPlanUiScenarioByStatusList(@Param("planId") String planId, @Param("statusList") List<String> statusList);
|
||||||
|
|
||||||
List<TestPlanFailureUiScenarioDTO> getFailureListByIds(@Param("ids") Collection<String> ids,@Param("status") String status);
|
List<TestPlanUiScenarioDTO> getFailureListByIds(@Param("ids") Collection<String> ids, @Param("status") String status);
|
||||||
|
|
||||||
List<Integer> getUnderwaySteps(@Param("ids") List<String> underwayIds);
|
List<Integer> getUnderwaySteps(@Param("ids") List<String> underwayIds);
|
||||||
|
|
||||||
|
|
|
@ -237,31 +237,7 @@
|
||||||
SELECT id FROM ui_scenario where status is null or status != 'Trash'
|
SELECT id FROM ui_scenario where status is null or status != 'Trash'
|
||||||
)
|
)
|
||||||
</select>
|
</select>
|
||||||
<select id="getFailureList" resultType="io.metersphere.dto.TestPlanFailureUiScenarioDTO">
|
<select id="getFailureListByIds" resultType="io.metersphere.dto.TestPlanUiScenarioDTO">
|
||||||
select
|
|
||||||
t.id, t.last_result, t.report_id, c.user_id, c.module_path, c.name, c.level,c.create_user,c.principal,
|
|
||||||
c.status,c.step_total, c.step_total, c.project_id,
|
|
||||||
c.num, c.custom_num
|
|
||||||
from
|
|
||||||
test_plan_ui_scenario t
|
|
||||||
inner join
|
|
||||||
ui_scenario c
|
|
||||||
on t.ui_scenario_id = c.id and (c.status != 'Trash' or c.status is null)
|
|
||||||
and t.test_plan_id = #{planId}
|
|
||||||
<if test="status != null and status != 'Fail' and status != 'unExecute'">
|
|
||||||
and t.last_result = #{status}
|
|
||||||
</if>
|
|
||||||
<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')
|
|
||||||
</if>
|
|
||||||
where t.test_plan_id = #{planId}
|
|
||||||
ORDER BY t.order DESC
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="getFailureListByIds" resultType="io.metersphere.dto.TestPlanFailureUiScenarioDTO">
|
|
||||||
select
|
select
|
||||||
t.id, t.last_result, t.report_id, c.user_id, c.module_path, c.name, c.level,c.create_user,c.principal,
|
t.id, t.last_result, t.report_id, c.user_id, c.module_path, c.name, c.level,c.create_user,c.principal,
|
||||||
c.status,c.step_total, c.step_total, c.project_id,
|
c.status,c.step_total, c.step_total, c.project_id,
|
||||||
|
@ -319,6 +295,26 @@
|
||||||
order by `order` desc limit 1;
|
order by `order` desc limit 1;
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getPlanUiScenarioByStatusList" resultType="io.metersphere.dto.TestPlanUiScenarioDTO">
|
||||||
|
select
|
||||||
|
t.id, t.last_result, t.report_id, c.user_id, c.module_path, c.name, c.level,c.create_user,c.principal,
|
||||||
|
c.status,c.step_total, c.step_total, c.project_id,
|
||||||
|
c.num, c.custom_num
|
||||||
|
from
|
||||||
|
test_plan_ui_scenario t
|
||||||
|
inner join
|
||||||
|
ui_scenario c
|
||||||
|
on t.ui_scenario_id = c.id and (c.status != 'Trash' or c.status is null)
|
||||||
|
and t.test_plan_id = #{planId}
|
||||||
|
<if test="statusList != null and statusList.size() > 0">
|
||||||
|
and t.last_result in
|
||||||
|
<foreach collection="statusList" item="status" separator="," open="(" close=")">
|
||||||
|
#{status}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
ORDER BY t.order DESC
|
||||||
|
</select>
|
||||||
|
|
||||||
<sql id="queryVersionCondition">
|
<sql id="queryVersionCondition">
|
||||||
<if test="request.versionId != null">
|
<if test="request.versionId != null">
|
||||||
and ${versionTable}.version_id = #{request.versionId}
|
and ${versionTable}.version_id = #{request.versionId}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
package io.metersphere.commons.constants;
|
||||||
|
|
||||||
|
public enum TestPlanUiResultStatus {
|
||||||
|
Error, Success, UnExecute
|
||||||
|
}
|
|
@ -159,28 +159,11 @@ public class ShareController {
|
||||||
return testPlanScenarioCaseService.getUnExecuteCases(planId);
|
return testPlanScenarioCaseService.getUnExecuteCases(planId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/test/plan/uiScenario/case/list/failure/{shareId}/{planId}")
|
@PostMapping("/test/plan/uiScenario/case/list/all/{shareId}/{planId}")
|
||||||
public List<TestPlanFailureUiScenarioDTO> getUiScenarioFailureList(@PathVariable String shareId, @PathVariable String planId) {
|
public List<TestPlanUiScenarioDTO> getUiScenarioAllList(@PathVariable String shareId, @PathVariable String planId,
|
||||||
|
@RequestBody(required = false) List<String> statusList) {
|
||||||
shareInfoService.validate(shareId, planId);
|
shareInfoService.validate(shareId, planId);
|
||||||
return testPlanUiScenarioCaseService.getFailureCases(planId);
|
return testPlanUiScenarioCaseService.getAllCasesByStatusList(planId, statusList);
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/test/plan/uiScenario/case/list/all/{shareId}/{planId}")
|
|
||||||
public List<TestPlanFailureUiScenarioDTO> getUiScenarioAllList(@PathVariable String shareId, @PathVariable String planId) {
|
|
||||||
shareInfoService.validate(shareId, planId);
|
|
||||||
return testPlanUiScenarioCaseService.getAllCases(planId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/test/plan/uiScenario/case/list/errorReport/{shareId}/{planId}")
|
|
||||||
public List<TestPlanFailureUiScenarioDTO> getUiScenarioErrorReportList(@PathVariable String shareId, @PathVariable String planId) {
|
|
||||||
shareInfoService.validate(shareId, planId);
|
|
||||||
return testPlanUiScenarioCaseService.getErrorReportCases(planId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/test/plan/uiScenario/case/list/unExecute/{shareId}/{planId}")
|
|
||||||
public List<TestPlanFailureUiScenarioDTO> geUitUnExecuteScenarioCases(@PathVariable String shareId, @PathVariable String planId) {
|
|
||||||
shareInfoService.validate(shareId, planId);
|
|
||||||
return testPlanUiScenarioCaseService.getUnExecuteCases(planId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/api/definition/report/getReport/{shareId}/{testId}")
|
@GetMapping("/api/definition/report/getReport/{shareId}/{testId}")
|
||||||
|
|
|
@ -8,6 +8,6 @@ import lombok.Setter;
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public class TestPlanFailureUiScenarioDTO extends UiScenarioDTO {
|
public class TestPlanUiScenarioDTO extends UiScenarioDTO {
|
||||||
private APIScenarioReportResult response;
|
private APIScenarioReportResult response;
|
||||||
}
|
}
|
|
@ -38,24 +38,10 @@ public class TestPlanUiScenarioCaseController {
|
||||||
return PageUtils.setPageInfo(page, testPlanUiScenarioCaseService.list(request));
|
return PageUtils.setPageInfo(page, testPlanUiScenarioCaseService.list(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/list/failure/{planId}")
|
@PostMapping("/list/all/{planId}")
|
||||||
public List<TestPlanFailureUiScenarioDTO> getFailureList(@PathVariable String planId) {
|
public List<TestPlanUiScenarioDTO> getAllList(@PathVariable String planId,
|
||||||
return testPlanUiScenarioCaseService.getFailureCases(planId);
|
@RequestBody(required = false) List<String> statusList) {
|
||||||
}
|
return testPlanUiScenarioCaseService.getAllCasesByStatusList(planId, statusList);
|
||||||
|
|
||||||
@GetMapping("/list/errorReport/{planId}")
|
|
||||||
public List<TestPlanFailureUiScenarioDTO> getErrorReportList(@PathVariable String planId) {
|
|
||||||
return testPlanUiScenarioCaseService.getErrorReportCases(planId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/list/unExecute/{planId}")
|
|
||||||
public List<TestPlanFailureUiScenarioDTO> getUnExecuteCases(@PathVariable String planId) {
|
|
||||||
return testPlanUiScenarioCaseService.getUnExecuteCases(planId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/list/all/{planId}")
|
|
||||||
public List<TestPlanFailureUiScenarioDTO> getAllList(@PathVariable String planId) {
|
|
||||||
return testPlanUiScenarioCaseService.getAllCases(planId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/selectAllTableRows")
|
@PostMapping("/selectAllTableRows")
|
||||||
|
|
|
@ -4,6 +4,7 @@ import io.metersphere.api.dto.automation.TestPlanFailureApiDTO;
|
||||||
import io.metersphere.api.dto.automation.TestPlanFailureScenarioDTO;
|
import io.metersphere.api.dto.automation.TestPlanFailureScenarioDTO;
|
||||||
import io.metersphere.base.domain.IssuesDao;
|
import io.metersphere.base.domain.IssuesDao;
|
||||||
import io.metersphere.base.domain.TestPlanReportContent;
|
import io.metersphere.base.domain.TestPlanReportContent;
|
||||||
|
import io.metersphere.dto.TestPlanUiScenarioDTO;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@ -43,14 +44,19 @@ public class TestPlanSimpleReportDTO extends TestPlanReportContent {
|
||||||
|
|
||||||
List<TestPlanCaseDTO> functionAllCases;
|
List<TestPlanCaseDTO> functionAllCases;
|
||||||
List<IssuesDao> issueList;
|
List<IssuesDao> issueList;
|
||||||
List<TestPlanFailureApiDTO> apiFailureCases;
|
|
||||||
List<TestPlanFailureApiDTO> apiAllCases;
|
|
||||||
List<TestPlanFailureScenarioDTO> scenarioFailureCases;
|
|
||||||
List<TestPlanFailureScenarioDTO> scenarioAllCases;
|
|
||||||
List<TestPlanLoadCaseDTO> loadAllCases;
|
List<TestPlanLoadCaseDTO> loadAllCases;
|
||||||
List<TestPlanLoadCaseDTO> loadFailureCases;
|
List<TestPlanLoadCaseDTO> loadFailureCases;
|
||||||
|
|
||||||
|
List<TestPlanFailureApiDTO> apiAllCases;
|
||||||
List<TestPlanFailureApiDTO> errorReportCases;
|
List<TestPlanFailureApiDTO> errorReportCases;
|
||||||
List<TestPlanFailureScenarioDTO> errorReportScenarios;
|
List<TestPlanFailureApiDTO> apiFailureCases;
|
||||||
List<TestPlanFailureApiDTO> unExecuteCases;
|
List<TestPlanFailureApiDTO> unExecuteCases;
|
||||||
|
|
||||||
|
List<TestPlanFailureScenarioDTO> scenarioAllCases;
|
||||||
|
List<TestPlanFailureScenarioDTO> errorReportScenarios;
|
||||||
|
List<TestPlanFailureScenarioDTO> scenarioFailureCases;
|
||||||
List<TestPlanFailureScenarioDTO> unExecuteScenarios;
|
List<TestPlanFailureScenarioDTO> unExecuteScenarios;
|
||||||
|
|
||||||
|
List<TestPlanUiScenarioDTO> uiAllCases;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ import io.metersphere.commons.utils.*;
|
||||||
import io.metersphere.constants.RunModeConstants;
|
import io.metersphere.constants.RunModeConstants;
|
||||||
import io.metersphere.dto.RunModeConfigDTO;
|
import io.metersphere.dto.RunModeConfigDTO;
|
||||||
import io.metersphere.dto.TestPlanExecuteReportDTO;
|
import io.metersphere.dto.TestPlanExecuteReportDTO;
|
||||||
import io.metersphere.dto.TestPlanFailureUiScenarioDTO;
|
import io.metersphere.dto.TestPlanUiScenarioDTO;
|
||||||
import io.metersphere.i18n.Translator;
|
import io.metersphere.i18n.Translator;
|
||||||
import io.metersphere.log.vo.OperatingLogDetails;
|
import io.metersphere.log.vo.OperatingLogDetails;
|
||||||
import io.metersphere.service.EnvironmentGroupProjectService;
|
import io.metersphere.service.EnvironmentGroupProjectService;
|
||||||
|
@ -1104,9 +1104,9 @@ public class TestPlanReportService {
|
||||||
content.setPlanLoadCaseReportStruct(JSONObject.toJSONString(loadCaseReportIdMap));
|
content.setPlanLoadCaseReportStruct(JSONObject.toJSONString(loadCaseReportIdMap));
|
||||||
}
|
}
|
||||||
if (MapUtils.isNotEmpty(uiScenarioReportMap)) {
|
if (MapUtils.isNotEmpty(uiScenarioReportMap)) {
|
||||||
List<TestPlanFailureUiScenarioDTO> uiScenarios =
|
List<TestPlanUiScenarioDTO> uiScenarios =
|
||||||
extTestPlanUiScenarioCaseMapper.getFailureListByIds(uiScenarioReportMap.keySet(), null);
|
extTestPlanUiScenarioCaseMapper.getFailureListByIds(uiScenarioReportMap.keySet(), null);
|
||||||
for (TestPlanFailureUiScenarioDTO dto : uiScenarios) {
|
for (TestPlanUiScenarioDTO dto : uiScenarios) {
|
||||||
dto.setReportId(uiScenarioReportMap.get(dto.getId()));
|
dto.setReportId(uiScenarioReportMap.get(dto.getId()));
|
||||||
}
|
}
|
||||||
content.setPlanUiScenarioReportStruct(JSONObject.toJSONString(uiScenarios));
|
content.setPlanUiScenarioReportStruct(JSONObject.toJSONString(uiScenarios));
|
||||||
|
|
|
@ -504,19 +504,6 @@ public class TestPlanScenarioCaseService {
|
||||||
calculatePlanReport(report, planReportCaseDTOS);
|
calculatePlanReport(report, planReportCaseDTOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void calculatePlanReportByScenarioList(List<TestPlanFailureScenarioDTO> scenarioList, TestPlanSimpleReportDTO report) {
|
|
||||||
List<PlanReportCaseDTO> planReportCaseDTOS = new ArrayList<>();
|
|
||||||
for (TestPlanFailureScenarioDTO scenario : scenarioList) {
|
|
||||||
PlanReportCaseDTO dto = new PlanReportCaseDTO();
|
|
||||||
dto.setCaseId(scenario.getCaseId());
|
|
||||||
dto.setId(scenario.getId());
|
|
||||||
dto.setStatus(scenario.getStatus());
|
|
||||||
dto.setReportId(scenario.getReportId());
|
|
||||||
planReportCaseDTOS.add(dto);
|
|
||||||
}
|
|
||||||
calculatePlanReport(report, planReportCaseDTOS);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void calculatePlanReport(TestPlanSimpleReportDTO report, List<PlanReportCaseDTO> planReportCaseDTOS) {
|
private void calculatePlanReport(TestPlanSimpleReportDTO report, List<PlanReportCaseDTO> planReportCaseDTOS) {
|
||||||
TestPlanApiResultReportDTO apiResult = report.getApiResult();
|
TestPlanApiResultReportDTO apiResult = report.getApiResult();
|
||||||
|
|
||||||
|
|
|
@ -1364,15 +1364,11 @@ public class TestPlanService {
|
||||||
List<TestPlanCaseDTO> allCases = null;
|
List<TestPlanCaseDTO> allCases = null;
|
||||||
List<String> statusList = getFunctionalReportStatusList(config);
|
List<String> statusList = getFunctionalReportStatusList(config);
|
||||||
if (statusList != null) {
|
if (statusList != null) {
|
||||||
|
// 不等于null,说明配置了用例,根据配置的状态查询用例
|
||||||
allCases = testPlanTestCaseService.getAllCasesByStatusList(planId, statusList);
|
allCases = testPlanTestCaseService.getAllCasesByStatusList(planId, statusList);
|
||||||
report.setFunctionAllCases(allCases);
|
report.setFunctionAllCases(allCases);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkReportConfig(config, "functional", "all")) {
|
|
||||||
allCases = testPlanTestCaseService.getAllCases(planId);
|
|
||||||
report.setFunctionAllCases(allCases);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (checkReportConfig(config, "functional", "issue")) {
|
if (checkReportConfig(config, "functional", "issue")) {
|
||||||
List<IssuesDao> issueList = issuesService.getIssuesByPlanId(planId);
|
List<IssuesDao> issueList = issuesService.getIssuesByPlanId(planId);
|
||||||
report.setIssueList(issueList);
|
report.setIssueList(issueList);
|
||||||
|
@ -1380,6 +1376,28 @@ public class TestPlanService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void buildUiReport(TestPlanSimpleReportDTO report, JSONObject config, String planId, boolean saveResponse) {
|
||||||
|
if (checkReportConfig(config, "ui")) {
|
||||||
|
List<TestPlanUiScenarioDTO> allCases;
|
||||||
|
List<String> statusList = getUiReportStatusList(config);
|
||||||
|
if (statusList != null) {
|
||||||
|
// 不等于null,说明配置了用例,根据配置的状态查询用例
|
||||||
|
allCases = testPlanUiScenarioCaseService.getAllCasesByStatusList(planId, statusList);
|
||||||
|
report.setUiAllCases(allCases);
|
||||||
|
if (saveResponse) {
|
||||||
|
buildUiScenarioResponse(allCases);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 如果配置了全部用例返回空的数组
|
||||||
|
* 如果没有,则添加对应的状态
|
||||||
|
* 都没配置就返回 null
|
||||||
|
* @param config
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public List<String> getFunctionalReportStatusList(JSONObject config) {
|
public List<String> getFunctionalReportStatusList(JSONObject config) {
|
||||||
List<String> statusList = new ArrayList<>();
|
List<String> statusList = new ArrayList<>();
|
||||||
if (checkReportConfig(config, "functional", "all")) {
|
if (checkReportConfig(config, "functional", "all")) {
|
||||||
|
@ -1397,6 +1415,20 @@ public class TestPlanService {
|
||||||
return statusList.size() > 0 ? statusList : null;
|
return statusList.size() > 0 ? statusList : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getUiReportStatusList(JSONObject config) {
|
||||||
|
List<String> statusList = new ArrayList<>();
|
||||||
|
if (checkReportConfig(config, "ui", "all")) {
|
||||||
|
return statusList;
|
||||||
|
}
|
||||||
|
if (checkReportConfig(config, "ui", "failure")) {
|
||||||
|
statusList.add(TestPlanUiResultStatus.Error.name());
|
||||||
|
}
|
||||||
|
if (checkReportConfig(config, "ui", "unExecute")) {
|
||||||
|
statusList.add(TestPlanUiResultStatus.UnExecute.name());
|
||||||
|
}
|
||||||
|
return statusList.size() > 0 ? statusList : null;
|
||||||
|
}
|
||||||
|
|
||||||
public void buildApiReport(TestPlanSimpleReportDTO report, JSONObject config, String planId, boolean saveResponse) {
|
public void buildApiReport(TestPlanSimpleReportDTO report, JSONObject config, String planId, boolean saveResponse) {
|
||||||
if (checkReportConfig(config, "api")) {
|
if (checkReportConfig(config, "api")) {
|
||||||
List<TestPlanFailureApiDTO> apiAllCases = null;
|
List<TestPlanFailureApiDTO> apiAllCases = null;
|
||||||
|
@ -1474,6 +1506,14 @@ public class TestPlanService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void buildUiScenarioResponse(List<TestPlanUiScenarioDTO> cases) {
|
||||||
|
if (!CollectionUtils.isEmpty(cases)) {
|
||||||
|
cases.forEach((item) -> {
|
||||||
|
item.setResponse(apiScenarioReportService.get(item.getReportId(), true));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void buildLoadResponse(List<TestPlanLoadCaseDTO> cases) {
|
public void buildLoadResponse(List<TestPlanLoadCaseDTO> cases) {
|
||||||
if (!CollectionUtils.isEmpty(cases)) {
|
if (!CollectionUtils.isEmpty(cases)) {
|
||||||
cases.forEach(item -> {
|
cases.forEach(item -> {
|
||||||
|
@ -1792,6 +1832,7 @@ public class TestPlanService {
|
||||||
buildFunctionalReport(report, config, planId);
|
buildFunctionalReport(report, config, planId);
|
||||||
buildApiReport(report, config, planId, saveResponse);
|
buildApiReport(report, config, planId, saveResponse);
|
||||||
buildLoadReport(report, config, planId, saveResponse);
|
buildLoadReport(report, config, planId, saveResponse);
|
||||||
|
buildUiReport(report, config, planId, saveResponse);
|
||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1817,21 +1858,27 @@ public class TestPlanService {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
JSONObject configItem = config.getJSONObject(key);
|
JSONObject configItem = config.getJSONObject(key);
|
||||||
|
if (configItem == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return configItem.getBoolean("enable");
|
return configItem.getBoolean("enable");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean checkReportConfig(JSONObject config, String key, String subKey) {
|
public Boolean checkReportConfig(JSONObject config, String key, String subKey) {
|
||||||
if (config == null) {
|
if (config == null || config.getJSONObject(key) == null) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
JSONObject configItem = config.getJSONObject(key);
|
JSONObject configItem = config.getJSONObject(key);
|
||||||
Boolean enable = configItem.getBoolean("enable");
|
Boolean enable = configItem.getBoolean("enable");
|
||||||
if (!enable) {
|
if (enable) {
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
JSONObject subConfig = configItem.getJSONObject("children").getJSONObject(subKey);
|
JSONObject subConfig = configItem.getJSONObject("children").getJSONObject(subKey);
|
||||||
return subConfig == null ? true : subConfig.getBoolean("enable");
|
if (subConfig == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return subConfig.getBoolean("enable");
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -451,19 +451,6 @@ public class TestPlanUiScenarioCaseService {
|
||||||
calculatePlanReport(report, planReportCaseDTOS);
|
calculatePlanReport(report, planReportCaseDTOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void calculatePlanReportByScenarioList(List<TestPlanFailureUiScenarioDTO> scenarioList,TestPlanSimpleReportDTO report){
|
|
||||||
List<PlanReportCaseDTO> planReportCaseDTOS = new ArrayList<>();
|
|
||||||
for (TestPlanFailureUiScenarioDTO scenario : scenarioList) {
|
|
||||||
PlanReportCaseDTO dto = new PlanReportCaseDTO();
|
|
||||||
dto.setCaseId(scenario.getCaseId());
|
|
||||||
dto.setId(scenario.getId());
|
|
||||||
dto.setStatus(scenario.getStatus());
|
|
||||||
dto.setReportId(scenario.getReportId());
|
|
||||||
planReportCaseDTOS.add(dto);
|
|
||||||
}
|
|
||||||
calculatePlanReport(report, planReportCaseDTOS);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void calculatePlanReport(TestPlanSimpleReportDTO report, List<PlanReportCaseDTO> planReportCaseDTOS) {
|
private void calculatePlanReport(TestPlanSimpleReportDTO report, List<PlanReportCaseDTO> planReportCaseDTOS) {
|
||||||
TestPlanUiResultReportDTO uiResult = report.getUiResult();
|
TestPlanUiResultReportDTO uiResult = report.getUiResult();
|
||||||
|
|
||||||
|
@ -524,18 +511,18 @@ public class TestPlanUiScenarioCaseService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TestPlanFailureUiScenarioDTO> getAllCases(String planId) {
|
public List<TestPlanUiScenarioDTO> getAllCasesByStatusList(String planId, List<String> statusList) {
|
||||||
List<TestPlanFailureUiScenarioDTO> apiTestCases =
|
List<TestPlanUiScenarioDTO> uiTestCases =
|
||||||
extTestPlanUiScenarioCaseMapper.getFailureList(planId, null);
|
extTestPlanUiScenarioCaseMapper.getPlanUiScenarioByStatusList(planId, statusList);
|
||||||
return buildCases(apiTestCases);
|
return buildCases(uiTestCases);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TestPlanFailureUiScenarioDTO> getAllCases(Map<String, String> idMap, Map<String, TestPlanFailureUiScenarioDTO> scenarioInfoDTOMap) {
|
public List<TestPlanUiScenarioDTO> getAllCases(Map<String, String> idMap, Map<String, TestPlanUiScenarioDTO> scenarioInfoDTOMap) {
|
||||||
String defaultStatus = "Fail";
|
String defaultStatus = "Fail";
|
||||||
Map<String, String> reportStatus = apiScenarioReportService.getReportStatusByReportIds(idMap.values());
|
Map<String, String> reportStatus = apiScenarioReportService.getReportStatusByReportIds(idMap.values());
|
||||||
Map<String, String> savedReportMap = new HashMap<>(idMap);
|
Map<String, String> savedReportMap = new HashMap<>(idMap);
|
||||||
List<TestPlanFailureUiScenarioDTO> apiTestCases = new ArrayList<>();
|
List<TestPlanUiScenarioDTO> apiTestCases = new ArrayList<>();
|
||||||
for (TestPlanFailureUiScenarioDTO dto : scenarioInfoDTOMap.values()) {
|
for (TestPlanUiScenarioDTO dto : scenarioInfoDTOMap.values()) {
|
||||||
String reportId = savedReportMap.get(dto.getId());
|
String reportId = savedReportMap.get(dto.getId());
|
||||||
savedReportMap.remove(dto.getId());
|
savedReportMap.remove(dto.getId());
|
||||||
dto.setReportId(reportId);
|
dto.setReportId(reportId);
|
||||||
|
@ -556,13 +543,7 @@ public class TestPlanUiScenarioCaseService {
|
||||||
return buildCases(apiTestCases);
|
return buildCases(apiTestCases);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TestPlanFailureUiScenarioDTO> getFailureCases(String planId) {
|
public List<TestPlanUiScenarioDTO> buildCases(List<TestPlanUiScenarioDTO> apiTestCases) {
|
||||||
List<TestPlanFailureUiScenarioDTO> apiTestCases =
|
|
||||||
extTestPlanUiScenarioCaseMapper.getFailureList(planId, "Fail");
|
|
||||||
return buildCases(apiTestCases);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<TestPlanFailureUiScenarioDTO> buildCases(List<TestPlanFailureUiScenarioDTO> apiTestCases) {
|
|
||||||
if (CollectionUtils.isEmpty(apiTestCases)) {
|
if (CollectionUtils.isEmpty(apiTestCases)) {
|
||||||
return apiTestCases;
|
return apiTestCases;
|
||||||
}
|
}
|
||||||
|
@ -603,16 +584,4 @@ public class TestPlanUiScenarioCaseService {
|
||||||
extTestPlanUiScenarioCaseMapper::getLastOrder,
|
extTestPlanUiScenarioCaseMapper::getLastOrder,
|
||||||
testPlanUiScenarioMapper::updateByPrimaryKeySelective);
|
testPlanUiScenarioMapper::updateByPrimaryKeySelective);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TestPlanFailureUiScenarioDTO> getErrorReportCases(String planId) {
|
|
||||||
List<TestPlanFailureUiScenarioDTO> apiTestCases =
|
|
||||||
extTestPlanUiScenarioCaseMapper.getFailureList(planId, ExecuteResult.ERROR_REPORT_RESULT.toString());
|
|
||||||
return buildCases(apiTestCases);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<TestPlanFailureUiScenarioDTO> getUnExecuteCases(String planId) {
|
|
||||||
List<TestPlanFailureUiScenarioDTO> apiTestCases =
|
|
||||||
extTestPlanUiScenarioCaseMapper.getFailureList(planId, "unExecute");
|
|
||||||
return buildCases(apiTestCases);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,34 +8,31 @@
|
||||||
<template v-slot:label>
|
<template v-slot:label>
|
||||||
<tab-pane-count :title="$t('test_track.report.fail_case')" :count="failureSize"/>
|
<tab-pane-count :title="$t('test_track.report.fail_case')" :count="failureSize"/>
|
||||||
</template>
|
</template>
|
||||||
<api-cases :is-db="isDb" :share-id="shareId" :is-share="isShare" :report="report" :is-template="isTemplate"
|
<ui-scenario-result :is-db="isDb" :share-id="shareId" :is-share="isShare"
|
||||||
:plan-id="planId" @setSize="setFailureSize" :is-ui="true"/>
|
:report="report" :is-template="isTemplate" :plan-id="planId"
|
||||||
<el-button class="rerun-button" plain size="mini" v-if="showRerunBtn && (failureSize > 0 || unExecuteSize > 0) && isRerun" @click="rerun">
|
:ui-all-cases="uiAllCases"
|
||||||
{{ $t('api_test.automation.rerun') }}
|
:filter-status="['Error']"
|
||||||
</el-button>
|
@setSize="setFailureSize"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane style="min-height: 500px" name="fourth" v-if="unExecuteEnable">
|
<el-tab-pane style="min-height: 500px" name="third" v-if="unExecuteEnable">
|
||||||
<template v-slot:label>
|
<template v-slot:label>
|
||||||
<tab-pane-count :title="$t('api_test.home_page.detail_card.unexecute')" :count="unExecuteSize"/>
|
<tab-pane-count :title="$t('api_test.home_page.detail_card.unexecute')" :count="unExecuteSize"/>
|
||||||
</template>
|
</template>
|
||||||
<api-cases :is-db="isDb" :is-un-execute="true" :share-id="shareId" :is-share="isShare" :report="report"
|
<ui-scenario-result :is-db="isDb" :share-id="shareId" :is-share="isShare"
|
||||||
:is-template="isTemplate" :plan-id="planId" @setSize="setUnExecuteSize" :is-ui="true"/>
|
:report="report" :is-template="isTemplate" :plan-id="planId"
|
||||||
|
:ui-all-cases="uiAllCases"
|
||||||
<el-button class="rerun-button" plain size="mini" v-if="showRerunBtn && (failureSize > 0 || unExecuteSize > 0) && isRerun" @click="rerun">
|
:filter-status="['UnExecute']"
|
||||||
{{ $t('api_test.automation.rerun') }}
|
@setSize="setUnExecuteSize"/>
|
||||||
</el-button>
|
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
||||||
<el-tab-pane style="min-height: 500px" name="fifth" v-if="allEnable">
|
<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>
|
||||||
<api-cases :is-db="isDb" :is-all="true" :share-id="shareId" :is-share="isShare" :report="report"
|
<ui-scenario-result :is-db="isDb" :share-id="shareId" :is-share="isShare"
|
||||||
:is-template="isTemplate" :plan-id="planId" @setSize="setAllSize" :is-ui="true"/>
|
:report="report" :is-template="isTemplate" :plan-id="planId"
|
||||||
<el-button class="rerun-button" plain size="mini" v-if="showRerunBtn && (failureSize > 0 || unExecuteSize > 0) && isRerun" @click="rerun">
|
:ui-all-cases="uiAllCases"
|
||||||
{{ $t('api_test.automation.rerun') }}
|
@setSize="setAllSize"/>
|
||||||
</el-button>
|
|
||||||
|
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</test-plan-report-container>
|
</test-plan-report-container>
|
||||||
|
@ -46,26 +43,26 @@ import MsFormDivider from "@/business/components/common/components/MsFormDivider
|
||||||
import UiResult from "@/business/components/track/plan/view/comonents/report/detail/component/UiResult";
|
import UiResult from "@/business/components/track/plan/view/comonents/report/detail/component/UiResult";
|
||||||
import TestPlanReportContainer
|
import TestPlanReportContainer
|
||||||
from "@/business/components/track/plan/view/comonents/report/detail/TestPlanReportContainer";
|
from "@/business/components/track/plan/view/comonents/report/detail/TestPlanReportContainer";
|
||||||
import ApiCases from "@/business/components/track/plan/view/comonents/report/detail/component/ApiCases";
|
|
||||||
import TabPaneCount from "@/business/components/track/plan/view/comonents/report/detail/component/TabPaneCount";
|
import TabPaneCount from "@/business/components/track/plan/view/comonents/report/detail/component/TabPaneCount";
|
||||||
import {hasLicense} from "@/common/js/utils";
|
import {hasLicense} from "@/common/js/utils";
|
||||||
|
import {
|
||||||
|
getPlanUiScenarioAllCase,
|
||||||
|
getSharePlanUiScenarioAllCase,
|
||||||
|
} from "@/network/test-plan";
|
||||||
|
import UiScenarioResult from "@/business/components/track/plan/view/comonents/report/detail/component/UiScenarioResult";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TestPlanUiReport",
|
name: "TestPlanUiReport",
|
||||||
components: {TabPaneCount, ApiCases, TestPlanReportContainer, UiResult, MsFormDivider},
|
components: {UiScenarioResult, TabPaneCount, TestPlanReportContainer, UiResult, MsFormDivider},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
activeName: 'first',
|
activeName: 'first',
|
||||||
failureSize: 0,
|
failureSize: 0,
|
||||||
errorReportSize: 0,
|
|
||||||
unExecuteSize: 0,
|
unExecuteSize: 0,
|
||||||
allSize: 0,
|
allSize: 0,
|
||||||
showRerunBtn: false,
|
uiAllCases: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
|
||||||
// this.showRerunBtn = !this.isShare && hasLicense();
|
|
||||||
},
|
|
||||||
props: [
|
props: [
|
||||||
'report', 'planId', 'isTemplate', 'isShare', 'shareId', 'isDb'
|
'report', 'planId', 'isTemplate', 'isShare', 'shareId', 'isDb'
|
||||||
],
|
],
|
||||||
|
@ -78,10 +75,6 @@ export default {
|
||||||
let disable = this.report.config && this.report.config.ui.children.failure.enable === false;
|
let disable = this.report.config && this.report.config.ui.children.failure.enable === false;
|
||||||
return !disable;
|
return !disable;
|
||||||
},
|
},
|
||||||
errorReportEnable() {
|
|
||||||
let disable = this.report.config && this.report.config.ui.children.errorReport && this.report.config.ui.children.errorReport.enable === false;
|
|
||||||
return !disable;
|
|
||||||
},
|
|
||||||
unExecuteEnable() {
|
unExecuteEnable() {
|
||||||
let disable = this.report.config && this.report.config.ui.children.unExecute && this.report.config.ui.children.unExecute.enable === false;
|
let disable = this.report.config && this.report.config.ui.children.unExecute && this.report.config.ui.children.unExecute.enable === false;
|
||||||
return !disable;
|
return !disable;
|
||||||
|
@ -89,13 +82,6 @@ export default {
|
||||||
allEnable() {
|
allEnable() {
|
||||||
let disable = this.report.config && this.report.config.ui.children.all.enable === false;
|
let disable = this.report.config && this.report.config.ui.children.all.enable === false;
|
||||||
return !disable;
|
return !disable;
|
||||||
},
|
|
||||||
isRerun() {
|
|
||||||
return ((this.report && this.report.apiFailureCases)
|
|
||||||
|| (this.report && this.report.unExecuteCases)
|
|
||||||
|| (this.report && this.report.scenarioFailureCases)
|
|
||||||
|| (this.report && this.report.unExecuteScenarios)
|
|
||||||
|| (this.report && this.report.loadFailureCases));
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -105,15 +91,16 @@ export default {
|
||||||
failureEnable() {
|
failureEnable() {
|
||||||
this.initActiveName();
|
this.initActiveName();
|
||||||
},
|
},
|
||||||
errorReportEnable() {
|
|
||||||
this.initActiveName();
|
|
||||||
},
|
|
||||||
allEnable() {
|
allEnable() {
|
||||||
this.initActiveName();
|
this.initActiveName();
|
||||||
},
|
},
|
||||||
|
'report.config'() {
|
||||||
|
this.getAllUiCase();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initActiveName();
|
this.initActiveName();
|
||||||
|
this.getAllUiCase();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initActiveName() {
|
initActiveName() {
|
||||||
|
@ -121,18 +108,13 @@ export default {
|
||||||
this.activeName = 'first';
|
this.activeName = 'first';
|
||||||
} else if (this.failureEnable) {
|
} else if (this.failureEnable) {
|
||||||
this.activeName = 'second';
|
this.activeName = 'second';
|
||||||
} else if (this.errorReportEnable) {
|
|
||||||
this.activeName = 'third';
|
|
||||||
} else if (this.allEnable) {
|
} else if (this.allEnable) {
|
||||||
this.activeName = 'fourth';
|
this.activeName = 'third';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setFailureSize(size) {
|
setFailureSize(size) {
|
||||||
this.failureSize = size;
|
this.failureSize = size;
|
||||||
},
|
},
|
||||||
setErrorReportSize(size) {
|
|
||||||
this.errorReportSize = size;
|
|
||||||
},
|
|
||||||
setUnExecuteSize(size) {
|
setUnExecuteSize(size) {
|
||||||
this.unExecuteSize = size;
|
this.unExecuteSize = size;
|
||||||
},
|
},
|
||||||
|
@ -141,66 +123,41 @@ export default {
|
||||||
},
|
},
|
||||||
handleClick(tab, event) {
|
handleClick(tab, event) {
|
||||||
},
|
},
|
||||||
rerun() {
|
getAllUiCase() {
|
||||||
let type = "TEST_PLAN";
|
if (this.isTemplate || this.isDb) {
|
||||||
let scenarios = [];
|
this.uiAllCases = this.report.uiAllCases ? this.report.uiAllCases : [];
|
||||||
let cases = [];
|
} else if (this.isShare) {
|
||||||
let performanceCases = [];
|
let param = this.getStatusList();
|
||||||
let rerunObj = {
|
if (param) {
|
||||||
type: type,
|
getSharePlanUiScenarioAllCase(this.shareId, this.planId, param, (data) => {
|
||||||
reportId: this.report.id,
|
this.uiAllCases = data;
|
||||||
scenarios: scenarios,
|
});
|
||||||
cases: cases,
|
}
|
||||||
performanceCases: performanceCases
|
} else {
|
||||||
}
|
let param = this.getStatusList();
|
||||||
// 获取需要重跑的用例
|
if (param) {
|
||||||
if (this.report && this.report.apiFailureCases) {
|
this.result = getPlanUiScenarioAllCase(this.planId, param, (data) => {
|
||||||
this.format(cases, this.report.apiFailureCases);
|
this.uiAllCases = data;
|
||||||
}
|
});
|
||||||
if (this.report && this.report.unExecuteCases) {
|
|
||||||
this.format(cases, this.report.unExecuteCases);
|
|
||||||
}
|
|
||||||
// 获取需要重跑的场景
|
|
||||||
if (this.report && this.report.scenarioFailureCases) {
|
|
||||||
this.format(scenarios, this.report.scenarioFailureCases);
|
|
||||||
}
|
|
||||||
if (this.report && this.report.unExecuteScenarios) {
|
|
||||||
this.format(scenarios, this.report.unExecuteScenarios);
|
|
||||||
}
|
|
||||||
// 获取需要重跑的性能用例
|
|
||||||
if (this.report && this.report.loadFailureCases) {
|
|
||||||
this.format(performanceCases, this.report.loadFailureCases);
|
|
||||||
}
|
|
||||||
this.$post('/ui/test/exec/rerun', rerunObj, res => {
|
|
||||||
if (res.data !== 'SUCCESS') {
|
|
||||||
this.$error(res.data);
|
|
||||||
} else {
|
|
||||||
this.$success(this.$t('api_test.automation.rerun_success'));
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
},
|
|
||||||
format(cases, datas) {
|
|
||||||
if (this.report && datas) {
|
|
||||||
datas.forEach(item => {
|
|
||||||
if (item) {
|
|
||||||
let obj = {id: item.id, reportId: item.reportId, userId: item.createUser};
|
|
||||||
cases.push(obj);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
getStatusList() {
|
||||||
|
let statusList = [];
|
||||||
|
if (this.allEnable) {
|
||||||
|
return statusList;
|
||||||
|
}
|
||||||
|
if (this.failureEnable) {
|
||||||
|
statusList.push('Error');
|
||||||
|
}
|
||||||
|
if (this.unExecuteEnable) {
|
||||||
|
statusList.push('UnExecute');
|
||||||
|
}
|
||||||
|
return statusList.length > 0 ? statusList : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.rerun-button {
|
|
||||||
position: absolute;
|
|
||||||
top: 10px;
|
|
||||||
right: 10px;
|
|
||||||
margin-right: 10px;
|
|
||||||
z-index: 1100;
|
|
||||||
background-color: #F2F9EF;
|
|
||||||
color: #87C45D;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-tabs type="card">
|
<el-tabs type="card">
|
||||||
<el-tab-pane v-if="!isUi">
|
<el-tab-pane>
|
||||||
<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>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
<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-ui="isUi" :is-db="isDb" :is-all="isAll" :is-error-report="isErrorReport" :is-un-execute="isUnExecute" :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>
|
||||||
|
@ -48,7 +48,6 @@ export default {
|
||||||
isErrorReport: Boolean,
|
isErrorReport: Boolean,
|
||||||
isUnExecute:Boolean,
|
isUnExecute:Boolean,
|
||||||
isDb: Boolean,
|
isDb: Boolean,
|
||||||
isUi: Boolean,
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -85,15 +85,7 @@ import {
|
||||||
getPlanScenarioErrorReportCase,
|
getPlanScenarioErrorReportCase,
|
||||||
getSharePlanScenarioErrorReportCase,
|
getSharePlanScenarioErrorReportCase,
|
||||||
getPlanScenarioUnExecuteCase,
|
getPlanScenarioUnExecuteCase,
|
||||||
getSharePlanScenarioUnExecuteCase,
|
getSharePlanScenarioUnExecuteCase
|
||||||
getPlanUiScenarioErrorReportCase,
|
|
||||||
getPlanUiScenarioFailureCase,
|
|
||||||
getPlanUiScenarioUnExecuteCase,
|
|
||||||
getPlanUiScenarioAllCase,
|
|
||||||
getSharePlanUiScenarioAllCase,
|
|
||||||
getSharePlanUiScenarioUnExecuteCase,
|
|
||||||
getSharePlanUiScenarioErrorReportCase,
|
|
||||||
getSharePlanUiScenarioFailureCase,
|
|
||||||
} 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";
|
||||||
|
@ -119,7 +111,6 @@ export default {
|
||||||
isErrorReport: Boolean,
|
isErrorReport: Boolean,
|
||||||
isUnExecute: Boolean,
|
isUnExecute: Boolean,
|
||||||
isDb: Boolean,
|
isDb: Boolean,
|
||||||
isUi: Boolean,
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -152,7 +143,7 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
this.scenarioCases = this.report.scenarioFailureCases ? this.report.scenarioFailureCases : [];
|
this.scenarioCases = this.report.scenarioFailureCases ? this.report.scenarioFailureCases : [];
|
||||||
}
|
}
|
||||||
} else if (this.isShare && !this.isUi) {
|
} 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;
|
||||||
|
@ -170,42 +161,6 @@ export default {
|
||||||
this.scenarioCases = data;
|
this.scenarioCases = data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (this.isShare && this.isUi) {
|
|
||||||
if (this.isErrorReport) {
|
|
||||||
this.result = getSharePlanUiScenarioErrorReportCase(this.shareId, this.planId, (data) => {
|
|
||||||
this.scenarioCases = data;
|
|
||||||
});
|
|
||||||
} else if (this.isUnExecute) {
|
|
||||||
this.result = getSharePlanUiScenarioUnExecuteCase(this.shareId, this.planId, (data) => {
|
|
||||||
this.scenarioCases = data;
|
|
||||||
});
|
|
||||||
} else if (this.isAll) {
|
|
||||||
this.result = getSharePlanUiScenarioAllCase(this.shareId, this.planId, (data) => {
|
|
||||||
this.scenarioCases = data;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.result = getSharePlanUiScenarioFailureCase(this.shareId, this.planId, (data) => {
|
|
||||||
this.scenarioCases = data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else if (this.isUi) {
|
|
||||||
if (this.isErrorReport) {
|
|
||||||
this.result = getPlanUiScenarioErrorReportCase(this.planId, (data) => {
|
|
||||||
this.scenarioCases = data;
|
|
||||||
});
|
|
||||||
} else if (this.isUnExecute) {
|
|
||||||
this.result = getPlanUiScenarioUnExecuteCase(this.planId, (data) => {
|
|
||||||
this.scenarioCases = data;
|
|
||||||
});
|
|
||||||
} else if (this.isAll) {
|
|
||||||
this.result = getPlanUiScenarioAllCase(this.planId, (data) => {
|
|
||||||
this.scenarioCases = data;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.result = getPlanUiScenarioFailureCase(this.planId, (data) => {
|
|
||||||
this.scenarioCases = data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (this.isErrorReport) {
|
if (this.isErrorReport) {
|
||||||
this.result = getPlanScenarioErrorReportCase(this.planId, (data) => {
|
this.result = getPlanScenarioErrorReportCase(this.planId, (data) => {
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
<ms-doughnut-pie-chart style="margin-right: 200px" :name="$t('api_test.home_page.ui_details_card.scenario_cases')" :data="caseCharData" ref="functionChar"/>
|
<ms-doughnut-pie-chart style="margin-right: 200px" :name="$t('api_test.home_page.ui_details_card.scenario_cases')" :data="caseCharData" ref="functionChar"/>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" v-if="scenarioCharData && scenarioCharData.length > 0">
|
<el-col :span="12" v-if="scenarioCharData && scenarioCharData.length > 0">
|
||||||
<!-- <api-scenario-char-result :name="$t('test_track.plan.test_plan_api_scenario_count')" :data="scenarioCharData"/>-->
|
|
||||||
<api-scenario-char-result style="margin-top: -50px;" :name="$t('api_test.home_page.ui_details_card.step_count')" :data="stepCharData"/>
|
<api-scenario-char-result style="margin-top: -50px;" :name="$t('api_test.home_page.ui_details_card.step_count')" :data="stepCharData"/>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
|
@ -0,0 +1,177 @@
|
||||||
|
<template>
|
||||||
|
<el-container class="scenario-info">
|
||||||
|
<ms-aside-container width="500px" :default-hidden-bottom-top="200" :enable-auto-height="true">
|
||||||
|
<el-card>
|
||||||
|
<el-scrollbar>
|
||||||
|
<ms-table v-loading="result.loading"
|
||||||
|
:show-select-all="false"
|
||||||
|
:screen-height="null"
|
||||||
|
:enable-selection="false"
|
||||||
|
:highlight-current-row="true"
|
||||||
|
@refresh="getScenarioApiCase"
|
||||||
|
@handleRowClick="rowClick"
|
||||||
|
:data="scenarioCases">
|
||||||
|
|
||||||
|
<ms-table-column
|
||||||
|
:width="80"
|
||||||
|
:label="$t('commons.id')"
|
||||||
|
prop="customNum">
|
||||||
|
</ms-table-column>
|
||||||
|
<ms-table-column
|
||||||
|
:label="$t('commons.name')"
|
||||||
|
prop="name">
|
||||||
|
</ms-table-column>
|
||||||
|
<ms-table-column
|
||||||
|
:label="$t('test_track.report.list.creator')"
|
||||||
|
prop="creatorName"/>
|
||||||
|
<ms-table-column
|
||||||
|
:label="$t('test_track.case.priority')"
|
||||||
|
:width="80">
|
||||||
|
<template v-slot:default="scope">
|
||||||
|
<priority-table-item :value="scope.row.level" ref="priority"/>
|
||||||
|
</template>
|
||||||
|
</ms-table-column>
|
||||||
|
<ms-table-column
|
||||||
|
:width="70"
|
||||||
|
:label="$t('api_test.automation.step')"
|
||||||
|
prop="stepTotal">
|
||||||
|
</ms-table-column>
|
||||||
|
<ms-table-column
|
||||||
|
:width="80"
|
||||||
|
:label="$t('test_track.plan_view.execute_result')"
|
||||||
|
prop="lastResult">
|
||||||
|
<template v-slot:default="{row}">
|
||||||
|
<status-table-item :value="resultMap[row.lastResult]"/>
|
||||||
|
</template>
|
||||||
|
</ms-table-column>
|
||||||
|
</ms-table>
|
||||||
|
</el-scrollbar>
|
||||||
|
</el-card>
|
||||||
|
</ms-aside-container>
|
||||||
|
<el-main>
|
||||||
|
<ms-api-report
|
||||||
|
v-if="showResponse"
|
||||||
|
:is-plan="true"
|
||||||
|
:share-id="shareId"
|
||||||
|
:is-share="isShare"
|
||||||
|
:template-report="response"
|
||||||
|
:is-template="isTemplate"
|
||||||
|
:infoDb="true"
|
||||||
|
:report-id="reportId"
|
||||||
|
@reportNotExist="showResponse = false"/>
|
||||||
|
<div class="empty" v-else>{{ $t('test_track.plan.load_case.content_empty') }}</div>
|
||||||
|
</el-main>
|
||||||
|
</el-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import PriorityTableItem from "../../../../../../common/tableItems/planview/PriorityTableItem";
|
||||||
|
import TypeTableItem from "../../../../../../common/tableItems/planview/TypeTableItem";
|
||||||
|
import MethodTableItem from "../../../../../../common/tableItems/planview/MethodTableItem";
|
||||||
|
import StatusTableItem from "../../../../../../common/tableItems/planview/StatusTableItem";
|
||||||
|
import MsTable from "@/business/components/common/components/table/MsTable";
|
||||||
|
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
|
||||||
|
import MsApiReport from "@/business/components/api/automation/report/ApiReportDetail";
|
||||||
|
import MsAsideContainer from "@/business/components/common/components/MsAsideContainer";
|
||||||
|
import MsMainContainer from "@/business/components/common/components/MsMainContainer";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "UiScenarioResult",
|
||||||
|
components: {
|
||||||
|
MsMainContainer,
|
||||||
|
MsAsideContainer,
|
||||||
|
MsApiReport,
|
||||||
|
MsTableColumn, MsTable, StatusTableItem, MethodTableItem, TypeTableItem, PriorityTableItem
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
planId: String,
|
||||||
|
isTemplate: Boolean,
|
||||||
|
report: Object,
|
||||||
|
isShare: Boolean,
|
||||||
|
shareId: String,
|
||||||
|
isAll: Boolean,
|
||||||
|
isErrorReport: Boolean,
|
||||||
|
isUnExecute: Boolean,
|
||||||
|
isDb: Boolean,
|
||||||
|
uiAllCases: Array,
|
||||||
|
filterStatus: Array,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
scenarioCases: [],
|
||||||
|
result: {},
|
||||||
|
reportId: null,
|
||||||
|
response: {},
|
||||||
|
showResponse: false,
|
||||||
|
resultMap: {
|
||||||
|
'Success' : 'Pass',
|
||||||
|
'Error' : 'Failure',
|
||||||
|
'STOP' : 'STOP',
|
||||||
|
'Running' : 'Running',
|
||||||
|
'UnExecute' : 'Prepare'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.getScenarioApiCase();
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
scenarioCases() {
|
||||||
|
if (this.scenarioCases) {
|
||||||
|
this.$emit('setSize', this.scenarioCases.length);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
uiAllCases() {
|
||||||
|
this.getScenarioApiCase();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getScenarioApiCase() {
|
||||||
|
this.scenarioCases = [];
|
||||||
|
if (this.filterStatus && this.filterStatus.length > 0) {
|
||||||
|
this.uiAllCases.forEach(item => {
|
||||||
|
if (this.filterStatus.indexOf(item.lastResult) > -1) {
|
||||||
|
this.scenarioCases.push(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.scenarioCases = this.uiAllCases;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rowClick(row) {
|
||||||
|
this.showResponse = false;
|
||||||
|
if (this.isTemplate) {
|
||||||
|
if (row.response) {
|
||||||
|
this.showResponse = true;
|
||||||
|
this.response = row.response;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (row.reportId && row.lastResult !== "Running" && row.lastResult !== "Waiting") {
|
||||||
|
this.showResponse = true;
|
||||||
|
this.reportId = row.reportId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
.padding-col {
|
||||||
|
padding-right: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-card >>> .el-card__body {
|
||||||
|
height: 588px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/deep/ .api-report-content {
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ms-aside-container {
|
||||||
|
border: 0px;
|
||||||
|
padding: 10px 0px 0px 10px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -94,19 +94,8 @@ export function getSharePlanScenarioUnExecuteCase(shareId, planId, callback) {
|
||||||
return planId ? baseGet('/share/test/plan/scenario/case/list/unExecute/' + shareId + '/' + planId, callback) : {};
|
return planId ? baseGet('/share/test/plan/scenario/case/list/unExecute/' + shareId + '/' + planId, callback) : {};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getSharePlanUiScenarioFailureCase(shareId, planId, callback) {
|
export function getSharePlanUiScenarioAllCase(shareId, planId, param, callback) {
|
||||||
return planId ? baseGet('/share/test/plan/uiScenario/case/list/failure/' + shareId + '/' + planId, callback) : {};
|
return planId ? basePost('/share/test/plan/uiScenario/case/list/all/' + shareId + '/' + planId, param, callback) : {};
|
||||||
}
|
|
||||||
|
|
||||||
export function getSharePlanUiScenarioAllCase(shareId, planId, callback) {
|
|
||||||
return planId ? baseGet('/share/test/plan/uiScenario/case/list/all/' + shareId + '/' + planId, callback) : {};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getSharePlanUiScenarioErrorReportCase(shareId, planId, callback) {
|
|
||||||
return planId ? baseGet('/share/test/plan/uiScenario/case/list/errorReport/' + shareId + '/' + planId, callback) : {};
|
|
||||||
}
|
|
||||||
export function getSharePlanUiScenarioUnExecuteCase(shareId, planId, callback) {
|
|
||||||
return planId ? baseGet('/share/test/plan/uiScenario/case/list/unExecute/' + shareId + '/' + planId, callback) : {};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getPlanApiFailureCase(planId, callback) {
|
export function getPlanApiFailureCase(planId, callback) {
|
||||||
|
@ -187,19 +176,6 @@ export function saveTestPlanReport(planId, callback) {
|
||||||
return planId ? baseGet('/test/plan/report/saveTestPlanReport/' + planId + '/MANUAL', callback) : {};
|
return planId ? baseGet('/test/plan/report/saveTestPlanReport/' + planId + '/MANUAL', callback) : {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getPlanUiScenarioAllCase(planId, param, callback) {
|
||||||
export function getPlanUiScenarioFailureCase(planId, callback) {
|
return planId ? basePost('/test/plan/uiScenario/case/list/all/' + planId, param, callback) : {};
|
||||||
return planId ? baseGet('/test/plan/uiScenario/case/list/failure/' + planId, callback) : {};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getPlanUiScenarioErrorReportCase(planId, callback) {
|
|
||||||
return planId ? baseGet('/test/plan/uiScenario/case/list/errorReport/' + planId, callback) : {};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getPlanUiScenarioUnExecuteCase(planId, callback) {
|
|
||||||
return planId ? baseGet('/test/plan/uiScenario/case/list/unExecute/' + planId, callback) : {};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getPlanUiScenarioAllCase(planId, callback) {
|
|
||||||
return planId ? baseGet('/test/plan/uiScenario/case/list/all/' + planId, callback) : {};
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue