fix(测试跟踪): 修复查看实时测试计划报告时环境显示不全的问题

--bug=1023068 --user=宋天阳
【测试跟踪】执行测试计划-查看报告统计/测试计划列表-操作-查看测试报告-运行环境未展示接口用例执行环境
https://www.tapd.cn/55049933/s/1346943
This commit is contained in:
song-tianyang 2023-03-08 15:48:32 +08:00 committed by 建国
parent 4bff6f56ba
commit a155dac4d1
8 changed files with 245 additions and 154 deletions

View File

@ -276,11 +276,6 @@ public class TestPlanController {
testPlanService.exportPlanDbReport(reportId, lang, response); testPlanService.exportPlanDbReport(reportId, lang, response);
} }
@GetMapping("/report/{planId}")
public TestPlanSimpleReportDTO getReport(@PathVariable String planId) {
return testPlanService.getReport(planId, null);
}
@GetMapping("/report/functional/result") @GetMapping("/report/functional/result")
public TestCaseReportStatusResultDTO getFunctionalResultReport(@PathVariable String planId) { public TestCaseReportStatusResultDTO getFunctionalResultReport(@PathVariable String planId) {
return testPlanService.getFunctionalResultReport(planId); return testPlanService.getFunctionalResultReport(planId);

View File

@ -18,9 +18,9 @@ import io.metersphere.plan.dto.TestPlanSimpleReportDTO;
import io.metersphere.plan.request.TestPlanReportSaveRequest; import io.metersphere.plan.request.TestPlanReportSaveRequest;
import io.metersphere.plan.service.TestPlanReportService; import io.metersphere.plan.service.TestPlanReportService;
import io.metersphere.request.report.QueryTestPlanReportRequest; import io.metersphere.request.report.QueryTestPlanReportRequest;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
@ -47,6 +47,11 @@ public class TestPlanReportController {
return testPlanReportService.getMetric(planId); return testPlanReportService.getMetric(planId);
} }
@GetMapping("/real-time/{planId}")
public TestPlanSimpleReportDTO getRealTimeReport(@PathVariable String planId) {
return testPlanReportService.getRealTimeReport(planId);
}
@GetMapping("/db/{reportId}") @GetMapping("/db/{reportId}")
public TestPlanSimpleReportDTO getReport(@PathVariable String reportId) { public TestPlanSimpleReportDTO getReport(@PathVariable String reportId) {
return testPlanReportService.getReport(reportId); return testPlanReportService.getReport(reportId);
@ -77,7 +82,7 @@ public class TestPlanReportController {
String userId = SessionUtils.getUser().getId(); String userId = SessionUtils.getUser().getId();
String reportId = UUID.randomUUID().toString(); String reportId = UUID.randomUUID().toString();
TestPlanReportSaveRequest saveRequest = new TestPlanReportSaveRequest(reportId, planId, userId, triggerMode); TestPlanReportSaveRequest saveRequest = new TestPlanReportSaveRequest(reportId, planId, userId, triggerMode);
TestPlanScheduleReportInfoDTO report = testPlanReportService.genTestPlanReport(saveRequest,null); TestPlanScheduleReportInfoDTO report = testPlanReportService.genTestPlanReport(saveRequest, null);
testPlanReportService.genTestPlanReportContent(report); testPlanReportService.genTestPlanReportContent(report);
testPlanReportService.countReportByTestPlanReportId(report.getTestPlanReport().getId(), null, triggerMode); testPlanReportService.countReportByTestPlanReportId(report.getTestPlanReport().getId(), null, triggerMode);
return "success"; return "success";

View File

@ -34,11 +34,12 @@ public class ExecReportListener {
@KafkaListener(id = CONSUME_ID, topics = KafkaTopicConstants.TEST_PLAN_REPORT_TOPIC, groupId = "${spring.application.name}") @KafkaListener(id = CONSUME_ID, topics = KafkaTopicConstants.TEST_PLAN_REPORT_TOPIC, groupId = "${spring.application.name}")
public void consume(ConsumerRecord<?, String> record) { public void consume(ConsumerRecord<?, String> record) {
LoggerUtil.info("Execute message received", record.value());
Object testIdObj = record.key(); Object testIdObj = record.key();
if (ObjectUtils.isEmpty(testIdObj)) { if (ObjectUtils.isEmpty(testIdObj)) {
LoggerUtil.info("Execute message. received", record.value());
this.testPlanReportTestEnded(record.value()); this.testPlanReportTestEnded(record.value());
} else { } else {
LoggerUtil.info("Execute message. key:[" + testIdObj.toString() + "], received", record.value());
this.automationCaseTestEnd(testIdObj.toString()); this.automationCaseTestEnd(testIdObj.toString());
} }

View File

@ -1053,6 +1053,53 @@ public class TestPlanReportService {
return testPlanReportDTO; return testPlanReportDTO;
} }
/**
* 获取测试计划实时报告
*
* @param planId
* @return
*/
public TestPlanSimpleReportDTO getRealTimeReport(String planId) {
TestPlanWithBLOBs testPlan = testPlanMapper.selectByPrimaryKey(planId);
TestPlanSimpleReportDTO report = new TestPlanSimpleReportDTO();
TestPlanFunctionResultReportDTO functionResult = new TestPlanFunctionResultReportDTO();
TestPlanApiResultReportDTO apiResult = new TestPlanApiResultReportDTO();
TestPlanUiResultReportDTO uiResult = new TestPlanUiResultReportDTO();
report.setFunctionResult(functionResult);
report.setApiResult(apiResult);
report.setUiResult(uiResult);
report.setStartTime(testPlan.getActualStartTime());
report.setEndTime(testPlan.getActualEndTime());
report.setSummary(testPlan.getReportSummary());
report.setConfig(testPlan.getReportConfig());
testPlanTestCaseService.calculatePlanReport(planId, report);
issuesService.calculatePlanReport(planId, report);
planTestPlanApiCaseService.calculatePlanReport(planId, report);
planTestPlanScenarioCaseService.calculatePlanReport(planId, report);
planTestPlanLoadCaseService.calculatePlanReport(planId, report);
planTestPlanUiScenarioCaseService.calculatePlanReport(planId, report);
if (report.getExecuteCount() != 0 && report.getCaseCount() != null) {
report.setExecuteRate(report.getExecuteCount() * 0.1 * 10 / report.getCaseCount());
} else {
report.setExecuteRate(0.0);
}
if (report.getPassCount() != 0 && report.getCaseCount() != null) {
report.setPassRate(report.getPassCount() * 0.1 * 10 / report.getCaseCount());
} else {
report.setPassRate(0.0);
}
report.setName(testPlan.getName());
Project project = baseProjectService.getProjectById(testPlan.getProjectId());
if (project.getPlatform() != null && project.getPlatform().equals(IssuesManagePlatform.Local.name())) {
report.setIsThirdPartIssue(false);
} else {
report.setIsThirdPartIssue(true);
}
return report;
}
public void selectEnvironmentByTestPlanReport(TestPlanSimpleReportDTO testPlanReportDTO, TestPlanReport testPlanReport) { public void selectEnvironmentByTestPlanReport(TestPlanSimpleReportDTO testPlanReportDTO, TestPlanReport testPlanReport) {
if (StringUtils.isNotEmpty(testPlanReport.getRunInfo())) { if (StringUtils.isNotEmpty(testPlanReport.getRunInfo())) {
try { try {

View File

@ -1404,7 +1404,7 @@ public class TestPlanService {
if (StringUtils.isNotBlank(reportConfig)) { if (StringUtils.isNotBlank(reportConfig)) {
config = JSON.parseMap(reportConfig); config = JSON.parseMap(reportConfig);
} }
TestPlanSimpleReportDTO report = getReport(planId, null); TestPlanSimpleReportDTO report = testPlanReportService.getRealTimeReport(planId);
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);
@ -1482,7 +1482,7 @@ public class TestPlanService {
HttpHeaderUtils.runAsUser(shareInfo.getCreateUserId()); HttpHeaderUtils.runAsUser(shareInfo.getCreateUserId());
} }
try { try {
return getReport(planId, null); return testPlanReportService.getRealTimeReport(planId);
} finally { } finally {
HttpHeaderUtils.clearUser(); HttpHeaderUtils.clearUser();
} }
@ -1547,72 +1547,6 @@ public class TestPlanService {
return report; return report;
} }
/**
* 生成测试计划报告并进行统计
*
* @param planId
* @param testPlanExecuteReportDTO 测试计划各个资源的报告 如果为空则取当前测试计划资源的最新报告
* @return
*/
public TestPlanSimpleReportDTO getReport(String planId, TestPlanCaseReportResultDTO testPlanExecuteReportDTO) {
TestPlanWithBLOBs testPlan = testPlanMapper.selectByPrimaryKey(planId);
TestPlanSimpleReportDTO report = new TestPlanSimpleReportDTO();
TestPlanFunctionResultReportDTO functionResult = new TestPlanFunctionResultReportDTO();
TestPlanApiResultReportDTO apiResult = new TestPlanApiResultReportDTO();
TestPlanUiResultReportDTO uiResult = new TestPlanUiResultReportDTO();
report.setFunctionResult(functionResult);
report.setApiResult(apiResult);
report.setUiResult(uiResult);
report.setStartTime(testPlan.getActualStartTime());
report.setEndTime(testPlan.getActualEndTime());
report.setSummary(testPlan.getReportSummary());
report.setConfig(testPlan.getReportConfig());
testPlanTestCaseService.calculatePlanReport(planId, report);
issuesService.calculatePlanReport(planId, report);
if (testPlanExecuteReportDTO == null) {
planTestPlanApiCaseService.calculatePlanReport(planId, report);
planTestPlanScenarioCaseService.calculatePlanReport(planId, report);
planTestPlanLoadCaseService.calculatePlanReport(planId, report);
planTestPlanUiScenarioCaseService.calculatePlanReport(planId, report);
} else {
if (MapUtils.isNotEmpty(testPlanExecuteReportDTO.getTestPlanApiCaseIdAndReportIdMap())) {
planTestPlanApiCaseService.calculatePlanReport(new ArrayList<>(testPlanExecuteReportDTO.getTestPlanApiCaseIdAndReportIdMap().values()), report);
}
if (MapUtils.isNotEmpty(testPlanExecuteReportDTO.getTestPlanScenarioIdAndReportIdMap())) {
planTestPlanScenarioCaseService.calculatePlanReport(new ArrayList<>(testPlanExecuteReportDTO.getTestPlanScenarioIdAndReportIdMap().values()), report);
}
if (MapUtils.isNotEmpty(testPlanExecuteReportDTO.getTestPlanLoadCaseIdAndReportIdMap())) {
planTestPlanLoadCaseService.calculatePlanReport(new ArrayList<>(testPlanExecuteReportDTO.getTestPlanLoadCaseIdAndReportIdMap().values()), report);
}
if (MapUtils.isNotEmpty(testPlanExecuteReportDTO.getTestPlanUiScenarioIdAndReportIdMap())) {
planTestPlanUiScenarioCaseService.calculatePlanReport(new ArrayList<>(testPlanExecuteReportDTO.getTestPlanUiScenarioIdAndReportIdMap().values()), report);
}
}
if (report.getExecuteCount() != 0 && report.getCaseCount() != null) {
report.setExecuteRate(report.getExecuteCount() * 0.1 * 10 / report.getCaseCount());
} else {
report.setExecuteRate(0.0);
}
if (report.getPassCount() != 0 && report.getCaseCount() != null) {
report.setPassRate(report.getPassCount() * 0.1 * 10 / report.getCaseCount());
} else {
report.setPassRate(0.0);
}
report.setName(testPlan.getName());
Project project = baseProjectService.getProjectById(testPlan.getProjectId());
if (project.getPlatform() != null && project.getPlatform().equals(IssuesManagePlatform.Local.name())) {
report.setIsThirdPartIssue(false);
} else {
report.setIsThirdPartIssue(true);
}
return report;
}
public void editReport(TestPlanWithBLOBs testPlanWithBLOBs) { public void editReport(TestPlanWithBLOBs testPlanWithBLOBs) {
testPlanMapper.updateByPrimaryKeySelective(testPlanWithBLOBs); testPlanMapper.updateByPrimaryKeySelective(testPlanWithBLOBs);
} }

View File

@ -54,7 +54,23 @@ public class PlanTestPlanApiCaseService extends ApiTestService {
if (MapUtils.isEmpty(report.getProjectEnvMap())) { if (MapUtils.isEmpty(report.getProjectEnvMap())) {
report.setProjectEnvMap(getPlanProjectEnvMap(idList)); report.setProjectEnvMap(getPlanProjectEnvMap(idList));
} else { } else {
report.getProjectEnvMap().putAll(getPlanProjectEnvMap(idList)); Map<String, List<String>> projectEnvMap = getPlanProjectEnvMap(idList);
if (MapUtils.isNotEmpty(projectEnvMap)) {
for (Map.Entry<String, List<String>> entry : projectEnvMap.entrySet()) {
String project = entry.getKey();
List<String> envList = entry.getValue();
if (report.getProjectEnvMap().containsKey(project)) {
for (String env : envList) {
if (!report.getProjectEnvMap().get(project).contains(env)) {
report.getProjectEnvMap().get(project).add(env);
}
}
} else {
report.getProjectEnvMap().put(project, envList);
}
}
}
} }
} catch (Exception e) { } catch (Exception e) {
LogUtil.error(e); LogUtil.error(e);

View File

@ -44,7 +44,23 @@ public class PlanTestPlanScenarioCaseService extends ApiTestService {
if (MapUtils.isEmpty(report.getProjectEnvMap())) { if (MapUtils.isEmpty(report.getProjectEnvMap())) {
report.setProjectEnvMap(getPlanProjectEnvMap(idList)); report.setProjectEnvMap(getPlanProjectEnvMap(idList));
} else { } else {
report.getProjectEnvMap().putAll(getPlanProjectEnvMap(idList)); Map<String, List<String>> projectEnvMap = getPlanProjectEnvMap(idList);
if (MapUtils.isNotEmpty(projectEnvMap)) {
for (Map.Entry<String, List<String>> entry : projectEnvMap.entrySet()) {
String project = entry.getKey();
List<String> envList = entry.getValue();
if (report.getProjectEnvMap().containsKey(project)) {
for (String env : envList) {
if (!report.getProjectEnvMap().get(project).contains(env)) {
report.getProjectEnvMap().get(project).add(env);
}
}
} else {
report.getProjectEnvMap().put(project, envList);
}
}
}
} }
} catch (Exception e) { } catch (Exception e) {
LogUtil.error(e); LogUtil.error(e);

View File

@ -1,19 +1,19 @@
import {post, get, socket} from "metersphere-frontend/src/plugins/request"; import { get, post, socket } from "metersphere-frontend/src/plugins/request";
import {getCurrentProjectID} from "metersphere-frontend/src/utils/token"; import { getCurrentProjectID } from "metersphere-frontend/src/utils/token";
import {buildListPagePath} from "@/api/base-network"; import { buildListPagePath } from "@/api/base-network";
const BASE_URL = '/test/plan/'; const BASE_URL = "/test/plan/";
export function testPlanList(page, param) { export function testPlanList(page, param) {
return post(BASE_URL + buildListPagePath(page), param); return post(BASE_URL + buildListPagePath(page), param);
} }
export function testPlanListAll(param) { export function testPlanListAll(param) {
return post(BASE_URL + 'list/all', param); return post(BASE_URL + "list/all", param);
} }
export function testPlanEdit(param) { export function testPlanEdit(param) {
return post(BASE_URL + 'edit', param); return post(BASE_URL + "edit", param);
} }
export function testPlanEditStatus(id) { export function testPlanEditStatus(id) {
@ -25,7 +25,7 @@ export function testPlanFresh(planId) {
} }
export function testPlanAdd(param) { export function testPlanAdd(param) {
return post(BASE_URL + 'add', param); return post(BASE_URL + "add", param);
} }
export function testPlanCopy(planId) { export function testPlanCopy(planId) {
@ -37,23 +37,23 @@ export function testPlanDelete(planId) {
} }
export function testPlanUpdateScheduleEnable(param) { export function testPlanUpdateScheduleEnable(param) {
return post(BASE_URL + 'update/schedule/enable', param); return post(BASE_URL + "update/schedule/enable", param);
} }
export function testPlanGetEnableScheduleCount(param) { export function testPlanGetEnableScheduleCount(param) {
return post(BASE_URL + 'schedule/enable/total', param); return post(BASE_URL + "schedule/enable/total", param);
} }
export function testPlanRunBatch(param) { export function testPlanRunBatch(param) {
return post(BASE_URL + 'run/batch', param); return post(BASE_URL + "run/batch", param);
} }
export function testPlanRunSave(param) { export function testPlanRunSave(param) {
return post(BASE_URL + 'run/save', param); return post(BASE_URL + "run/save", param);
} }
export function testPlanRun(param) { export function testPlanRun(param) {
return post(BASE_URL + 'run', param); return post(BASE_URL + "run", param);
} }
export function testPlanHaveUiCase(id) { export function testPlanHaveUiCase(id) {
@ -81,7 +81,7 @@ export function testPlanGetFollow(id) {
} }
export function testPlanEditRunConfig(param) { export function testPlanEditRunConfig(param) {
return post(BASE_URL + 'edit/run/config', param); return post(BASE_URL + "edit/run/config", param);
} }
export function testPlanEditFollows(id, param) { export function testPlanEditFollows(id, param) {
@ -90,215 +90,293 @@ export function testPlanEditFollows(id, param) {
export function getTestPlanReport(planId) { export function getTestPlanReport(planId) {
if (planId) { if (planId) {
return get(BASE_URL + 'report/' + planId); return get(BASE_URL + "report/real-time/" + planId);
} }
} }
export function testPlanRelevance(param) { export function testPlanRelevance(param) {
return post(BASE_URL + 'relevance', param); return post(BASE_URL + "relevance", param);
} }
export function getShareTestPlanReport(shareId, planId) { export function getShareTestPlanReport(shareId, planId) {
return planId ? get('/share/test/plan/report/' + shareId + '/' + planId) : new Promise(() => {}); return planId
? get("/share/test/plan/report/" + shareId + "/" + planId)
: new Promise(() => {});
} }
export function planApiTestCasePage(page, pageSize, params) { export function planApiTestCasePage(page, pageSize, params) {
return post(BASE_URL + 'api/case/relevance/list/' + page + '/' + pageSize, params); return post(
BASE_URL + "api/case/relevance/list/" + page + "/" + pageSize,
params
);
} }
export function editPlanReport(param) { export function editPlanReport(param) {
return post(BASE_URL + 'edit/report', param); return post(BASE_URL + "edit/report", param);
} }
export function editPlanReportConfig(param) { export function editPlanReportConfig(param) {
return post(BASE_URL + 'edit/report/config', param); return post(BASE_URL + "edit/report/config", param);
} }
export function getExportReport(planId) { export function getExportReport(planId) {
return planId ? get(BASE_URL + 'get/report/export/' + planId) : new Promise(() => {}); return planId
? get(BASE_URL + "get/report/export/" + planId)
: new Promise(() => {});
} }
export function getTestPlanReportContent(reportId) { export function getTestPlanReportContent(reportId) {
return reportId ? get(BASE_URL + 'report/db/' + reportId) : new Promise(() => {}); return reportId
? get(BASE_URL + "report/db/" + reportId)
: new Promise(() => {});
} }
export function getShareTestPlanReportContent(shareId, reportId) { export function getShareTestPlanReportContent(shareId, reportId) {
return reportId ? get('/share/test/plan/report/db/' + shareId + '/' + reportId) : new Promise(() => {}); return reportId
? get("/share/test/plan/report/db/" + shareId + "/" + reportId)
: new Promise(() => {});
} }
export function getPlanFunctionAllCase(planId, param) { export function getPlanFunctionAllCase(planId, param) {
return planId ? post(BASE_URL + 'case/list/all/' + planId, param) : new Promise(() => {}); return planId
? post(BASE_URL + "case/list/all/" + planId, param)
: new Promise(() => {});
} }
export function getSharePlanFunctionAllCase(shareId, planId, param) { export function getSharePlanFunctionAllCase(shareId, planId, param) {
return planId ? post('/share/test/plan/case/list/all/' + shareId + '/' + planId, param) : new Promise(() => {}); return planId
? post("/share/test/plan/case/list/all/" + shareId + "/" + planId, param)
: new Promise(() => {});
} }
export function getPlanScenarioFailureCase(planId) { export function getPlanScenarioFailureCase(planId) {
return planId ? get(BASE_URL + 'scenario/case/list/failure/' + planId) : new Promise(() => {}); return planId
? get(BASE_URL + "scenario/case/list/failure/" + planId)
: new Promise(() => {});
} }
export function getPlanScenarioErrorReportCase(planId) { export function getPlanScenarioErrorReportCase(planId) {
return planId ? get(BASE_URL + 'scenario/case/list/error-report/' + planId) : new Promise(() => {}); return planId
? get(BASE_URL + "scenario/case/list/error-report/" + planId)
: new Promise(() => {});
} }
export function getPlanScenarioUnExecuteCase(planId) { export function getPlanScenarioUnExecuteCase(planId) {
return planId ? get(BASE_URL + 'scenario/case/list/pending/' + planId) : new Promise(() => {}); return planId
? get(BASE_URL + "scenario/case/list/pending/" + planId)
: new Promise(() => {});
} }
export function getPlanScenarioAllCase(planId) { export function getPlanScenarioAllCase(planId) {
return planId ? get(BASE_URL + 'scenario/case/list/all/' + planId) : new Promise(() => {}); return planId
? get(BASE_URL + "scenario/case/list/all/" + planId)
: new Promise(() => {});
} }
export function getSharePlanScenarioFailureCase(shareId, planId) { export function getSharePlanScenarioFailureCase(shareId, planId) {
return planId ? get('/share/test/plan/scenario/case/list/failure/' + shareId + '/' + planId) : new Promise(() => {}); return planId
? get(
"/share/test/plan/scenario/case/list/failure/" + shareId + "/" + planId
)
: new Promise(() => {});
} }
export function getSharePlanScenarioAllCase(shareId, planId) { export function getSharePlanScenarioAllCase(shareId, planId) {
return planId ? get('/share/test/plan/scenario/case/list/all/' + shareId + '/' + planId) : new Promise(() => {}); return planId
? get("/share/test/plan/scenario/case/list/all/" + shareId + "/" + planId)
: new Promise(() => {});
} }
export function getSharePlanScenarioErrorReportCase(shareId, planId) { export function getSharePlanScenarioErrorReportCase(shareId, planId) {
return planId ? get('/share/test/plan/scenario/case/list/errorReport/' + shareId + '/' + planId) : new Promise(() => {}); return planId
? get(
"/share/test/plan/scenario/case/list/errorReport/" +
shareId +
"/" +
planId
)
: new Promise(() => {});
} }
export function getSharePlanScenarioUnExecuteCase(shareId, planId) { export function getSharePlanScenarioUnExecuteCase(shareId, planId) {
return planId ? get('/share/test/plan/scenario/case/list/unExecute/' + shareId + '/' + planId) : new Promise(() => {}); return planId
? get(
"/share/test/plan/scenario/case/list/unExecute/" +
shareId +
"/" +
planId
)
: new Promise(() => {});
} }
export function getSharePlanUiScenarioAllCase(shareId, planId, param) { export function getSharePlanUiScenarioAllCase(shareId, planId, param) {
return planId ? post('/share/test/plan/uiScenario/case/list/all/' + shareId + '/' + planId, param) : new Promise(() => {}); return planId
? post(
"/share/test/plan/uiScenario/case/list/all/" + shareId + "/" + planId,
param
)
: new Promise(() => {});
} }
export function getPlanApiFailureCase(planId) { export function getPlanApiFailureCase(planId) {
return planId ? get(BASE_URL + 'api/case/list/failure/' + planId) : new Promise(() => {}); return planId
? get(BASE_URL + "api/case/list/failure/" + planId)
: new Promise(() => {});
} }
export function getPlanApiErrorReportCase(planId) { export function getPlanApiErrorReportCase(planId) {
return planId ? get(BASE_URL + 'api/case/list/errorReport/' + planId) : new Promise(() => {}); return planId
? get(BASE_URL + "api/case/list/errorReport/" + planId)
: new Promise(() => {});
} }
export function getPlanApiUnExecuteCase(planId) { export function getPlanApiUnExecuteCase(planId) {
return planId ? get(BASE_URL + 'api/case/list/unExecute/' + planId) : new Promise(() => {}); return planId
? get(BASE_URL + "api/case/list/unExecute/" + planId)
: new Promise(() => {});
} }
export function getPlanApiAllCase(planId) { export function getPlanApiAllCase(planId) {
return planId ? get(BASE_URL + 'api/case/list/all/' + planId) : new Promise(() => {}); return planId
? get(BASE_URL + "api/case/list/all/" + planId)
: new Promise(() => {});
} }
export function getSharePlanApiFailureCase(shareId, planId) { export function getSharePlanApiFailureCase(shareId, planId) {
return planId ? get('/share/test/plan/api/case/list/failure/' + shareId + '/' + planId) : new Promise(() => {}); return planId
? get("/share/test/plan/api/case/list/failure/" + shareId + "/" + planId)
: new Promise(() => {});
} }
export function getSharePlanApiErrorReportCase(shareId, planId) { export function getSharePlanApiErrorReportCase(shareId, planId) {
return planId ? get('/share/test/plan/api/case/list/errorReport/' + shareId + '/' + planId) : new Promise(() => {}); return planId
? get(
"/share/test/plan/api/case/list/errorReport/" + shareId + "/" + planId
)
: new Promise(() => {});
} }
export function getSharePlanApiUnExecuteCase(shareId, planId) { export function getSharePlanApiUnExecuteCase(shareId, planId) {
return planId ? get('/share/test/plan/api/case/list/unExecute/' + shareId + '/' + planId) : new Promise(() => {}); return planId
? get("/share/test/plan/api/case/list/unExecute/" + shareId + "/" + planId)
: new Promise(() => {});
} }
export function getSharePlanApiAllCase(shareId, planId) { export function getSharePlanApiAllCase(shareId, planId) {
return planId ? get('/share/test/plan/api/case/list/all/' + shareId + '/' + planId) : new Promise(() => {}); return planId
? get("/share/test/plan/api/case/list/all/" + shareId + "/" + planId)
: new Promise(() => {});
} }
export function getPlanLoadFailureCase(planId) { export function getPlanLoadFailureCase(planId) {
return planId ? get(BASE_URL + 'load/case/list/failure/' + planId) : new Promise(() => {}); return planId
? get(BASE_URL + "load/case/list/failure/" + planId)
: new Promise(() => {});
} }
export function getPlanLoadAllCase(planId) { export function getPlanLoadAllCase(planId) {
return planId ? get(BASE_URL + 'load/case/list/all/' + planId) : new Promise(() => {}); return planId
? get(BASE_URL + "load/case/list/all/" + planId)
: new Promise(() => {});
} }
export function getSharePlanLoadFailureCase(shareId, planId) { export function getSharePlanLoadFailureCase(shareId, planId) {
return planId ? get('/share/test/plan/load/case/list/failure/' + shareId + '/' + planId) : new Promise(() => {}); return planId
? get("/share/test/plan/load/case/list/failure/" + shareId + "/" + planId)
: new Promise(() => {});
} }
export function getSharePlanLoadAllCase(shareId, planId) { export function getSharePlanLoadAllCase(shareId, planId) {
return planId ? get('/share/test/plan/load/case/list/all/' + shareId + '/' + planId) : new Promise(() => {}); return planId
? get("/share/test/plan/load/case/list/all/" + shareId + "/" + planId)
: new Promise(() => {});
} }
export function checkoutLoadReport(param) { export function checkoutLoadReport(param) {
return post(BASE_URL + 'load/case/report/exist', param); return post(BASE_URL + "load/case/report/exist", param);
} }
export function shareCheckoutLoadReport(shareId, param) { export function shareCheckoutLoadReport(shareId, param) {
return post('/share/test/plan/load/case/report/exist/' + shareId, param); return post("/share/test/plan/load/case/report/exist/" + shareId, param);
} }
export function editTestPlanTestCaseOrder(request) { export function editTestPlanTestCaseOrder(request) {
return post(BASE_URL + 'case/edit/order', request); return post(BASE_URL + "case/edit/order", request);
} }
export function editTestPlanApiCaseOrder(request) { export function editTestPlanApiCaseOrder(request) {
return post(BASE_URL + 'api/case/edit/order', request); return post(BASE_URL + "api/case/edit/order", request);
} }
export function editTestPlanScenarioCaseOrder(request) { export function editTestPlanScenarioCaseOrder(request) {
return post(BASE_URL + 'scenario/case/edit/order', request); return post(BASE_URL + "scenario/case/edit/order", request);
} }
export function editTestPlanUiScenarioCaseOrder(request) { export function editTestPlanUiScenarioCaseOrder(request) {
return post(BASE_URL + 'uiScenario/case/edit/order', request); return post(BASE_URL + "uiScenario/case/edit/order", request);
} }
export function editTestPlanLoadCaseOrder(request) { export function editTestPlanLoadCaseOrder(request) {
return post(BASE_URL + 'load/case/edit/order', request); return post(BASE_URL + "load/case/edit/order", request);
} }
export function getPlanStageOption() { export function getPlanStageOption() {
let projectID = getCurrentProjectID(); let projectID = getCurrentProjectID();
return projectID ? get(BASE_URL + 'get/stage/option/' + projectID) : new Promise(() => {}); return projectID
? get(BASE_URL + "get/stage/option/" + projectID)
: new Promise(() => {});
} }
export function saveTestPlanReport(planId) { export function saveTestPlanReport(planId) {
return planId ? get(BASE_URL + 'report/saveTestPlanReport/' + planId + '/MANUAL') : new Promise(() => {}); return planId
? get(BASE_URL + "report/saveTestPlanReport/" + planId + "/MANUAL")
: new Promise(() => {});
} }
export function getPlanUiScenarioAllCase(planId, param) { export function getPlanUiScenarioAllCase(planId, param) {
return planId ? post(BASE_URL + 'uiScenario/case/list/all/' + planId, param) : new Promise(() => {}); return planId
? post(BASE_URL + "uiScenario/case/list/all/" + planId, param)
: new Promise(() => {});
} }
export function updatePlanSchedule(param) { export function updatePlanSchedule(param) {
return post(BASE_URL + 'schedule/update/disable', param); return post(BASE_URL + "schedule/update/disable", param);
} }
export function updateScheduleEnableByPrimyKey(param) { export function updateScheduleEnableByPrimyKey(param) {
return post(BASE_URL + 'schedule/update/enable', param); return post(BASE_URL + "schedule/update/enable", param);
} }
export function getPlanSchedule(planId, taskType) {
export function getPlanSchedule(planId,taskType){ return get(BASE_URL + "schedule/get/" + planId + "/" + taskType);
return get(BASE_URL + 'schedule/get/'+ planId + '/'+taskType);
} }
export function updateBatchScheduleEnable(param) { export function updateBatchScheduleEnable(param) {
return post(BASE_URL + 'schedule/Batch/updateEnable', param); return post(BASE_URL + "schedule/Batch/updateEnable", param);
} }
export function batchDeletePlan(param) { export function batchDeletePlan(param) {
return post(BASE_URL + 'delete/batch', param); return post(BASE_URL + "delete/batch", param);
} }
export function createSchedule(param){ export function createSchedule(param) {
return post(BASE_URL + 'schedule/create',param); return post(BASE_URL + "schedule/create", param);
} }
export function updateSchedule(param){ export function updateSchedule(param) {
return post(BASE_URL + 'schedule/update',param); return post(BASE_URL + "schedule/update", param);
} }
export function getApiScenarioEnv(param) { export function getApiScenarioEnv(param) {
return post(BASE_URL + 'api/scenario/env', param); return post(BASE_URL + "api/scenario/env", param);
} }
export function getPlanCaseEnv(param) { export function getPlanCaseEnv(param) {
return post(BASE_URL + 'case/env', param); return post(BASE_URL + "case/env", param);
} }
export function getPlanCaseProjectIds(param) { export function getPlanCaseProjectIds(param) {
return post(BASE_URL + 'case/relevance/project/ids', param); return post(BASE_URL + "case/relevance/project/ids", param);
} }
export function run(testId, reportId) { export function run(testId, reportId) {
@ -306,7 +384,7 @@ export function run(testId, reportId) {
} }
export function reportSocket(reportId) { export function reportSocket(reportId) {
return socket('/websocket/plan/api/' + reportId); return socket("/websocket/plan/api/" + reportId);
} }
export function testPlanLoadCaseEditStatus(planId) { export function testPlanLoadCaseEditStatus(planId) {
@ -315,9 +393,9 @@ export function testPlanLoadCaseEditStatus(planId) {
export function getTestPlanExtReport(planId, reportId) { export function getTestPlanExtReport(planId, reportId) {
if (reportId) { if (reportId) {
return get(BASE_URL + 'ext/report/' + reportId); return get(BASE_URL + "ext/report/" + reportId);
} else if (planId) { } else if (planId) {
return get(BASE_URL + 'ext/plan/' + planId); return get(BASE_URL + "ext/plan/" + planId);
} else { } else {
return new Promise(() => {}); return new Promise(() => {});
} }
@ -325,11 +403,10 @@ export function getTestPlanExtReport(planId, reportId) {
export function getShareTestPlanExtReport(shareId, planId, reportId) { export function getShareTestPlanExtReport(shareId, planId, reportId) {
if (reportId) { if (reportId) {
return get('/share' + BASE_URL + `ext/report/${shareId}/${reportId}`); return get("/share" + BASE_URL + `ext/report/${shareId}/${reportId}`);
} else if (planId) { } else if (planId) {
return get('/share' + BASE_URL + `ext/plan/${shareId}/${planId}`); return get("/share" + BASE_URL + `ext/plan/${shareId}/${planId}`);
} else { } else {
return new Promise(() => {}); return new Promise(() => {});
} }
} }