feat(测试计划): 计划统计添加通过阈值
This commit is contained in:
parent
5f2accc982
commit
0a23c86363
|
@ -1,8 +1,11 @@
|
||||||
package io.metersphere.plan.service;
|
package io.metersphere.plan.service;
|
||||||
|
|
||||||
|
import io.metersphere.plan.domain.TestPlanConfig;
|
||||||
|
import io.metersphere.plan.domain.TestPlanConfigExample;
|
||||||
import io.metersphere.plan.domain.TestPlanFunctionalCase;
|
import io.metersphere.plan.domain.TestPlanFunctionalCase;
|
||||||
import io.metersphere.plan.dto.response.TestPlanStatisticsResponse;
|
import io.metersphere.plan.dto.response.TestPlanStatisticsResponse;
|
||||||
import io.metersphere.plan.mapper.ExtTestPlanFunctionalCaseMapper;
|
import io.metersphere.plan.mapper.ExtTestPlanFunctionalCaseMapper;
|
||||||
|
import io.metersphere.plan.mapper.TestPlanConfigMapper;
|
||||||
import io.metersphere.sdk.constants.FunctionalCaseExecuteResult;
|
import io.metersphere.sdk.constants.FunctionalCaseExecuteResult;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
@ -18,6 +21,8 @@ import java.util.stream.Collectors;
|
||||||
@Service
|
@Service
|
||||||
public class TestPlanStatisticsService {
|
public class TestPlanStatisticsService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TestPlanConfigMapper testPlanConfigMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private ExtTestPlanFunctionalCaseMapper extTestPlanFunctionalCaseMapper;
|
private ExtTestPlanFunctionalCaseMapper extTestPlanFunctionalCaseMapper;
|
||||||
|
|
||||||
|
@ -65,6 +70,11 @@ public class TestPlanStatisticsService {
|
||||||
rateFormat.setMinimumFractionDigits(2);
|
rateFormat.setMinimumFractionDigits(2);
|
||||||
rateFormat.setMaximumFractionDigits(2);
|
rateFormat.setMaximumFractionDigits(2);
|
||||||
|
|
||||||
|
// 计划的更多配置
|
||||||
|
TestPlanConfigExample example = new TestPlanConfigExample();
|
||||||
|
example.createCriteria().andTestPlanIdIn(planIds);
|
||||||
|
List<TestPlanConfig> testPlanConfigList = testPlanConfigMapper.selectByExample(example);
|
||||||
|
Map<String, TestPlanConfig> planConfigMap = testPlanConfigList.stream().collect(Collectors.toMap(TestPlanConfig::getTestPlanId, p -> p));
|
||||||
// 计划-功能用例的关联数据
|
// 计划-功能用例的关联数据
|
||||||
List<TestPlanFunctionalCase> planFunctionalCases = extTestPlanFunctionalCaseMapper.getPlanFunctionalCaseByIds(planIds);
|
List<TestPlanFunctionalCase> planFunctionalCases = extTestPlanFunctionalCaseMapper.getPlanFunctionalCaseByIds(planIds);
|
||||||
Map<String, List<TestPlanFunctionalCase>> planFunctionalCaseMap = planFunctionalCases.stream().collect(Collectors.groupingBy(TestPlanFunctionalCase::getTestPlanId));
|
Map<String, List<TestPlanFunctionalCase>> planFunctionalCaseMap = planFunctionalCases.stream().collect(Collectors.groupingBy(TestPlanFunctionalCase::getTestPlanId));
|
||||||
|
@ -72,6 +82,7 @@ public class TestPlanStatisticsService {
|
||||||
planIds.forEach(planId -> {
|
planIds.forEach(planId -> {
|
||||||
TestPlanStatisticsResponse statisticsResponse = new TestPlanStatisticsResponse();
|
TestPlanStatisticsResponse statisticsResponse = new TestPlanStatisticsResponse();
|
||||||
statisticsResponse.setId(planId);
|
statisticsResponse.setId(planId);
|
||||||
|
statisticsResponse.setPassThreshold(planConfigMap.get(planId).getPassThreshold());
|
||||||
int success = 0, error = 0, fakeError = 0, block = 0, pending = 0;
|
int success = 0, error = 0, fakeError = 0, block = 0, pending = 0;
|
||||||
// 功能用例统计开始
|
// 功能用例统计开始
|
||||||
List<TestPlanFunctionalCase> functionalCases = planFunctionalCaseMap.get(planId);
|
List<TestPlanFunctionalCase> functionalCases = planFunctionalCaseMap.get(planId);
|
||||||
|
|
|
@ -33,7 +33,8 @@ VALUES
|
||||||
INSERT INTO `test_plan_config`(`test_plan_id`, `automatic_status_update`, `repeat_case`, `pass_threshold`, `test_planning`)
|
INSERT INTO `test_plan_config`(`test_plan_id`, `automatic_status_update`, `repeat_case`, `pass_threshold`, `test_planning`)
|
||||||
VALUES
|
VALUES
|
||||||
('wx_test_plan_id_1', b'0', b'0', 100, b'0'),
|
('wx_test_plan_id_1', b'0', b'0', 100, b'0'),
|
||||||
('wx_test_plan_id_4', b'0', b'0', 100, b'0');
|
('wx_test_plan_id_4', b'0', b'0', 100, b'0'),
|
||||||
|
('wx_test_plan_id_7', b'0', b'0', 100, b'0');
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time, module_setting)
|
INSERT INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time, module_setting)
|
||||||
|
|
Loading…
Reference in New Issue