fix(测试跟踪): 修复接口调用没有关联可执行用例测试计划执行时没有提示的缺陷
--bug=1015449 --user=王孝刚 [测试计划]github#16371测试计划里只包含功能用例,在页面无法执行,但是调用API可以执行,且可正常生成报告,报告里无任何信息 https://www.tapd.cn/55049933/s/1214486
This commit is contained in:
parent
b229ed1645
commit
4f191b3744
|
@ -0,0 +1,13 @@
|
||||||
|
package io.metersphere.base.mapper.ext;
|
||||||
|
|
||||||
|
import io.metersphere.base.domain.TestPlanUiScenario;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ExtTestPlanUiScenarioMapper {
|
||||||
|
|
||||||
|
List<TestPlanUiScenario> selectByIdsAndStatusIsNotTrash(@Param("ids") List<String> ids);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="io.metersphere.base.mapper.ext.ExtTestPlanUiScenarioMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectByIdsAndStatusIsNotTrash" resultType="io.metersphere.base.domain.TestPlanUiScenario">
|
||||||
|
SELECT
|
||||||
|
plan.*
|
||||||
|
FROM
|
||||||
|
test_plan_ui_scenario plan
|
||||||
|
INNER JOIN ui_scenario ui ON plan.ui_scenario_id = ui.id
|
||||||
|
WHERE
|
||||||
|
(ui.`status` is null OR ui.`status` != 'Trash') AND plan.id IN
|
||||||
|
<foreach collection="ids" item="v" separator="," open="(" close=")">
|
||||||
|
#{v}
|
||||||
|
</foreach>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</mapper>
|
|
@ -189,6 +189,10 @@ public class TestPlanService {
|
||||||
private TestPlanUiScenarioMapper testPlanUiScenarioMapper;
|
private TestPlanUiScenarioMapper testPlanUiScenarioMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private ExtTestPlanUiScenarioCaseMapper extTestPlanUiScenarioCaseMapper;
|
private ExtTestPlanUiScenarioCaseMapper extTestPlanUiScenarioCaseMapper;
|
||||||
|
@Resource
|
||||||
|
private ExtTestPlanApiScenarioMapper extTestPlanApiScenarioMapper;
|
||||||
|
@Resource
|
||||||
|
private ExtTestPlanUiScenarioMapper extTestPlanUiScenarioMapper;
|
||||||
|
|
||||||
public synchronized TestPlan addTestPlan(AddTestPlanRequest testPlan) {
|
public synchronized TestPlan addTestPlan(AddTestPlanRequest testPlan) {
|
||||||
if (getTestPlanByName(testPlan.getName()).size() > 0) {
|
if (getTestPlanByName(testPlan.getName()).size() > 0) {
|
||||||
|
@ -1426,6 +1430,7 @@ public class TestPlanService {
|
||||||
* 如果配置了全部用例返回空的数组
|
* 如果配置了全部用例返回空的数组
|
||||||
* 如果没有,则添加对应的状态
|
* 如果没有,则添加对应的状态
|
||||||
* 都没配置就返回 null
|
* 都没配置就返回 null
|
||||||
|
*
|
||||||
* @param config
|
* @param config
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -2058,6 +2063,10 @@ public class TestPlanService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String runPlan(TestplanRunRequest testplanRunRequest) {
|
public String runPlan(TestplanRunRequest testplanRunRequest) {
|
||||||
|
//检查测试计划下有没有可以执行的用例;
|
||||||
|
if (!haveExecCase(testplanRunRequest.getTestPlanId()) || !haveUiCase(testplanRunRequest.getTestPlanId())) {
|
||||||
|
MSException.throwException(Translator.get("plan_warning"));
|
||||||
|
}
|
||||||
String envType = testplanRunRequest.getEnvironmentType();
|
String envType = testplanRunRequest.getEnvironmentType();
|
||||||
Map<String, String> envMap = testplanRunRequest.getEnvMap();
|
Map<String, String> envMap = testplanRunRequest.getEnvMap();
|
||||||
String environmentGroupId = testplanRunRequest.getEnvironmentGroupId();
|
String environmentGroupId = testplanRunRequest.getEnvironmentGroupId();
|
||||||
|
@ -2137,16 +2146,14 @@ public class TestPlanService {
|
||||||
if (StringUtils.isBlank(id)) {
|
if (StringUtils.isBlank(id)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
TestPlanApiCaseExample apiCaseExample = new TestPlanApiCaseExample();
|
List<String> ids = new ArrayList<>();
|
||||||
apiCaseExample.createCriteria().andTestPlanIdEqualTo(id);
|
ids.add(id);
|
||||||
List<TestPlanApiCase> testPlanApiCases = testPlanApiCaseMapper.selectByExample(apiCaseExample);
|
List<TestPlanApiCase> testPlanApiCases = extTestPlanApiCaseMapper.selectByIdsAndStatusIsNotTrash(ids);
|
||||||
if (!CollectionUtils.isEmpty(testPlanApiCases)) {
|
if (!CollectionUtils.isEmpty(testPlanApiCases)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TestPlanApiScenarioExample apiScenarioExample = new TestPlanApiScenarioExample();
|
List<TestPlanApiScenario> testPlanApiScenarios = extTestPlanApiScenarioMapper.selectByIdsAndStatusIsNotTrash(ids);
|
||||||
apiScenarioExample.createCriteria().andTestPlanIdEqualTo(id);
|
|
||||||
List<TestPlanApiScenario> testPlanApiScenarios = testPlanApiScenarioMapper.selectByExample(apiScenarioExample);
|
|
||||||
if (!CollectionUtils.isEmpty(testPlanApiScenarios)) {
|
if (!CollectionUtils.isEmpty(testPlanApiScenarios)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2295,6 +2302,8 @@ public class TestPlanService {
|
||||||
Map<String, String> executeQueue = new LinkedHashMap<>();
|
Map<String, String> executeQueue = new LinkedHashMap<>();
|
||||||
|
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
//检查测试计划下是否有可执行的用例
|
||||||
|
StringBuilder haveExecCaseBuilder = new StringBuilder();
|
||||||
for (int i = 0; i < planList.size(); i++) {
|
for (int i = 0; i < planList.size(); i++) {
|
||||||
if (StringUtils.isBlank(planList.get(i).getRunModeConfig())) {
|
if (StringUtils.isBlank(planList.get(i).getRunModeConfig())) {
|
||||||
StringBuilder append = stringBuilder.append("请保存[").append(planList.get(i).getName()).append("]的运行配置");
|
StringBuilder append = stringBuilder.append("请保存[").append(planList.get(i).getName()).append("]的运行配置");
|
||||||
|
@ -2302,12 +2311,19 @@ public class TestPlanService {
|
||||||
append.append("/");
|
append.append("/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!haveExecCase(planList.get(i).getId()) || !haveUiCase(planList.get(i).getId())) {
|
||||||
|
haveExecCaseBuilder.append(planList.get(i).getName()).append("; ");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isNotEmpty(stringBuilder)) {
|
if (StringUtils.isNotEmpty(stringBuilder)) {
|
||||||
MSException.throwException(stringBuilder.toString());
|
MSException.throwException(stringBuilder.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotEmpty(haveExecCaseBuilder)) {
|
||||||
|
MSException.throwException(Translator.get("track_test_plan") + ": " + haveExecCaseBuilder.toString() + ": " + Translator.get("plan_warning"));
|
||||||
|
}
|
||||||
|
|
||||||
for (String id : ids) {
|
for (String id : ids) {
|
||||||
TestPlanWithBLOBs testPlan = testPlanMap.get(id);
|
TestPlanWithBLOBs testPlan = testPlanMap.get(id);
|
||||||
String planReportId = UUID.randomUUID().toString();
|
String planReportId = UUID.randomUUID().toString();
|
||||||
|
@ -2389,9 +2405,9 @@ public class TestPlanService {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TestPlanUiScenarioExample uiScenarioExample = new TestPlanUiScenarioExample();
|
List<String> ids = new ArrayList<>();
|
||||||
uiScenarioExample.createCriteria().andTestPlanIdEqualTo(id);
|
ids.add(id);
|
||||||
List<TestPlanUiScenario> testPlanUiScenarios = testPlanUiScenarioMapper.selectByExample(uiScenarioExample);
|
List<TestPlanUiScenario> testPlanUiScenarios = extTestPlanUiScenarioMapper.selectByIdsAndStatusIsNotTrash(ids);
|
||||||
return !CollectionUtils.isEmpty(testPlanUiScenarios);
|
return !CollectionUtils.isEmpty(testPlanUiScenarios);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 0c786599f916ed6afc78915f9325457ac52e298b
|
Subproject commit 1965e5d82cd95cc8ceb8ee5a072acd7380849249
|
|
@ -405,3 +405,4 @@ ui_element_already_exists_excel=There are duplicate data in the import file
|
||||||
ui_element_already_exists_data=An element with the same name already exists
|
ui_element_already_exists_data=An element with the same name already exists
|
||||||
serial=Serial
|
serial=Serial
|
||||||
parallel=Parallel
|
parallel=Parallel
|
||||||
|
plan_warning=The test plan does not have an associated executable use case
|
||||||
|
|
|
@ -404,3 +404,4 @@ ui_element_already_exists_excel=文件中存在多条相同数据
|
||||||
ui_element_already_exists_data=已经存在同名元素
|
ui_element_already_exists_data=已经存在同名元素
|
||||||
serial=串行
|
serial=串行
|
||||||
parallel=并行
|
parallel=并行
|
||||||
|
plan_warning=测试计划没有关联可执行的用例
|
||||||
|
|
|
@ -403,3 +403,4 @@ ui_element_already_exists_excel=文件中存在多條相同數據
|
||||||
ui_element_already_exists_data=已經存在同名元素
|
ui_element_already_exists_data=已經存在同名元素
|
||||||
serial=串行
|
serial=串行
|
||||||
parallel=並行
|
parallel=並行
|
||||||
|
plan_warning=測試計劃沒有關聯可執行的用例
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 0b367ee1d426d6bbbfe935d64c5680bcf2db704c
|
Subproject commit 311095fddb07b11b034b139152a59810cd5ed7d1
|
|
@ -2154,7 +2154,7 @@ export default {
|
||||||
batch_copy: '批量复制',
|
batch_copy: '批量复制',
|
||||||
batch_add_public: '批量添加到公共用例库',
|
batch_add_public: '批量添加到公共用例库',
|
||||||
batch_link_demand: '批量关联需求',
|
batch_link_demand: '批量关联需求',
|
||||||
public_warning: '未开启公共库用例配置',
|
public_warning: '未开启公共用例库配置',
|
||||||
generate_dependencies: '生成依赖关系',
|
generate_dependencies: '生成依赖关系',
|
||||||
generate_dependencies_warning: '为了更好的体验,建议勾选一百条以下的数据',
|
generate_dependencies_warning: '为了更好的体验,建议勾选一百条以下的数据',
|
||||||
batch_unlink: '批量取消关联',
|
batch_unlink: '批量取消关联',
|
||||||
|
|
|
@ -2149,7 +2149,7 @@ export default {
|
||||||
batch_copy: '批量復製',
|
batch_copy: '批量復製',
|
||||||
batch_add_public: '批量添加到公共用例庫',
|
batch_add_public: '批量添加到公共用例庫',
|
||||||
batch_link_demand: '批量關聯需求',
|
batch_link_demand: '批量關聯需求',
|
||||||
public_warning: '未開啟公共庫用例配置',
|
public_warning: '未開啟公共用例庫配置',
|
||||||
generate_dependencies: '生成依賴關系',
|
generate_dependencies: '生成依賴關系',
|
||||||
generate_dependencies_warning: '為了更好的體驗,建議勾選一百條以下的數據',
|
generate_dependencies_warning: '為了更好的體驗,建議勾選一百條以下的數據',
|
||||||
batch_unlink: '批量取消關聯',
|
batch_unlink: '批量取消關聯',
|
||||||
|
|
Loading…
Reference in New Issue