fix(测试跟踪): 功能用例缺陷与测试计划缺陷分离
This commit is contained in:
parent
85c47f165c
commit
7f9a7af0f5
|
@ -27,4 +27,6 @@ public interface ExtIssuesMapper {
|
||||||
List<IssuesDao>getCountByStatus(@Param("request") IssuesRequest issuesRequest);
|
List<IssuesDao>getCountByStatus(@Param("request") IssuesRequest issuesRequest);
|
||||||
|
|
||||||
List<String> selectIdNotInUuIds(@Param("projectId") String projectId, @Param("platform") String platform, @Param("platformIds") List<String> platformIds);
|
List<String> selectIdNotInUuIds(@Param("projectId") String projectId, @Param("platform") String platform, @Param("platformIds") List<String> platformIds);
|
||||||
|
|
||||||
|
List<IssuesDao> getPlanIssues(@Param("request") IssuesRequest issueRequest);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
inner join test_case_issues
|
inner join test_case_issues
|
||||||
on test_case_issues.issues_id = issues.id
|
on test_case_issues.issues_id = issues.id
|
||||||
<include refid="queryWhereCondition"/>
|
<include refid="queryWhereCondition"/>
|
||||||
and (issues.platform_status != 'delete' or issues.platform_status is NULL)
|
|
||||||
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
|
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
@ -37,20 +36,38 @@
|
||||||
order by num asc
|
order by num asc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getIssues" resultType="io.metersphere.base.domain.IssuesDao">
|
<sql id="Issue_List_Column">
|
||||||
select issues.id, issues.platform_id, issues.num, ifnull(issues.title, '') as title, issues.project_id, issues.create_time, issues.update_time,
|
issues.id, issues.platform_id, issues.num, ifnull(issues.title, '') as title, issues.project_id, issues.create_time, issues.update_time,
|
||||||
ifnull(issues.description, '') as description, issues.status, issues.platform, issues.custom_fields, issues.reporter,
|
ifnull(issues.description, '') as description, issues.status, issues.platform, issues.custom_fields, issues.reporter,
|
||||||
issues.creator,issues.resource_id,issues.platform_status,
|
issues.creator,issues.resource_id,issues.platform_status,
|
||||||
issues.lastmodify
|
issues.lastmodify
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="getIssues" resultType="io.metersphere.base.domain.IssuesDao">
|
||||||
|
select
|
||||||
|
<include refid="Issue_List_Column"/>
|
||||||
from issues
|
from issues
|
||||||
<if test="request.projectId != null||request.workspaceId != null">
|
<if test="request.projectId != null||request.workspaceId != null">
|
||||||
left join
|
left join
|
||||||
project on issues.project_id = project.id
|
project on issues.project_id = project.id
|
||||||
</if>
|
</if>
|
||||||
<include refid="queryWhereCondition"/>
|
<include refid="queryWhereCondition"/>
|
||||||
and (issues.platform_status != 'delete' or issues.platform_status is NULL)
|
|
||||||
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
|
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getPlanIssues" resultType="io.metersphere.base.domain.IssuesDao">
|
||||||
|
select
|
||||||
|
<include refid="Issue_List_Column"/>
|
||||||
|
from issues
|
||||||
|
inner join test_case_issues
|
||||||
|
on issues.id = test_case_issues.issues_id and test_case_issues.ref_type = 'PLAN_FUNCTIONAL'
|
||||||
|
and test_case_issues.resource_id in (
|
||||||
|
select id from test_plan_test_case tptc where plan_id = #{request.planId}
|
||||||
|
)
|
||||||
|
<include refid="queryWhereCondition"/>
|
||||||
|
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="getNextNum" resultType="io.metersphere.base.domain.Issues">
|
<select id="getNextNum" resultType="io.metersphere.base.domain.Issues">
|
||||||
SELECT * FROM issues WHERE issues.project_id = #{projectId} ORDER BY num DESC LIMIT 1;
|
SELECT * FROM issues WHERE issues.project_id = #{projectId} ORDER BY num DESC LIMIT 1;
|
||||||
</select>
|
</select>
|
||||||
|
@ -66,10 +83,8 @@
|
||||||
issues.lastmodify
|
issues.lastmodify
|
||||||
from issues
|
from issues
|
||||||
left join
|
left join
|
||||||
test_case_issues on issues.id = test_case_issues.issues_id
|
test_case_issues on issues.id = test_case_issues.issues_id and issues.project_id = #{request.projectId}
|
||||||
<include refid="queryWhereCondition"/>
|
<include refid="queryWhereCondition"/>
|
||||||
and (test_case_issues.resource_id is null or test_case_issues.resource_id != #{request.caseResourceId})
|
|
||||||
and (issues.platform_status != 'delete' or issues.platform_status is NULL)
|
|
||||||
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
|
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
|
||||||
group by issues.id
|
group by issues.id
|
||||||
</select>
|
</select>
|
||||||
|
@ -130,6 +145,12 @@
|
||||||
<if test="request.id != null and request.id != ''">
|
<if test="request.id != null and request.id != ''">
|
||||||
and issues.id = #{request.id}
|
and issues.id = #{request.id}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="request.notInIds != null and request.notInIds.size() > 0">
|
||||||
|
and issues.id not in
|
||||||
|
<foreach collection="request.notInIds" item="value" separator="," open="(" close=")">
|
||||||
|
#{value}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
|
||||||
<if test="request.filters != null and request.filters.size() > 0">
|
<if test="request.filters != null and request.filters.size() > 0">
|
||||||
<foreach collection="request.filters.entrySet()" index="key" item="values">
|
<foreach collection="request.filters.entrySet()" index="key" item="values">
|
||||||
|
@ -157,7 +178,7 @@
|
||||||
</if>
|
</if>
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
and (issues.platform_status != 'delete' or issues.platform_status is NULL)
|
||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="combine">
|
<sql id="combine">
|
||||||
|
|
|
@ -249,8 +249,8 @@
|
||||||
<select id="getProjectPlanBugSize" resultType="java.lang.Integer">
|
<select id="getProjectPlanBugSize" resultType="java.lang.Integer">
|
||||||
select count(distinct (tci.issues_id))
|
select count(distinct (tci.issues_id))
|
||||||
from test_plan_test_case tptc
|
from test_plan_test_case tptc
|
||||||
join test_case_issues tci on tptc.case_id = tci.resource_id
|
join test_case_issues tci on tptc.id = tci.resource_id
|
||||||
right join test_case on test_case.id = tci.resource_id
|
right join test_case on test_case.id = tci.ref_id
|
||||||
join issues on tci.issues_id = issues.id
|
join issues on tci.issues_id = issues.id
|
||||||
join test_plan on tptc.plan_id = test_plan.id
|
join test_plan on tptc.plan_id = test_plan.id
|
||||||
where test_plan.project_id = #{projectId}
|
where test_plan.project_id = #{projectId}
|
||||||
|
|
|
@ -724,9 +724,9 @@
|
||||||
<select id="getTestPlanBug" resultType="int">
|
<select id="getTestPlanBug" resultType="int">
|
||||||
select count(distinct (tci.issues_id))
|
select count(distinct (tci.issues_id))
|
||||||
from test_plan_test_case tptc
|
from test_plan_test_case tptc
|
||||||
join test_case_issues tci on tptc.case_id = tci.resource_id
|
join test_case_issues tci on tptc.id = tci.resource_id
|
||||||
right join test_case
|
right join test_case
|
||||||
on test_case.id = tci.resource_id
|
on test_case.id = tci.ref_id
|
||||||
join issues
|
join issues
|
||||||
on tci.issues_id = issues.id
|
on tci.issues_id = issues.id
|
||||||
where tptc.plan_id = #{planId}
|
where tptc.plan_id = #{planId}
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class ShareController {
|
||||||
@GetMapping("/issues/plan/get/{shareId}/{planId}")
|
@GetMapping("/issues/plan/get/{shareId}/{planId}")
|
||||||
public List<IssuesDao> getIssuesByPlanoId(@PathVariable String shareId, @PathVariable String planId) {
|
public List<IssuesDao> getIssuesByPlanoId(@PathVariable String shareId, @PathVariable String planId) {
|
||||||
shareInfoService.validate(shareId, planId);
|
shareInfoService.validate(shareId, planId);
|
||||||
return issuesService.getIssuesByPlanoId(planId);
|
return issuesService.getIssuesByPlanId(planId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/test/plan/report/{shareId}/{planId}")
|
@GetMapping("/test/plan/report/{shareId}/{planId}")
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class IssuesController {
|
||||||
@GetMapping("/plan/get/{planId}")
|
@GetMapping("/plan/get/{planId}")
|
||||||
@RequiresPermissions(PermissionConstants.PROJECT_TRACK_ISSUE_READ)
|
@RequiresPermissions(PermissionConstants.PROJECT_TRACK_ISSUE_READ)
|
||||||
public List<IssuesDao> getIssuesByPlanId(@PathVariable String planId) {
|
public List<IssuesDao> getIssuesByPlanId(@PathVariable String planId) {
|
||||||
return issuesService.getIssuesByPlanoId(planId);
|
return issuesService.getIssuesByPlanId(planId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/auth/{workspaceId}/{platform}")
|
@GetMapping("/auth/{workspaceId}/{platform}")
|
||||||
|
|
|
@ -43,9 +43,11 @@ public class IssuesRequest extends BaseQueryRequest {
|
||||||
private String platform;
|
private String platform;
|
||||||
private String customFields;
|
private String customFields;
|
||||||
private List<String> testCaseIds;
|
private List<String> testCaseIds;
|
||||||
|
private List<String> notInIds;
|
||||||
|
|
||||||
private String requestType;
|
private String requestType;
|
||||||
private String status;
|
private String status;
|
||||||
private String defaultCustomFields;
|
private String defaultCustomFields;
|
||||||
private Boolean isPlanEdit = false;
|
private Boolean isPlanEdit = false;
|
||||||
|
private String planId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -272,7 +272,7 @@ public class IssuesService {
|
||||||
example.createCriteria().andIssuesIdEqualTo(id);
|
example.createCriteria().andIssuesIdEqualTo(id);
|
||||||
List<TestCaseIssues> testCaseIssues = testCaseIssuesMapper.selectByExample(example);
|
List<TestCaseIssues> testCaseIssues = testCaseIssuesMapper.selectByExample(example);
|
||||||
testCaseIssues.forEach(i -> {
|
testCaseIssues.forEach(i -> {
|
||||||
if (i.getRefType().equals(IssueRefType.PLAN_FUNCTIONAL)) {
|
if (i.getRefType().equals(IssueRefType.PLAN_FUNCTIONAL.name())) {
|
||||||
testCaseIssueService.updateIssuesCount(i.getResourceId());
|
testCaseIssueService.updateIssuesCount(i.getResourceId());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -335,14 +335,21 @@ public class IssuesService {
|
||||||
if (planMap.get(item.getResourceId()) != null) {
|
if (planMap.get(item.getResourceId()) != null) {
|
||||||
item.setResourceName(planMap.get(item.getResourceId()));
|
item.setResourceName(planMap.get(item.getResourceId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
TestCaseIssuesExample example = new TestCaseIssuesExample();
|
TestCaseIssuesExample example = new TestCaseIssuesExample();
|
||||||
example.createCriteria().andIssuesIdEqualTo(item.getId());
|
example.createCriteria().andIssuesIdEqualTo(item.getId());
|
||||||
List<TestCaseIssues> testCaseIssues = testCaseIssuesMapper.selectByExample(example);
|
List<TestCaseIssues> testCaseIssues = testCaseIssuesMapper.selectByExample(example);
|
||||||
List<String> caseIds = testCaseIssues.stream()
|
Set<String> caseIdSet = new HashSet<>();
|
||||||
.map(TestCaseIssues::getResourceId)
|
testCaseIssues.forEach(i -> {
|
||||||
.collect(Collectors.toList());
|
if (i.getRefType().equals(IssueRefType.PLAN_FUNCTIONAL.name())) {
|
||||||
item.setCaseIds(caseIds);
|
caseIdSet.add(i.getRefId());
|
||||||
item.setCaseCount(testCaseIssues.size());
|
} else {
|
||||||
|
caseIdSet.add(i.getResourceId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
item.setCaseIds(new ArrayList<>(caseIdSet));
|
||||||
|
item.setCaseCount(caseIdSet.size());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (StringUtils.equals(item.getPlatform(), IssuesManagePlatform.Tapd.name())) {
|
if (StringUtils.equals(item.getPlatform(), IssuesManagePlatform.Tapd.name())) {
|
||||||
TapdPlatform platform = (TapdPlatform) IssueFactory.createPlatform(item.getPlatform(), request);
|
TapdPlatform platform = (TapdPlatform) IssueFactory.createPlatform(item.getPlatform(), request);
|
||||||
|
@ -540,7 +547,7 @@ public class IssuesService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IssuesDao> relateList(IssuesRequest request) {
|
public List<IssuesDao> relateList(IssuesRequest request) {
|
||||||
return extIssuesMapper.getRelateIssues(request);
|
return extIssuesMapper.getIssues(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void userAuth(AuthUserIssueRequest authUserIssueRequest) {
|
public void userAuth(AuthUserIssueRequest authUserIssueRequest) {
|
||||||
|
@ -577,10 +584,20 @@ public class IssuesService {
|
||||||
functionResult.setIssueData(statusResult);
|
functionResult.setIssueData(statusResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IssuesDao> getIssuesByPlanoId(String planId) {
|
public List<IssuesDao> getIssuesByPlanId(String planId) {
|
||||||
IssuesRequest issueRequest = new IssuesRequest();
|
IssuesRequest issueRequest = new IssuesRequest();
|
||||||
issueRequest.setResourceId(planId);
|
issueRequest.setPlanId(planId);
|
||||||
return extIssuesMapper.getIssues(issueRequest);
|
List<IssuesDao> planIssues = extIssuesMapper.getPlanIssues(issueRequest);
|
||||||
|
Set<String> ids = new HashSet<>(planIssues.size());
|
||||||
|
Iterator<IssuesDao> iterator = planIssues.iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
IssuesDao next = iterator.next();
|
||||||
|
if (ids.contains(next.getId())) {
|
||||||
|
iterator.remove();
|
||||||
|
}
|
||||||
|
ids.add(next.getId());
|
||||||
|
}
|
||||||
|
return planIssues;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void changeStatus(IssuesRequest request) {
|
public void changeStatus(IssuesRequest request) {
|
||||||
|
|
|
@ -1397,7 +1397,7 @@ public class TestPlanService {
|
||||||
report.setFunctionFailureCases(failureCases);
|
report.setFunctionFailureCases(failureCases);
|
||||||
}
|
}
|
||||||
if (checkReportConfig(config, "functional", "issue")) {
|
if (checkReportConfig(config, "functional", "issue")) {
|
||||||
List<IssuesDao> issueList = issuesService.getIssuesByPlanoId(planId);
|
List<IssuesDao> issueList = issuesService.getIssuesByPlanId(planId);
|
||||||
report.setIssueList(issueList);
|
report.setIssueList(issueList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,6 +93,7 @@ export default {
|
||||||
props: {
|
props: {
|
||||||
caseId: String,
|
caseId: String,
|
||||||
planCaseId: String,
|
planCaseId: String,
|
||||||
|
notInIds: Array,
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
isThirdPartEnable((data) => {
|
isThirdPartEnable((data) => {
|
||||||
|
@ -106,7 +107,7 @@ export default {
|
||||||
},
|
},
|
||||||
getIssues() {
|
getIssues() {
|
||||||
this.page.condition.projectId = this.projectId;
|
this.page.condition.projectId = this.projectId;
|
||||||
this.page.condition.caseResourceId = this.getCaseResourceId();
|
this.page.condition.notInIds = this.notInIds;
|
||||||
this.page.result = getRelateIssues(this.page);
|
this.page.result = getRelateIssues(this.page);
|
||||||
},
|
},
|
||||||
getCaseResourceId() {
|
getCaseResourceId() {
|
||||||
|
|
|
@ -95,6 +95,7 @@
|
||||||
<IssueRelateList
|
<IssueRelateList
|
||||||
:plan-case-id="planCaseId"
|
:plan-case-id="planCaseId"
|
||||||
:case-id="caseId"
|
:case-id="caseId"
|
||||||
|
:not-in-ids="notInIds"
|
||||||
@refresh="getIssues"
|
@refresh="getIssues"
|
||||||
ref="issueRelate"/>
|
ref="issueRelate"/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -145,6 +146,9 @@ export default {
|
||||||
issueStatusMap() {
|
issueStatusMap() {
|
||||||
return ISSUE_STATUS_MAP;
|
return ISSUE_STATUS_MAP;
|
||||||
},
|
},
|
||||||
|
notInIds() {
|
||||||
|
return this.page.data ? this.page.data.map(i => i.id) : [];
|
||||||
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
getIssuePartTemplateWithProject((template, project) => {
|
getIssuePartTemplateWithProject((template, project) => {
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
</ms-table>
|
</ms-table>
|
||||||
|
|
||||||
<test-case-relate-list
|
<test-case-relate-list
|
||||||
|
:test-case-contain-ids="testCaseContainIds"
|
||||||
@refresh="initTableData"
|
@refresh="initTableData"
|
||||||
@save="handleRelate"
|
@save="handleRelate"
|
||||||
ref="testCaseRelevance"/>
|
ref="testCaseRelevance"/>
|
||||||
|
@ -72,6 +73,7 @@ export default {
|
||||||
tableData: [],
|
tableData: [],
|
||||||
deleteIds: new Set(),
|
deleteIds: new Set(),
|
||||||
addIds: new Set(),
|
addIds: new Set(),
|
||||||
|
testCaseContainIds: new Set(),
|
||||||
operators: [
|
operators: [
|
||||||
{
|
{
|
||||||
tip: this.$t('commons.delete'), icon: "el-icon-delete", type: "danger",
|
tip: this.$t('commons.delete'), icon: "el-icon-delete", type: "danger",
|
||||||
|
@ -85,6 +87,7 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleDelete(item, index) {
|
handleDelete(item, index) {
|
||||||
|
this.testCaseContainIds.delete(item.id);
|
||||||
this.tableData.splice(index, 1);
|
this.tableData.splice(index, 1);
|
||||||
this.deleteIds.add(item.id);
|
this.deleteIds.add(item.id);
|
||||||
},
|
},
|
||||||
|
@ -96,6 +99,9 @@ export default {
|
||||||
if (this.issuesId) {
|
if (this.issuesId) {
|
||||||
this.result = this.$post('test/case/issues/list', condition, response => {
|
this.result = this.$post('test/case/issues/list', condition, response => {
|
||||||
this.tableData = response.data;
|
this.tableData = response.data;
|
||||||
|
this.tableData.forEach(item => {
|
||||||
|
this.testCaseContainIds.add(item.id);
|
||||||
|
});
|
||||||
this.$refs.table.reloadTable();
|
this.$refs.table.reloadTable();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -106,6 +112,9 @@ export default {
|
||||||
handleRelate(selectRows) {
|
handleRelate(selectRows) {
|
||||||
let selectData = Array.from(selectRows);
|
let selectData = Array.from(selectRows);
|
||||||
selectRows.forEach(i => {
|
selectRows.forEach(i => {
|
||||||
|
if (i.id) {
|
||||||
|
this.testCaseContainIds.add(i.id);
|
||||||
|
}
|
||||||
this.deleteIds.delete(i.id);
|
this.deleteIds.delete(i.id);
|
||||||
this.addIds.add(i.id);
|
this.addIds.add(i.id);
|
||||||
});
|
});
|
||||||
|
|
|
@ -107,6 +107,12 @@ export default {
|
||||||
selectNodeIds: [],
|
selectNodeIds: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
props: {
|
||||||
|
testCaseContainIds: {
|
||||||
|
type: Set,
|
||||||
|
default: new Set()
|
||||||
|
}
|
||||||
|
},
|
||||||
watch: {
|
watch: {
|
||||||
selectNodeIds() {
|
selectNodeIds() {
|
||||||
this.initTableData();
|
this.initTableData();
|
||||||
|
@ -132,6 +138,7 @@ export default {
|
||||||
if (this.projectId) {
|
if (this.projectId) {
|
||||||
this.getProjectNode();
|
this.getProjectNode();
|
||||||
this.condition.projectId = this.projectId;
|
this.condition.projectId = this.projectId;
|
||||||
|
this.condition.testCaseContainIds = Array.from(this.testCaseContainIds)
|
||||||
this.result = this.$post('/test/case/relate/issue/' + +this.currentPage + '/' + this.pageSize, this.condition, response => {
|
this.result = this.$post('/test/case/relate/issue/' + +this.currentPage + '/' + this.pageSize, this.condition, response => {
|
||||||
let data = response.data;
|
let data = response.data;
|
||||||
this.total = data.itemCount;
|
this.total = data.itemCount;
|
||||||
|
|
Loading…
Reference in New Issue