parent
0919809099
commit
a0cdee29c1
|
@ -204,8 +204,16 @@ public class ApiDefinitionExecResultService {
|
|||
|
||||
for (RequestResult item : requestResults) {
|
||||
if (!StringUtils.startsWithAny(item.getName(), "PRE_PROCESSOR_ENV_", "POST_PROCESSOR_ENV_")) {
|
||||
this.save(item, dto.getReportId(), dto.getConsole(), countExpectProcessResultCount, dto.getRunMode(), dto.getTestId(), isFirst);
|
||||
ApiDefinitionExecResult reportResult = this.save(item, dto.getReportId(), dto.getConsole(), countExpectProcessResultCount, dto.getRunMode(), dto.getTestId(), isFirst);
|
||||
String status = item.isSuccess() ? "success" : "error";
|
||||
if(reportResult != null){
|
||||
status = reportResult.getStatus();
|
||||
}
|
||||
//对响应内容进行进一步解析。如果有附加信息(比如误报库信息),则根据附加信息内的数据进行其他判读
|
||||
RequestResultExpandDTO expandDTO = ResponseUtil.parseByRequestResult(item);
|
||||
if(MapUtils.isNotEmpty(expandDTO.getAttachInfoMap())){
|
||||
status = expandDTO.getStatus();
|
||||
}
|
||||
if (StringUtils.equalsAny(dto.getRunMode(), ApiRunMode.SCHEDULE_API_PLAN.name(), ApiRunMode.JENKINS_API_PLAN.name())) {
|
||||
TestPlanApiCase apiCase = testPlanApiCaseService.getById(dto.getTestId());
|
||||
if (apiCase != null) {
|
||||
|
|
|
@ -234,12 +234,18 @@ public class ApiScenarioReportService {
|
|||
|
||||
public ApiScenarioReport updatePlanCase(List<ApiScenarioReportResult> requestResults, ResultDTO dto) {
|
||||
long errorSize = requestResults.stream().filter(requestResult -> StringUtils.equalsIgnoreCase(requestResult.getStatus(), ScenarioStatus.Error.name())).count();
|
||||
String status = getStatus(requestResults, dto);
|
||||
ApiScenarioReport report = editReport(dto.getReportType(), dto.getReportId(), status, dto.getRunMode());
|
||||
TestPlanApiScenario testPlanApiScenario = testPlanApiScenarioMapper.selectByPrimaryKey(dto.getTestId());
|
||||
if (testPlanApiScenario != null) {
|
||||
if (errorSize > 0) {
|
||||
testPlanApiScenario.setLastResult(ScenarioStatus.Fail.name());
|
||||
} else {
|
||||
testPlanApiScenario.setLastResult(ScenarioStatus.Success.name());
|
||||
if(report != null){
|
||||
testPlanApiScenario.setLastResult(report.getStatus());
|
||||
}else {
|
||||
if (errorSize > 0) {
|
||||
testPlanApiScenario.setLastResult(ScenarioStatus.Fail.name());
|
||||
} else {
|
||||
testPlanApiScenario.setLastResult(ScenarioStatus.Success.name());
|
||||
}
|
||||
}
|
||||
long successSize = requestResults.stream().filter(requestResult -> StringUtils.equalsIgnoreCase(requestResult.getStatus(), ScenarioStatus.Success.name())).count();
|
||||
|
||||
|
@ -263,8 +269,7 @@ public class ApiScenarioReportService {
|
|||
apiScenarioMapper.updateByPrimaryKey(scenario);
|
||||
}
|
||||
}
|
||||
String status = getStatus(requestResults, dto);
|
||||
ApiScenarioReport report = editReport(dto.getReportType(), dto.getReportId(), status, dto.getRunMode());
|
||||
|
||||
return report;
|
||||
}
|
||||
|
||||
|
@ -284,11 +289,7 @@ public class ApiScenarioReportService {
|
|||
report.setScenarioId(testPlanApiScenario.getApiScenarioId());
|
||||
report.setEndTime(System.currentTimeMillis());
|
||||
apiScenarioReportMapper.updateByPrimaryKeySelective(report);
|
||||
if (errorSize > 0) {
|
||||
testPlanApiScenario.setLastResult(ScenarioStatus.Fail.name());
|
||||
} else {
|
||||
testPlanApiScenario.setLastResult(ScenarioStatus.Success.name());
|
||||
}
|
||||
testPlanApiScenario.setLastResult(report.getStatus());
|
||||
long successSize = requestResults.stream().filter(requestResult -> StringUtils.equalsIgnoreCase(requestResult.getStatus(), ScenarioStatus.Success.name())).count();
|
||||
String passRate = new DecimalFormat("0%").format((float) successSize / requestResults.size());
|
||||
testPlanApiScenario.setPassRate(passRate);
|
||||
|
|
|
@ -146,7 +146,6 @@ public class ApiScenarioReportStructureService {
|
|||
} else if (step.getValue().getError() > 0) {
|
||||
isError.set(isError.longValue() + 1);
|
||||
}
|
||||
break;
|
||||
} else if (CollectionUtils.isNotEmpty(step.getChildren())) {
|
||||
scenarioCalculate(step.getChildren(), isError, isErrorReport);
|
||||
}
|
||||
|
|
|
@ -43,5 +43,9 @@ public class TestPlanReportContentWithBLOBs extends TestPlanReportContent implem
|
|||
|
||||
private String planLoadCaseReportStruct;
|
||||
|
||||
private String errorReportCases;
|
||||
|
||||
private String errorReportScenarios;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -29,6 +29,8 @@
|
|||
<result column="plan_scenario_report_struct" jdbcType="LONGVARCHAR" property="planScenarioReportStruct" />
|
||||
<result column="plan_api_case_report_struct" jdbcType="LONGVARCHAR" property="planApiCaseReportStruct" />
|
||||
<result column="plan_load_case_report_struct" jdbcType="LONGVARCHAR" property="planLoadCaseReportStruct" />
|
||||
<result column="error_report_cases" jdbcType="LONGVARCHAR" property="errorReportCases" />
|
||||
<result column="error_report_scenarios" jdbcType="LONGVARCHAR" property="errorReportScenarios" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
|
@ -96,7 +98,7 @@
|
|||
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,
|
||||
load_all_Cases, load_failure_cases, plan_scenario_report_struct, plan_api_case_report_struct,
|
||||
plan_load_case_report_struct
|
||||
plan_load_case_report_struct, error_report_cases, error_report_scenarios
|
||||
</sql>
|
||||
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.TestPlanReportContentExample" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
|
@ -156,7 +158,8 @@
|
|||
scenario_all_cases, scenario_failure_cases,
|
||||
load_all_Cases, load_failure_cases,
|
||||
plan_scenario_report_struct, plan_api_case_report_struct,
|
||||
plan_load_case_report_struct)
|
||||
plan_load_case_report_struct, error_report_cases,
|
||||
error_report_scenarios)
|
||||
values (#{id,jdbcType=VARCHAR}, #{testPlanReportId,jdbcType=VARCHAR}, #{startTime,jdbcType=BIGINT},
|
||||
#{caseCount,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT}, #{executeRate,jdbcType=DOUBLE},
|
||||
#{passRate,jdbcType=DOUBLE}, #{isThirdPartIssue,jdbcType=BIT}, #{config,jdbcType=LONGVARCHAR},
|
||||
|
@ -166,7 +169,8 @@
|
|||
#{scenarioAllCases,jdbcType=LONGVARCHAR}, #{scenarioFailureCases,jdbcType=LONGVARCHAR},
|
||||
#{loadAllCases,jdbcType=LONGVARCHAR}, #{loadFailureCases,jdbcType=LONGVARCHAR},
|
||||
#{planScenarioReportStruct,jdbcType=LONGVARCHAR}, #{planApiCaseReportStruct,jdbcType=LONGVARCHAR},
|
||||
#{planLoadCaseReportStruct,jdbcType=LONGVARCHAR})
|
||||
#{planLoadCaseReportStruct,jdbcType=LONGVARCHAR}, #{errorReportCases,jdbcType=LONGVARCHAR},
|
||||
#{errorReportScenarios,jdbcType=LONGVARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlanReportContentWithBLOBs">
|
||||
insert into test_plan_report_content
|
||||
|
@ -246,6 +250,12 @@
|
|||
<if test="planLoadCaseReportStruct != null">
|
||||
plan_load_case_report_struct,
|
||||
</if>
|
||||
<if test="errorReportCases != null">
|
||||
error_report_cases,
|
||||
</if>
|
||||
<if test="errorReportScenarios != null">
|
||||
error_report_scenarios,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
|
@ -323,6 +333,12 @@
|
|||
<if test="planLoadCaseReportStruct != null">
|
||||
#{planLoadCaseReportStruct,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="errorReportCases != null">
|
||||
#{errorReportCases,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="errorReportScenarios != null">
|
||||
#{errorReportScenarios,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.metersphere.base.domain.TestPlanReportContentExample" resultType="java.lang.Long">
|
||||
|
@ -409,6 +425,12 @@
|
|||
<if test="record.planLoadCaseReportStruct != null">
|
||||
plan_load_case_report_struct = #{record.planLoadCaseReportStruct,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="record.errorReportCases != null">
|
||||
error_report_cases = #{record.errorReportCases,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="record.errorReportScenarios != null">
|
||||
error_report_scenarios = #{record.errorReportScenarios,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
|
@ -440,7 +462,9 @@
|
|||
load_failure_cases = #{record.loadFailureCases,jdbcType=LONGVARCHAR},
|
||||
plan_scenario_report_struct = #{record.planScenarioReportStruct,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_scenarios = #{record.errorReportScenarios,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -534,6 +558,12 @@
|
|||
<if test="planLoadCaseReportStruct != null">
|
||||
plan_load_case_report_struct = #{planLoadCaseReportStruct,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="errorReportCases != null">
|
||||
error_report_cases = #{errorReportCases,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="errorReportScenarios != null">
|
||||
error_report_scenarios = #{errorReportScenarios,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
@ -562,7 +592,9 @@
|
|||
load_failure_cases = #{loadFailureCases,jdbcType=LONGVARCHAR},
|
||||
plan_scenario_report_struct = #{planScenarioReportStruct,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_scenarios = #{errorReportScenarios,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestPlanReportContent">
|
||||
|
|
|
@ -321,7 +321,7 @@
|
|||
on t.api_case_id = c.id
|
||||
and t.test_plan_id = #{planId}
|
||||
<if test="status != null">
|
||||
and t.status = 'error'
|
||||
and t.status = #{status}
|
||||
</if>
|
||||
and (c.status != 'Trash' or c.status is null)
|
||||
where t.test_plan_id = #{planId};
|
||||
|
|
|
@ -214,7 +214,7 @@
|
|||
on t.api_scenario_id = c.id and (c.status != 'Trash' or c.status is null)
|
||||
and t.test_plan_id = #{planId}
|
||||
<if test="status != null">
|
||||
and t.last_result = 'Fail'
|
||||
and t.last_result = #{status}
|
||||
</if>
|
||||
where t.test_plan_id = #{planId}
|
||||
</select>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package io.metersphere.commons.utils;
|
||||
|
||||
import io.metersphere.commons.constants.ExecuteResult;
|
||||
import io.metersphere.commons.constants.TestPlanTestCaseStatus;
|
||||
import io.metersphere.track.dto.PlanReportCaseDTO;
|
||||
import io.metersphere.track.dto.TestCaseReportStatusResultDTO;
|
||||
|
@ -51,6 +52,7 @@ public class TestPlanUtils {
|
|||
addToReportStatusResultList(resultMap, statusResult, "Success");
|
||||
addToReportStatusResultList(resultMap, statusResult, "SUCCESS");
|
||||
addToReportStatusResultList(resultMap, statusResult, TestPlanTestCaseStatus.Prepare.name());
|
||||
addToReportStatusResultList(resultMap, statusResult, ExecuteResult.errorReportResult.name());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -112,7 +112,11 @@ public class ShareController {
|
|||
shareInfoService.validate(shareId, planId);
|
||||
return testPlanApiCaseService.getFailureCases(planId);
|
||||
}
|
||||
|
||||
@GetMapping("/test/plan/api/case/list/errorReport/{shareId}/{planId}")
|
||||
public List<TestPlanFailureApiDTO> getErrorReportApiCaseList(@PathVariable String shareId, @PathVariable String planId) {
|
||||
shareInfoService.validate(shareId, planId);
|
||||
return testPlanApiCaseService.getErrorReportCases(planId);
|
||||
}
|
||||
@GetMapping("/test/plan/api/case/list/all/{shareId}/{planId}")
|
||||
public List<TestPlanFailureApiDTO> getApiAllList(@PathVariable String shareId, @PathVariable String planId) {
|
||||
shareInfoService.validate(shareId, planId);
|
||||
|
@ -131,6 +135,12 @@ public class ShareController {
|
|||
return testPlanScenarioCaseService.getAllCases(planId);
|
||||
}
|
||||
|
||||
@GetMapping("/test/plan/scenario/case/list/errorReport/{shareId}/{planId}")
|
||||
public List<TestPlanFailureScenarioDTO> getScenarioErrorReportList(@PathVariable String shareId, @PathVariable String planId) {
|
||||
shareInfoService.validate(shareId, planId);
|
||||
return testPlanScenarioCaseService.getErrorReportCases(planId);
|
||||
}
|
||||
|
||||
@GetMapping("/api/definition/report/getReport/{shareId}/{testId}")
|
||||
public APIReportResult getApiReport(@PathVariable String shareId, @PathVariable String testId) {
|
||||
// shareInfoService.apiReportValidate(shareId, testId);
|
||||
|
|
|
@ -40,6 +40,11 @@ public class TestPlanApiCaseController {
|
|||
return testPlanApiCaseService.getFailureCases(planId);
|
||||
}
|
||||
|
||||
@GetMapping("/list/errorReport/{planId}")
|
||||
public List<TestPlanFailureApiDTO> getErrorReportList(@PathVariable String planId) {
|
||||
return testPlanApiCaseService.getErrorReportCases(planId);
|
||||
}
|
||||
|
||||
@GetMapping("/list/all/{planId}")
|
||||
public List<TestPlanFailureApiDTO> getAllList(@PathVariable String planId) {
|
||||
return testPlanApiCaseService.getAllCases(planId);
|
||||
|
|
|
@ -40,6 +40,11 @@ public class TestPlanScenarioCaseController {
|
|||
return testPlanScenarioCaseService.getFailureCases(planId);
|
||||
}
|
||||
|
||||
@GetMapping("/list/errorReport/{planId}")
|
||||
public List<TestPlanFailureScenarioDTO> getErrorReportList(@PathVariable String planId) {
|
||||
return testPlanScenarioCaseService.getErrorReportCases(planId);
|
||||
}
|
||||
|
||||
@GetMapping("/list/all/{planId}")
|
||||
public List<TestPlanFailureScenarioDTO> getAllList(@PathVariable String planId) {
|
||||
return testPlanScenarioCaseService.getAllCases(planId);
|
||||
|
|
|
@ -12,6 +12,7 @@ public class TestPlanScenarioStepCountDTO {
|
|||
private int scenarioStepTotal;
|
||||
private int scenarioStepSuccess;
|
||||
private int scenarioStepError;
|
||||
private int scenarioStepErrorReport;
|
||||
private List<String> underwayIds = new ArrayList<>();
|
||||
private int scenarioStepUnderway;
|
||||
}
|
||||
|
|
|
@ -33,4 +33,6 @@ public class TestPlanSimpleReportDTO extends TestPlanReportContent {
|
|||
List<TestPlanFailureScenarioDTO> scenarioAllCases;
|
||||
List<TestPlanLoadCaseDTO> loadAllCases;
|
||||
List<TestPlanLoadCaseDTO> loadFailureCases;
|
||||
List<TestPlanFailureApiDTO> errorReportCases;
|
||||
List<TestPlanFailureScenarioDTO> errorReportScenarios;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import io.metersphere.base.mapper.ApiTestCaseMapper;
|
|||
import io.metersphere.base.mapper.TestPlanApiCaseMapper;
|
||||
import io.metersphere.base.mapper.TestPlanMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtTestPlanApiCaseMapper;
|
||||
import io.metersphere.commons.constants.ExecuteResult;
|
||||
import io.metersphere.commons.utils.*;
|
||||
import io.metersphere.controller.request.ResetOrderRequest;
|
||||
import io.metersphere.dto.MsExecResponseDTO;
|
||||
|
@ -435,4 +436,9 @@ public class TestPlanApiCaseService {
|
|||
}
|
||||
return buildCases(apiTestCases);
|
||||
}
|
||||
|
||||
public List<TestPlanFailureApiDTO> getErrorReportCases(String planId) {
|
||||
List<TestPlanFailureApiDTO> apiTestCases = extTestPlanApiCaseMapper.getFailureList(planId, ExecuteResult.errorReportResult.name());
|
||||
return buildCases(apiTestCases);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -460,6 +460,12 @@ public class TestPlanReportService {
|
|||
if (reportDTO.getLoadFailureCases() != null) {
|
||||
testPlanReportContentWithBLOBs.setLoadFailureCases(JSONObject.toJSONString(reportDTO.getLoadFailureCases()));
|
||||
}
|
||||
if (reportDTO.getErrorReportCases() != null) {
|
||||
testPlanReportContentWithBLOBs.setErrorReportCases(JSONObject.toJSONString(reportDTO.getErrorReportCases()));
|
||||
}
|
||||
if (reportDTO.getErrorReportScenarios() != null) {
|
||||
testPlanReportContentWithBLOBs.setErrorReportScenarios(JSONObject.toJSONString(reportDTO.getErrorReportScenarios()));
|
||||
}
|
||||
return testPlanReportContentWithBLOBs;
|
||||
}
|
||||
|
||||
|
@ -732,6 +738,12 @@ public class TestPlanReportService {
|
|||
if (StringUtils.isNotBlank(testPlanReportContent.getLoadFailureCases())) {
|
||||
testPlanReportDTO.setLoadFailureCases(JSONObject.parseArray(testPlanReportContent.getLoadFailureCases(), TestPlanLoadCaseDTO.class));
|
||||
}
|
||||
if (StringUtils.isNotBlank(testPlanReportContent.getErrorReportCases())) {
|
||||
testPlanReportDTO.setErrorReportCases(JSONObject.parseArray(testPlanReportContent.getErrorReportCases(), TestPlanFailureApiDTO.class));
|
||||
}
|
||||
if (StringUtils.isNotBlank(testPlanReportContent.getErrorReportScenarios())) {
|
||||
testPlanReportDTO.setErrorReportScenarios(JSONObject.parseArray(testPlanReportContent.getErrorReportScenarios(), TestPlanFailureScenarioDTO.class));
|
||||
}
|
||||
testPlanReportDTO.setId(reportId);
|
||||
TestPlanReport testPlanReport = testPlanReportMapper.selectByPrimaryKey(testPlanReportContent.getTestPlanReportId());
|
||||
testPlanReportDTO.setName(testPlanReport.getName());
|
||||
|
|
|
@ -15,6 +15,7 @@ import io.metersphere.base.mapper.TestPlanApiScenarioMapper;
|
|||
import io.metersphere.base.mapper.TestPlanMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtTestPlanScenarioCaseMapper;
|
||||
import io.metersphere.commons.constants.ApiRunMode;
|
||||
import io.metersphere.commons.constants.ExecuteResult;
|
||||
import io.metersphere.commons.constants.TestPlanTestCaseStatus;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
|
@ -450,15 +451,13 @@ public class TestPlanScenarioCaseService {
|
|||
for (PlanReportCaseDTO item : planReportCaseDTOS) {
|
||||
calculateScenarioResultDTO(item, stepCount);
|
||||
}
|
||||
|
||||
int underwayStepsCounts = getUnderwayStepsCounts(stepCount.getUnderwayIds());
|
||||
|
||||
List<TestCaseReportStatusResultDTO> stepResult = new ArrayList<>();
|
||||
getScenarioCaseReportStatusResultDTO(TestPlanTestCaseStatus.Failure.name(), stepCount.getScenarioStepError(), stepResult);
|
||||
getScenarioCaseReportStatusResultDTO(TestPlanTestCaseStatus.Pass.name(), stepCount.getScenarioStepSuccess(), stepResult);
|
||||
getScenarioCaseReportStatusResultDTO(ExecuteResult.errorReportResult.name(), stepCount.getScenarioStepErrorReport(), stepResult);
|
||||
getScenarioCaseReportStatusResultDTO(TestPlanTestCaseStatus.Underway.name(),
|
||||
stepCount.getScenarioStepTotal() - stepCount.getScenarioStepSuccess() - stepCount.getScenarioStepError() + underwayStepsCounts, stepResult);
|
||||
|
||||
stepCount.getScenarioStepTotal() - stepCount.getScenarioStepSuccess() - stepCount.getScenarioStepError() -stepCount.getScenarioStepErrorReport() + underwayStepsCounts, stepResult);
|
||||
apiResult.setApiScenarioData(statusResult);
|
||||
apiResult.setApiScenarioStepData(stepResult);
|
||||
}
|
||||
|
@ -488,6 +487,7 @@ public class TestPlanScenarioCaseService {
|
|||
stepCount.setScenarioStepTotal(stepCount.getScenarioStepTotal() + jsonObject.getIntValue("scenarioStepTotal"));
|
||||
stepCount.setScenarioStepSuccess(stepCount.getScenarioStepSuccess() + jsonObject.getIntValue("scenarioStepSuccess"));
|
||||
stepCount.setScenarioStepError(stepCount.getScenarioStepError() + jsonObject.getIntValue("scenarioStepError"));
|
||||
stepCount.setScenarioStepErrorReport(stepCount.getScenarioStepErrorReport() + jsonObject.getIntValue("scenarioStepErrorReport"));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -583,4 +583,9 @@ public class TestPlanScenarioCaseService {
|
|||
testPlanApiScenarioMapper::updateByPrimaryKeySelective);
|
||||
}
|
||||
|
||||
public List<TestPlanFailureScenarioDTO> getErrorReportCases(String planId) {
|
||||
List<TestPlanFailureScenarioDTO> apiTestCases =
|
||||
extTestPlanScenarioCaseMapper.getFailureList(planId, ExecuteResult.errorReportResult.name());
|
||||
return buildCases(apiTestCases);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -166,8 +166,6 @@ public class TestPlanService {
|
|||
@Resource
|
||||
private ApiDefinitionService apiDefinitionService;
|
||||
@Resource
|
||||
private IssueTemplateService issueTemplateService;
|
||||
@Resource
|
||||
private PerformanceReportService performanceReportService;
|
||||
@Resource
|
||||
private MetricQueryService metricQueryService;
|
||||
|
@ -1461,37 +1459,9 @@ public class TestPlanService {
|
|||
}
|
||||
report.setScenarioAllCases(scenarioAllCases);
|
||||
}
|
||||
if (checkReportConfig(config, "api", "failure")) {
|
||||
// 接口
|
||||
List<TestPlanFailureApiDTO> apiFailureCases = null;
|
||||
if (!CollectionUtils.isEmpty(apiAllCases)) {
|
||||
apiFailureCases = apiAllCases.stream()
|
||||
.filter(i -> StringUtils.isNotBlank(i.getExecResult())
|
||||
&& i.getExecResult().equals("error"))
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
apiFailureCases = testPlanApiCaseService.getFailureCases(planId);
|
||||
}
|
||||
if (saveResponse) {
|
||||
buildApiResponse(apiFailureCases);
|
||||
}
|
||||
report.setApiFailureCases(apiFailureCases);
|
||||
|
||||
// 场景
|
||||
List<TestPlanFailureScenarioDTO> scenarioFailureCases = null;
|
||||
if (!CollectionUtils.isEmpty(scenarioAllCases)) {
|
||||
scenarioFailureCases = scenarioAllCases.stream()
|
||||
.filter(i -> StringUtils.isNotBlank(i.getLastResult())
|
||||
&& i.getLastResult().equals("Fail"))
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
scenarioFailureCases = testPlanScenarioCaseService.getFailureCases(planId);
|
||||
}
|
||||
if (saveResponse) {
|
||||
buildScenarioResponse(scenarioFailureCases);
|
||||
}
|
||||
report.setScenarioFailureCases(scenarioFailureCases);
|
||||
}
|
||||
//筛选符合配置需要的执行结果的用例和场景
|
||||
this.screenApiCaseByStatusAndReportConfig(report, apiAllCases, config);
|
||||
this.screenScenariosByStatusAndReportConfig(report, scenarioAllCases, config);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1651,26 +1621,51 @@ public class TestPlanService {
|
|||
report.setScenarioAllCases(scenarioAllCases);
|
||||
}
|
||||
}
|
||||
if (checkReportConfig(config, "api", "failure")) {
|
||||
// 接口
|
||||
List<TestPlanFailureApiDTO> apiFailureCases = null;
|
||||
if (!CollectionUtils.isEmpty(apiAllCases)) {
|
||||
apiFailureCases = apiAllCases.stream()
|
||||
.filter(i -> StringUtils.isNotBlank(i.getExecResult())
|
||||
&& i.getExecResult().equals("error"))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
report.setApiFailureCases(apiFailureCases);
|
||||
|
||||
// 场景
|
||||
List<TestPlanFailureScenarioDTO> scenarioFailureCases = null;
|
||||
if (!CollectionUtils.isEmpty(scenarioAllCases)) {
|
||||
scenarioFailureCases = scenarioAllCases.stream()
|
||||
.filter(i -> StringUtils.isNotBlank(i.getLastResult())
|
||||
&& i.getLastResult().equals("Fail"))
|
||||
.collect(Collectors.toList());
|
||||
//筛选符合配置需要的执行结果的用例和场景
|
||||
this.screenApiCaseByStatusAndReportConfig(report, apiAllCases, config);
|
||||
this.screenScenariosByStatusAndReportConfig(report, scenarioAllCases, config);
|
||||
}
|
||||
}
|
||||
|
||||
private void screenScenariosByStatusAndReportConfig(TestPlanSimpleReportDTO report, List<TestPlanFailureScenarioDTO> scenarios, JSONObject reportConfig) {
|
||||
|
||||
if (!CollectionUtils.isEmpty(scenarios)) {
|
||||
List<TestPlanFailureScenarioDTO> failureScenarios = new ArrayList<>();
|
||||
List<TestPlanFailureScenarioDTO> errorReportScenarios = new ArrayList<>();
|
||||
for (TestPlanFailureScenarioDTO scenario : scenarios) {
|
||||
if (StringUtils.equalsIgnoreCase(scenario.getLastResult(), "Fail")) {
|
||||
failureScenarios.add(scenario);
|
||||
} else if (StringUtils.equalsIgnoreCase(scenario.getLastResult(), ExecuteResult.errorReportResult.name())) {
|
||||
errorReportScenarios.add(scenario);
|
||||
}
|
||||
report.setScenarioFailureCases(scenarioFailureCases);
|
||||
}
|
||||
if (checkReportConfig(reportConfig, "api", "failure")) {
|
||||
report.setScenarioFailureCases(failureScenarios);
|
||||
}
|
||||
if (checkReportConfig(reportConfig, "api", "errorReport")) {
|
||||
report.setErrorReportScenarios(errorReportScenarios);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void screenApiCaseByStatusAndReportConfig(TestPlanSimpleReportDTO report, List<TestPlanFailureApiDTO> apiAllCases, JSONObject reportConfig) {
|
||||
if (!CollectionUtils.isEmpty(apiAllCases)) {
|
||||
List<TestPlanFailureApiDTO> apiFailureCases = new ArrayList<>();
|
||||
List<TestPlanFailureApiDTO> apiErrorReportCases = new ArrayList<>();
|
||||
for (TestPlanFailureApiDTO apiDTO : apiAllCases) {
|
||||
if (StringUtils.equalsIgnoreCase(apiDTO.getExecResult(), "error")) {
|
||||
apiFailureCases.add(apiDTO);
|
||||
} else if (StringUtils.equalsIgnoreCase(apiDTO.getExecResult(), ExecuteResult.errorReportResult.name())) {
|
||||
apiErrorReportCases.add(apiDTO);
|
||||
}
|
||||
}
|
||||
|
||||
if (checkReportConfig(reportConfig, "api", "failure")) {
|
||||
report.setApiFailureCases(apiFailureCases);
|
||||
}
|
||||
if (checkReportConfig(reportConfig, "api", "errorReport")) {
|
||||
report.setErrorReportCases(apiErrorReportCases);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -190,3 +190,6 @@ SET ref_id = id;
|
|||
UPDATE test_case
|
||||
INNER JOIN project_version ON project_version.project_id = test_case.project_id
|
||||
SET version_id = project_version.id;
|
||||
|
||||
ALTER TABLE `test_plan_report_content` ADD COLUMN `error_report_cases` LONGTEXT COMMENT '误报状态接口用例';
|
||||
ALTER TABLE `test_plan_report_content` ADD COLUMN `error_report_scenarios` LONGTEXT COMMENT '误报状态场景用例';
|
||||
|
|
|
@ -118,6 +118,7 @@ export const REQUIRED = [
|
|||
export const RESULT_MAP = new Map([
|
||||
['success', '通过'],
|
||||
['error', '未通过'],
|
||||
['default', '未执行']
|
||||
['default', '未执行'],
|
||||
['errorReportResult', '误报']
|
||||
]);
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<ms-tag v-else-if="value == 'Failure'" type="danger" :content="$t('test_track.plan_view.failure')"/>
|
||||
<ms-tag v-else-if="value == 'Blocking'" type="warning" :content="$t('test_track.plan_view.blocking')"/>
|
||||
<ms-tag v-else-if="value == 'Skip'" type="info" :content="$t('test_track.plan_view.skip')"/>
|
||||
<ms-tag v-else-if="value == 'ErrorReportResult'" type="warning" style="background-color: #F6972A; border-color: #F6972A" :content="$t('error_report_library.option.name')"/>
|
||||
<ms-tag v-else type="info" :content="value"/>
|
||||
</span>
|
||||
</template>
|
||||
|
|
|
@ -142,6 +142,9 @@
|
|||
<el-link type="danger" @click="showReport(row)" v-if="row.lastResult === 'Fail'">
|
||||
{{ $t('api_test.automation.fail') }}
|
||||
</el-link>
|
||||
<el-link type="danger" @click="showReport(row)" v-if="row.lastResult === 'errorReportResult'">
|
||||
{{ $t('error_report_library.option.name') }}
|
||||
</el-link>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
<ms-table-column :field="item"
|
||||
|
|
|
@ -8,13 +8,22 @@
|
|||
<template v-slot:label>
|
||||
<tab-pane-count :title="$t('test_track.report.fail_case')" :count="failureSize"/>
|
||||
</template>
|
||||
<api-cases :is-db="isDb" :share-id="shareId" :is-share="isShare" :report="report" :is-template="isTemplate" :plan-id="planId" @setSize="setFailureSize"/>
|
||||
<api-cases :is-db="isDb" :share-id="shareId" :is-share="isShare" :report="report" :is-template="isTemplate"
|
||||
:plan-id="planId" @setSize="setFailureSize"/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane style="min-height: 500px" name="third" v-if="allEnable">
|
||||
<el-tab-pane style="min-height: 500px" name="third" v-if="errorReportEnable">
|
||||
<template v-slot:label>
|
||||
<tab-pane-count :title="$t('error_report_library.option.name')" :count="errorReportSize"/>
|
||||
</template>
|
||||
<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"/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane style="min-height: 500px" name="fourth" v-if="allEnable">
|
||||
<template v-slot:label>
|
||||
<tab-pane-count :title="$t('test_track.report.all_case')" :count="allSize"/>
|
||||
</template>
|
||||
<api-cases :is-db="isDb" :is-all="true" :share-id="shareId" :is-share="isShare" :report="report" :is-template="isTemplate" :plan-id="planId" @setSize="setAllSize"/>
|
||||
<api-cases :is-db="isDb" :is-all="true" :share-id="shareId" :is-share="isShare" :report="report"
|
||||
:is-template="isTemplate" :plan-id="planId" @setSize="setAllSize"/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</test-plan-report-container>
|
||||
|
@ -27,6 +36,7 @@ import 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";
|
||||
|
||||
export default {
|
||||
name: "TestPlanApiReport",
|
||||
components: {TabPaneCount, ApiCases, TestPlanReportContainer, ApiResult, MsFormDivider},
|
||||
|
@ -34,6 +44,7 @@ export default {
|
|||
return {
|
||||
activeName: 'first',
|
||||
failureSize: 0,
|
||||
errorReportSize: 0,
|
||||
allSize: 0,
|
||||
};
|
||||
},
|
||||
|
@ -49,6 +60,10 @@ export default {
|
|||
let disable = this.report.config && this.report.config.api.children.failure.enable === false;
|
||||
return !disable;
|
||||
},
|
||||
errorReportEnable() {
|
||||
let disable = this.report.config && this.report.config.api.children.errorReport && this.report.config.api.children.errorReport.enable === false;
|
||||
return !disable;
|
||||
},
|
||||
allEnable() {
|
||||
let disable = this.report.config && this.report.config.api.children.all.enable === false;
|
||||
return !disable;
|
||||
|
@ -61,6 +76,9 @@ export default {
|
|||
failureEnable() {
|
||||
this.initActiveName();
|
||||
},
|
||||
errorReportEnable() {
|
||||
this.initActiveName();
|
||||
},
|
||||
allEnable() {
|
||||
this.initActiveName();
|
||||
},
|
||||
|
@ -74,13 +92,18 @@ export default {
|
|||
this.activeName = 'first';
|
||||
} else if (this.failureEnable) {
|
||||
this.activeName = 'second';
|
||||
} else if (this.allEnable) {
|
||||
} else if (this.errorReportEnable) {
|
||||
this.activeName = 'third';
|
||||
} else if (this.allEnable) {
|
||||
this.activeName = 'fourth';
|
||||
}
|
||||
},
|
||||
setFailureSize(size) {
|
||||
this.failureSize = size;
|
||||
},
|
||||
setErrorReportSize(size) {
|
||||
this.errorReportSize = size;
|
||||
},
|
||||
setAllSize(size) {
|
||||
this.allSize = size;
|
||||
},
|
||||
|
|
|
@ -205,6 +205,10 @@ export default {
|
|||
enable: true,
|
||||
name: this.$t('test_track.report.fail_case'),
|
||||
},
|
||||
errorReport: {
|
||||
enable: true,
|
||||
name: this.$t('error_report_library.option.name'),
|
||||
},
|
||||
all: {
|
||||
enable: true,
|
||||
name: this.$t('test_track.report.all_case'),
|
||||
|
|
|
@ -1,62 +1,64 @@
|
|||
<template>
|
||||
<el-container>
|
||||
<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="apiCases">
|
||||
<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="apiCases">
|
||||
|
||||
<ms-table-column
|
||||
<ms-table-column
|
||||
:width="80"
|
||||
:label="$t('commons.id')"
|
||||
prop="num">
|
||||
</ms-table-column>
|
||||
</ms-table-column>
|
||||
|
||||
<ms-table-column
|
||||
<ms-table-column
|
||||
:label="$t('commons.name')"
|
||||
prop="name">
|
||||
</ms-table-column>
|
||||
</ms-table-column>
|
||||
|
||||
<ms-table-column
|
||||
<ms-table-column
|
||||
:label="$t('commons.create_user')"
|
||||
prop="creatorName"/>
|
||||
|
||||
<ms-table-column
|
||||
<ms-table-column
|
||||
:label="$t('test_track.case.priority')"
|
||||
:width="80"
|
||||
prop="priority">
|
||||
<template v-slot:default="scope">
|
||||
<priority-table-item :value="scope.row.priority" ref="priority"/>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
<template v-slot:default="scope">
|
||||
<priority-table-item :value="scope.row.priority" ref="priority"/>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
|
||||
<ms-table-column
|
||||
<ms-table-column
|
||||
:width="80"
|
||||
:label="$t('test_track.plan_view.execute_result')"
|
||||
prop="lastResult">
|
||||
<template v-slot:default="scope">
|
||||
<status-table-item v-if="scope.row.execResult === 'success'" :value="'Pass'"/>
|
||||
<status-table-item v-else-if="scope.row.execResult === 'error'" :value="'Failure'"/>
|
||||
<status-table-item v-else-if="scope.row.execResult === 'STOP'" :value="'STOP'"/>
|
||||
<status-table-item v-else :value="'Prepare'"/>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
</ms-table>
|
||||
</el-scrollbar>
|
||||
</el-card>
|
||||
</ms-aside-container>
|
||||
<ms-main-container>
|
||||
<el-card v-if="showResponse">
|
||||
<ms-request-result-tail :response="response" ref="debugResult"/>
|
||||
</el-card>
|
||||
<div class="empty" v-else>{{ $t('test_track.plan.load_case.content_empty') }}</div>
|
||||
</ms-main-container>
|
||||
<template v-slot:default="scope">
|
||||
<status-table-item v-if="scope.row.execResult === 'success'" :value="'Pass'"/>
|
||||
<status-table-item v-else-if="scope.row.execResult === 'error'" :value="'Failure'"/>
|
||||
<status-table-item v-else-if="scope.row.execResult === 'STOP'" :value="'STOP'"/>
|
||||
<status-table-item v-else-if="scope.row.execResult === 'errorReportResult'"
|
||||
:value="'ErrorReportResult'"/>
|
||||
<status-table-item v-else :value="'Prepare'"/>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
</ms-table>
|
||||
</el-scrollbar>
|
||||
</el-card>
|
||||
</ms-aside-container>
|
||||
<ms-main-container>
|
||||
<el-card v-if="showResponse">
|
||||
<ms-request-result-tail :response="response" ref="debugResult"/>
|
||||
</el-card>
|
||||
<div class="empty" v-else>{{ $t('test_track.plan.load_case.content_empty') }}</div>
|
||||
</ms-main-container>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
|
@ -66,9 +68,9 @@ import TypeTableItem from "../../../../../../common/tableItems/planview/TypeTabl
|
|||
import MethodTableItem from "../../../../../../common/tableItems/planview/MethodTableItem";
|
||||
import StatusTableItem from "../../../../../../common/tableItems/planview/StatusTableItem";
|
||||
import {
|
||||
getPlanApiAllCase,
|
||||
getPlanApiAllCase, getPlanApiErrorReportCase,
|
||||
getPlanApiFailureCase,
|
||||
getSharePlanApiAllCase,
|
||||
getSharePlanApiAllCase, getSharePlanApiErrorReportCase,
|
||||
getSharePlanApiFailureCase
|
||||
} from "@/network/test-plan";
|
||||
import MsTable from "@/business/components/common/components/table/MsTable";
|
||||
|
@ -77,13 +79,15 @@ import {getApiReport, getShareApiReport} from "@/network/api";
|
|||
import MsRequestResultTail from "@/business/components/api/definition/components/response/RequestResultTail";
|
||||
import MsAsideContainer from "@/business/components/common/components/MsAsideContainer";
|
||||
import MsMainContainer from "@/business/components/common/components/MsMainContainer";
|
||||
|
||||
export default {
|
||||
name: "ApiCaseFailureResult",
|
||||
components: {
|
||||
MsMainContainer,
|
||||
MsAsideContainer,
|
||||
MsRequestResultTail,
|
||||
MsTableColumn, MsTable, StatusTableItem, MethodTableItem, TypeTableItem, PriorityTableItem},
|
||||
MsTableColumn, MsTable, StatusTableItem, MethodTableItem, TypeTableItem, PriorityTableItem
|
||||
},
|
||||
props: {
|
||||
planId: String,
|
||||
isTemplate: Boolean,
|
||||
|
@ -91,6 +95,7 @@ export default {
|
|||
isShare: Boolean,
|
||||
shareId: String,
|
||||
isAll: Boolean,
|
||||
isErrorReport: Boolean,
|
||||
isDb: Boolean
|
||||
},
|
||||
data() {
|
||||
|
@ -116,13 +121,19 @@ export default {
|
|||
methods: {
|
||||
getScenarioApiCase() {
|
||||
if (this.isTemplate || this.isDb) {
|
||||
if (this.isAll) {
|
||||
if(this.isErrorReport){
|
||||
this.apiCases = this.report.errorReportCases ? this.report.errorReportCases : [];
|
||||
}else if (this.isAll) {
|
||||
this.apiCases = this.report.apiAllCases ? this.report.apiAllCases : [];
|
||||
} else {
|
||||
this.apiCases = this.report.apiFailureCases ? this.report.apiFailureCases : [];
|
||||
}
|
||||
} else if (this.isShare) {
|
||||
if (this.isAll) {
|
||||
if(this.isErrorReport){
|
||||
this.result = getSharePlanApiErrorReportCase(this.shareId, this.planId, (data) => {
|
||||
this.apiCases = data;
|
||||
});
|
||||
}else if (this.isAll) {
|
||||
this.result = getSharePlanApiAllCase(this.shareId, this.planId, (data) => {
|
||||
this.apiCases = data;
|
||||
});
|
||||
|
@ -132,7 +143,11 @@ export default {
|
|||
});
|
||||
}
|
||||
} else {
|
||||
if (this.isAll) {
|
||||
if(this.isErrorReport){
|
||||
this.result = getPlanApiErrorReportCase(this.planId, (data) => {
|
||||
this.apiCases = data;
|
||||
});
|
||||
}else if (this.isAll) {
|
||||
this.result = getPlanApiAllCase(this.planId, (data) => {
|
||||
this.apiCases = data;
|
||||
});
|
||||
|
|
|
@ -5,15 +5,16 @@
|
|||
<template v-slot:label>
|
||||
<tab-pane-count :title="$t('commons.api_case')" :count="apiSize"/>
|
||||
</template>
|
||||
<api-case-failure-result :is-db="isDb" :is-all="isAll" :share-id="shareId" :is-share="isShare"
|
||||
<api-case-failure-result :is-db="isDb" :is-all="isAll" :is-error-report="isErrorReport" :share-id="shareId" :is-share="isShare"
|
||||
:report="report" :is-template="isTemplate" :plan-id="planId" @setSize="setApiSize"/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane>
|
||||
<template v-slot:label>
|
||||
<tab-pane-count :title="$t('commons.scenario_case')" :count="scenarioSize"/>
|
||||
</template>
|
||||
<api-scenario-failure-result :is-db="isDb" :is-all="isAll" :share-id="shareId" :is-share="isShare"
|
||||
:report="report" :is-template="isTemplate" :plan-id="planId" @setSize="setScenarioSize"/>
|
||||
<api-scenario-failure-result :is-db="isDb" :is-all="isAll" :is-error-report="isErrorReport" :share-id="shareId" :is-share="isShare"
|
||||
:report="report" :is-template="isTemplate" :plan-id="planId"
|
||||
@setSize="setScenarioSize"/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
|
@ -29,12 +30,14 @@ import ApiScenarioFailureResult
|
|||
import ApiCaseFailureResult
|
||||
from "@/business/components/track/plan/view/comonents/report/detail/component/ApiCaseFailureResult";
|
||||
import TabPaneCount from "@/business/components/track/plan/view/comonents/report/detail/component/TabPaneCount";
|
||||
|
||||
export default {
|
||||
name: "ApiCases",
|
||||
components: {
|
||||
TabPaneCount,
|
||||
ApiCaseFailureResult,
|
||||
ApiScenarioFailureResult, StatusTableItem, MethodTableItem, TypeTableItem, PriorityTableItem},
|
||||
ApiScenarioFailureResult, StatusTableItem, MethodTableItem, TypeTableItem, PriorityTableItem
|
||||
},
|
||||
props: {
|
||||
planId: String,
|
||||
isTemplate: Boolean,
|
||||
|
@ -42,6 +45,7 @@ export default {
|
|||
report: {},
|
||||
shareId: String,
|
||||
isAll: Boolean,
|
||||
isErrorReport: Boolean,
|
||||
isDb: Boolean
|
||||
},
|
||||
data() {
|
||||
|
|
|
@ -33,6 +33,7 @@ export default {
|
|||
["Failure", {name: this.$t('test_track.plan_view.failure'), itemStyle: {color: '#F56C6C'}}],
|
||||
["Prepare", {name: this.$t('api_test.home_page.detail_card.unexecute'), itemStyle: {color: '#909399'}}],
|
||||
["Underway", {name: this.$t('api_test.home_page.detail_card.unexecute'), itemStyle: {color: '#909399'}}],
|
||||
["errorReportResult", {name: this.$t('error_report_library.option.name'), itemStyle: {color: '#F6972A'}}],
|
||||
]),
|
||||
caseCharData: [],
|
||||
scenarioCharData: [],
|
||||
|
|
|
@ -1,64 +1,66 @@
|
|||
<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">
|
||||
<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 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 === 'STOP'" :value="'STOP'"/>
|
||||
<status-table-item v-else-if="row.lastResult === 'Running'" :value="'Underway'"/>
|
||||
<status-table-item v-else-if="row.lastResult === 'Waiting'" :value="'Waiting'"/>
|
||||
<status-table-item v-else-if="row.lastResult === 'Timeout'" :value="'Timeout'"/>
|
||||
<status-table-item v-else :value="'Prepare'"/>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
</ms-table>
|
||||
</el-scrollbar>
|
||||
</el-card>
|
||||
<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 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 === 'STOP'" :value="'STOP'"/>
|
||||
<status-table-item v-else-if="row.lastResult === 'Running'" :value="'Underway'"/>
|
||||
<status-table-item v-else-if="row.lastResult === 'Waiting'" :value="'Waiting'"/>
|
||||
<status-table-item v-else-if="row.lastResult === 'Timeout'" :value="'Timeout'"/>
|
||||
<status-table-item v-else-if="row.lastResult === 'errorReportResult'" :value="'ErrorReportResult'"/>
|
||||
<status-table-item v-else :value="'Prepare'"/>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
</ms-table>
|
||||
</el-scrollbar>
|
||||
</el-card>
|
||||
</ms-aside-container>
|
||||
<ms-main-container>
|
||||
<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"/>
|
||||
<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"/>
|
||||
<div class="empty" v-else>{{ $t('test_track.plan.load_case.content_empty') }}</div>
|
||||
</ms-main-container>
|
||||
</el-container>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -70,20 +72,24 @@ import {
|
|||
getPlanScenarioAllCase,
|
||||
getPlanScenarioFailureCase,
|
||||
getSharePlanScenarioAllCase,
|
||||
getSharePlanScenarioFailureCase
|
||||
getSharePlanScenarioFailureCase,
|
||||
getPlanScenarioErrorReportCase,
|
||||
getSharePlanScenarioErrorReportCase,
|
||||
} from "@/network/test-plan";
|
||||
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: "ApiScenarioFailureResult",
|
||||
components: {
|
||||
MsMainContainer,
|
||||
MsAsideContainer,
|
||||
MsApiReport,
|
||||
MsTableColumn, MsTable, StatusTableItem, MethodTableItem, TypeTableItem, PriorityTableItem},
|
||||
MsTableColumn, MsTable, StatusTableItem, MethodTableItem, TypeTableItem, PriorityTableItem
|
||||
},
|
||||
props: {
|
||||
planId: String,
|
||||
isTemplate: Boolean,
|
||||
|
@ -91,11 +97,12 @@ export default {
|
|||
isShare: Boolean,
|
||||
shareId: String,
|
||||
isAll: Boolean,
|
||||
isErrorReport: Boolean,
|
||||
isDb: Boolean
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
scenarioCases: [],
|
||||
scenarioCases: [],
|
||||
result: {},
|
||||
reportId: null,
|
||||
response: {},
|
||||
|
@ -115,13 +122,19 @@ export default {
|
|||
methods: {
|
||||
getScenarioApiCase() {
|
||||
if (this.isTemplate || this.isDb) {
|
||||
if (this.isAll) {
|
||||
if(this.isErrorReport){
|
||||
this.scenarioCases = this.report.errorReportScenarios ? this.report.errorReportScenarios : [];
|
||||
}else if (this.isAll) {
|
||||
this.scenarioCases = this.report.scenarioAllCases ? this.report.scenarioAllCases : [];
|
||||
} else {
|
||||
this.scenarioCases = this.report.scenarioFailureCases ? this.report.scenarioFailureCases : [];
|
||||
}
|
||||
} else if (this.isShare) {
|
||||
if (this.isAll) {
|
||||
if(this.isErrorReport){
|
||||
this.result = getSharePlanScenarioErrorReportCase(this.shareId, this.planId, (data) => {
|
||||
this.scenarioCases = data;
|
||||
});
|
||||
}else if (this.isAll) {
|
||||
this.result = getSharePlanScenarioAllCase(this.shareId, this.planId, (data) => {
|
||||
this.scenarioCases = data;
|
||||
});
|
||||
|
@ -131,7 +144,11 @@ export default {
|
|||
});
|
||||
}
|
||||
} else {
|
||||
if (this.isAll) {
|
||||
if(this.isErrorReport){
|
||||
this.result = getPlanScenarioErrorReportCase(this.planId, (data) => {
|
||||
this.scenarioCases = data;
|
||||
});
|
||||
}else if (this.isAll) {
|
||||
this.result = getPlanScenarioAllCase(this.planId, (data) => {
|
||||
this.scenarioCases = data;
|
||||
});
|
||||
|
|
|
@ -72,11 +72,14 @@ export function getSharePlanFunctionAllCase(shareId, planId, callback) {
|
|||
return planId ? baseGet('/share/test/plan/case/list/all/' + shareId + '/' + planId, callback) : {};
|
||||
}
|
||||
|
||||
|
||||
export function getPlanScenarioFailureCase(planId, callback) {
|
||||
return planId ? baseGet('/test/plan/scenario/case/list/failure/' + planId, callback) : {};
|
||||
}
|
||||
|
||||
export function getPlanScenarioErrorReportCase(planId, callback) {
|
||||
return planId ? baseGet('/test/plan/scenario/case/list/errorReport/' + planId, callback) : {};
|
||||
}
|
||||
|
||||
export function getPlanScenarioAllCase(planId, callback) {
|
||||
return planId ? baseGet('/test/plan/scenario/case/list/all/' + planId, callback) : {};
|
||||
}
|
||||
|
@ -89,10 +92,17 @@ export function getSharePlanScenarioAllCase(shareId, planId, callback) {
|
|||
return planId ? baseGet('/share/test/plan/scenario/case/list/all/' + shareId + '/' + planId, callback) : {};
|
||||
}
|
||||
|
||||
export function getSharePlanScenarioErrorReportCase(shareId, planId, callback) {
|
||||
return planId ? baseGet('/share/test/plan/scenario/case/list/errorReport/' + shareId + '/' + planId, callback) : {};
|
||||
}
|
||||
|
||||
export function getPlanApiFailureCase(planId, callback) {
|
||||
return planId ? baseGet('/test/plan/api/case/list/failure/' + planId, callback) : {};
|
||||
}
|
||||
|
||||
export function getPlanApiErrorReportCase(planId, callback) {
|
||||
return planId ? baseGet('/test/plan/api/case/list/errorReport/' + planId, callback) : {};
|
||||
}
|
||||
export function getPlanApiAllCase(planId, callback) {
|
||||
return planId ? baseGet('/test/plan/api/case/list/all/' + planId, callback) : {};
|
||||
}
|
||||
|
@ -101,6 +111,10 @@ export function getSharePlanApiFailureCase(shareId, planId, callback) {
|
|||
return planId ? baseGet('/share/test/plan/api/case/list/failure/' + shareId + '/' + planId, callback) : {};
|
||||
}
|
||||
|
||||
export function getSharePlanApiErrorReportCase(shareId, planId, callback) {
|
||||
return planId ? baseGet('/share/test/plan/api/case/list/errorReport/' + shareId + '/' + planId, callback) : {};
|
||||
}
|
||||
|
||||
export function getSharePlanApiAllCase(shareId, planId, callback) {
|
||||
return planId ? baseGet('/share/test/plan/api/case/list/all/' + shareId + '/' + planId, callback) : {};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue