Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
af2dbf2994
|
@ -12,4 +12,5 @@ public interface ExtTestPlanLoadCaseMapper {
|
|||
List<TestPlanLoadCaseDTO> selectTestPlanLoadCaseList(@Param("request") LoadCaseRequest request);
|
||||
void updateCaseStatus(@Param("reportId") String reportId, @Param("status") String status);
|
||||
List<String> getStatusByTestPlanId(@Param("planId") String planId);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
package io.metersphere.commons.constants;
|
||||
|
||||
public enum TestCaseStatus {
|
||||
performance,api,testcase,automation
|
||||
}
|
|
@ -23,4 +23,6 @@ public class PlanCaseRelevanceRequest {
|
|||
* 具体要关联的用例
|
||||
*/
|
||||
private List<String> testCaseIds = new ArrayList<>();
|
||||
|
||||
private Boolean checked;
|
||||
}
|
||||
|
|
|
@ -24,4 +24,6 @@ public class ReviewRelevanceRequest {
|
|||
* 具体选择要关联的用例
|
||||
*/
|
||||
private List<String> testCaseIds = new ArrayList<>();
|
||||
|
||||
private Boolean checked;
|
||||
}
|
||||
|
|
|
@ -6,10 +6,7 @@ import io.metersphere.base.mapper.ext.ExtProjectMapper;
|
|||
import io.metersphere.base.mapper.ext.ExtTestCaseMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtTestCaseReviewMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtTestReviewCaseMapper;
|
||||
import io.metersphere.commons.constants.NoticeConstants;
|
||||
import io.metersphere.commons.constants.TestCaseReviewStatus;
|
||||
import io.metersphere.commons.constants.TestPlanStatus;
|
||||
import io.metersphere.commons.constants.TestReviewCaseStatus;
|
||||
import io.metersphere.commons.constants.*;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.user.SessionUser;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
|
@ -77,6 +74,19 @@ public class TestCaseReviewService {
|
|||
private NoticeSendService noticeSendService;
|
||||
@Resource
|
||||
private SystemParameterService systemParameterService;
|
||||
@Resource
|
||||
private TestCaseReviewLoadMapper testCaseReviewLoadMapper;
|
||||
@Resource
|
||||
private TestCaseReviewApiCaseMapper testCaseReviewApiCaseMapper;
|
||||
@Resource
|
||||
private TestCaseReviewScenarioMapper testCaseReviewScenarioMapper;
|
||||
@Resource
|
||||
private ApiTestCaseMapper apiTestCaseMapper;
|
||||
@Resource
|
||||
private ApiScenarioMapper apiScenarioMapper;
|
||||
@Resource
|
||||
private ApiDefinitionMapper apiDefinitionMapper;
|
||||
|
||||
|
||||
public String saveTestCaseReview(SaveTestCaseReviewRequest reviewRequest) {
|
||||
checkCaseReviewExist(reviewRequest);
|
||||
|
@ -366,7 +376,65 @@ public class TestCaseReviewService {
|
|||
}
|
||||
|
||||
sqlSession.flushStatements();
|
||||
//同步添加关联的接口和测试用例
|
||||
if(request.getChecked()){
|
||||
if (!testCaseIds.isEmpty()) {
|
||||
testCaseIds.forEach(caseId -> {
|
||||
TestCaseWithBLOBs testDtail=testCaseMapper.selectByPrimaryKey(caseId);
|
||||
if(StringUtils.equals(testDtail.getType(), TestCaseStatus.performance.name())){
|
||||
TestCaseReviewLoad t=new TestCaseReviewLoad();
|
||||
t.setId(UUID.randomUUID().toString());
|
||||
t.setTestCaseReviewId(request.getReviewId());
|
||||
t.setLoadCaseId(testDtail.getTestId());
|
||||
t.setCreateTime(System.currentTimeMillis());
|
||||
t.setUpdateTime(System.currentTimeMillis());
|
||||
TestCaseReviewLoadExample example=new TestCaseReviewLoadExample();
|
||||
example.createCriteria().andTestCaseReviewIdEqualTo(request.getReviewId()).andLoadCaseIdEqualTo(t.getLoadCaseId());
|
||||
if (testCaseReviewLoadMapper.countByExample(example) <=0) {
|
||||
testCaseReviewLoadMapper.insert(t);
|
||||
}
|
||||
|
||||
}
|
||||
if(StringUtils.equals(testDtail.getType(),TestCaseStatus.testcase.name())){
|
||||
TestCaseReviewApiCase t=new TestCaseReviewApiCase();
|
||||
ApiTestCaseWithBLOBs apitest=apiTestCaseMapper.selectByPrimaryKey(testDtail.getTestId());
|
||||
ApiDefinitionWithBLOBs apidefinition=apiDefinitionMapper.selectByPrimaryKey(apitest.getApiDefinitionId());
|
||||
t.setId(UUID.randomUUID().toString());
|
||||
t.setTestCaseReviewId(request.getReviewId());
|
||||
t.setApiCaseId(testDtail.getTestId());
|
||||
t.setEnvironmentId(apidefinition.getEnvironmentId());
|
||||
t.setCreateTime(System.currentTimeMillis());
|
||||
t.setUpdateTime(System.currentTimeMillis());
|
||||
TestCaseReviewApiCaseExample example=new TestCaseReviewApiCaseExample();
|
||||
example.createCriteria().andTestCaseReviewIdEqualTo(request.getReviewId()).andApiCaseIdEqualTo(t.getApiCaseId());
|
||||
if(testCaseReviewApiCaseMapper.countByExample(example)<=0){
|
||||
testCaseReviewApiCaseMapper.insert(t);
|
||||
}
|
||||
|
||||
}
|
||||
if(StringUtils.equals(testDtail.getType(),TestCaseStatus.automation.name())){
|
||||
TestCaseReviewScenario t=new TestCaseReviewScenario();
|
||||
ApiScenarioWithBLOBs testPlanApiScenario=apiScenarioMapper.selectByPrimaryKey(testDtail.getTestId());
|
||||
t.setId(UUID.randomUUID().toString());
|
||||
t.setTestCaseReviewId(request.getReviewId());
|
||||
t.setApiScenarioId(testDtail.getTestId());
|
||||
t.setLastResult(testPlanApiScenario.getLastResult());
|
||||
t.setPassRate(testPlanApiScenario.getPassRate());
|
||||
t.setReportId(testPlanApiScenario.getReportId());
|
||||
t.setStatus(testPlanApiScenario.getStatus());
|
||||
t.setCreateTime(System.currentTimeMillis());
|
||||
t.setUpdateTime(System.currentTimeMillis());
|
||||
TestCaseReviewScenarioExample example=new TestCaseReviewScenarioExample();
|
||||
example.createCriteria().andTestCaseReviewIdEqualTo(request.getReviewId()).andApiScenarioIdEqualTo(t.getApiScenarioId());
|
||||
if(testCaseReviewScenarioMapper.countByExample(example)<=0){
|
||||
testCaseReviewScenarioMapper.insert(t);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
TestCaseReview testCaseReview = testCaseReviewMapper.selectByPrimaryKey(request.getReviewId());
|
||||
if (StringUtils.equals(testCaseReview.getStatus(), TestCaseReviewStatus.Prepare.name())
|
||||
|| StringUtils.equals(testCaseReview.getStatus(), TestCaseReviewStatus.Completed.name())) {
|
||||
|
|
|
@ -114,8 +114,20 @@ public class TestPlanService {
|
|||
private ApiTestCaseService apiTestCaseService;
|
||||
@Resource
|
||||
private PerformanceTestService performanceTestService;
|
||||
@Resource
|
||||
private TestPlanLoadCaseMapper testPlanLoadCaseMapper;
|
||||
@Resource
|
||||
private ApiTestCaseMapper apiTestCaseMapper;
|
||||
@Resource
|
||||
private ApiDefinitionMapper apiDefinitionMapper;
|
||||
@Resource
|
||||
private TestPlanApiCaseMapper testPlanApiCaseMapper;
|
||||
@Resource
|
||||
private TestPlanApiScenarioMapper testPlanApiScenarioMapper;
|
||||
@Resource
|
||||
private ApiScenarioMapper apiScenarioMapper;
|
||||
|
||||
public synchronized void addTestPlan(AddTestPlanRequest testPlan) {
|
||||
public synchronized String addTestPlan(AddTestPlanRequest testPlan) {
|
||||
if (getTestPlanByName(testPlan.getName()).size() > 0) {
|
||||
MSException.throwException(Translator.get("plan_name_already_exists"));
|
||||
}
|
||||
|
@ -144,6 +156,7 @@ public class TestPlanService {
|
|||
.event(NoticeConstants.Event.CREATE)
|
||||
.build();
|
||||
noticeSendService.send(NoticeConstants.TaskType.TEST_PLAN_TASK, noticeModel);
|
||||
return testPlan.getId();
|
||||
}
|
||||
|
||||
public List<TestPlan> getTestPlanByName(String name) {
|
||||
|
@ -416,7 +429,65 @@ public class TestPlanService {
|
|||
}
|
||||
|
||||
sqlSession.flushStatements();
|
||||
//同步添加关联的接口和测试用例
|
||||
if(request.getChecked()){
|
||||
if (!testCaseIds.isEmpty()) {
|
||||
testCaseIds.forEach(caseId -> {
|
||||
TestCaseWithBLOBs testDtail=testCaseMapper.selectByPrimaryKey(caseId);
|
||||
if(StringUtils.equals(testDtail.getType(),TestCaseStatus.performance.name())){
|
||||
TestPlanLoadCase t = new TestPlanLoadCase();
|
||||
t.setId(UUID.randomUUID().toString());
|
||||
t.setTestPlanId(request.getPlanId());
|
||||
t.setLoadCaseId(testDtail.getTestId());
|
||||
t.setCreateTime(System.currentTimeMillis());
|
||||
t.setUpdateTime(System.currentTimeMillis());
|
||||
TestPlanLoadCaseExample testPlanLoadCaseExample=new TestPlanLoadCaseExample();
|
||||
testPlanLoadCaseExample.createCriteria().andTestPlanIdEqualTo(request.getPlanId()).andLoadCaseIdEqualTo(t.getLoadCaseId());
|
||||
if (testPlanLoadCaseMapper.countByExample(testPlanLoadCaseExample) <=0) {
|
||||
testPlanLoadCaseMapper.insert(t);
|
||||
}
|
||||
|
||||
}
|
||||
if(StringUtils.equals(testDtail.getType(),TestCaseStatus.testcase.name())){
|
||||
TestPlanApiCase t=new TestPlanApiCase();
|
||||
ApiTestCaseWithBLOBs apitest=apiTestCaseMapper.selectByPrimaryKey(testDtail.getTestId());
|
||||
ApiDefinitionWithBLOBs apidefinition=apiDefinitionMapper.selectByPrimaryKey(apitest.getApiDefinitionId());
|
||||
t.setId(UUID.randomUUID().toString());
|
||||
t.setTestPlanId(request.getPlanId());
|
||||
t.setApiCaseId(testDtail.getTestId());
|
||||
t.setEnvironmentId(apidefinition.getEnvironmentId());
|
||||
t.setCreateTime(System.currentTimeMillis());
|
||||
t.setUpdateTime(System.currentTimeMillis());
|
||||
TestPlanApiCaseExample example=new TestPlanApiCaseExample();
|
||||
example.createCriteria().andTestPlanIdEqualTo(request.getPlanId()).andApiCaseIdEqualTo(t.getApiCaseId());
|
||||
if(testPlanApiCaseMapper.countByExample(example)<=0){
|
||||
testPlanApiCaseMapper.insert(t);
|
||||
}
|
||||
|
||||
}
|
||||
if(StringUtils.equals(testDtail.getType(),TestCaseStatus.automation.name())){
|
||||
TestPlanApiScenario t=new TestPlanApiScenario();
|
||||
ApiScenarioWithBLOBs testPlanApiScenario=apiScenarioMapper.selectByPrimaryKey(testDtail.getTestId());
|
||||
t.setId(UUID.randomUUID().toString());
|
||||
t.setTestPlanId(request.getPlanId());
|
||||
t.setApiScenarioId(testDtail.getTestId());
|
||||
t.setLastResult(testPlanApiScenario.getLastResult());
|
||||
t.setPassRate(testPlanApiScenario.getPassRate());
|
||||
t.setReportId(testPlanApiScenario.getReportId());
|
||||
t.setStatus(testPlanApiScenario.getStatus());
|
||||
t.setCreateTime(System.currentTimeMillis());
|
||||
t.setUpdateTime(System.currentTimeMillis());
|
||||
TestPlanApiScenarioExample example=new TestPlanApiScenarioExample();
|
||||
example.createCriteria().andTestPlanIdEqualTo(request.getPlanId()).andApiScenarioIdEqualTo(t.getApiScenarioId());
|
||||
if(testPlanApiScenarioMapper.countByExample(example)<=0){
|
||||
testPlanApiScenarioMapper.insert(t);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getPlanId());
|
||||
if (StringUtils.equals(testPlan.getStatus(), TestPlanStatus.Prepare.name())
|
||||
|| StringUtils.equals(testPlan.getStatus(), TestPlanStatus.Completed.name())) {
|
||||
|
|
|
@ -109,6 +109,9 @@
|
|||
@click="savePlan">
|
||||
{{ $t('test_track.confirm') }}
|
||||
</el-button>
|
||||
<el-button type="primary" @click="testPlanInfo">
|
||||
{{ $t('test_track.planning_execution') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
@ -170,6 +173,33 @@ export default {
|
|||
listenGoBack(this.close);
|
||||
this.dialogFormVisible = true;
|
||||
},
|
||||
testPlanInfo() {
|
||||
this.$refs['planFrom'].validate((valid) => {
|
||||
if (valid) {
|
||||
let param = {};
|
||||
Object.assign(param, this.form);
|
||||
param.name = param.name.trim();
|
||||
if (param.name === '') {
|
||||
this.$warning(this.$t('test_track.plan.input_plan_name'));
|
||||
return;
|
||||
}
|
||||
param.workspaceId = localStorage.getItem(WORKSPACE_ID);
|
||||
if (this.form.tags instanceof Array) {
|
||||
this.form.tags = JSON.stringify(this.form.tags);
|
||||
}
|
||||
param.tags = this.form.tags;
|
||||
this.$post('/test/plan/' + this.operationType, param, response => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.dialogFormVisible = false;
|
||||
this.$router.push('/track/plan/view/' + response.data);
|
||||
// 发送广播,刷新 head 上的最新列表
|
||||
TrackEvent.$emit(LIST_CHANGE);
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
savePlan() {
|
||||
this.$refs['planFrom'].validate((valid) => {
|
||||
if (valid) {
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
<template v-slot:header>
|
||||
<ms-table-header :is-tester-permission="true" :condition.sync="condition"
|
||||
@search="initTableData" @create="testPlanCreate"
|
||||
:create-tip="$t('test_track.plan.create_plan')"
|
||||
:title="$t('test_track.plan.test_plan')"
|
||||
:show-create="false"/>
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" v-tester @click="testPlanCreate"/>
|
||||
/>
|
||||
|
||||
</template>
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
},
|
||||
|
||||
save() {
|
||||
this.$emit('save');
|
||||
this.$emit('save', this.checked);
|
||||
},
|
||||
|
||||
close() {
|
||||
|
|
|
@ -158,11 +158,12 @@ export default {
|
|||
this.projectId = projectId;
|
||||
},
|
||||
|
||||
saveCaseRelevance() {
|
||||
saveCaseRelevance(item) {
|
||||
let param = {};
|
||||
param.planId = this.planId;
|
||||
param.testCaseIds = [...this.selectIds];
|
||||
param.request = this.condition;
|
||||
param.checked = item
|
||||
// 选择全选则全部加入到评审,无论是否加载完全部
|
||||
if (this.testCases.length === param.testCaseIds.length) {
|
||||
param.testCaseIds = ['all'];
|
||||
|
|
|
@ -203,6 +203,7 @@ export default {
|
|||
param.reviewId = this.reviewId;
|
||||
param.testCaseIds = [...this.selectIds];
|
||||
param.request = this.condition;
|
||||
param.checked = this.checked;
|
||||
// 选择全选则全部加入到评审,无论是否加载完全部
|
||||
if (this.testReviews.length === param.testCaseIds.length) {
|
||||
param.testCaseIds = ['all'];
|
||||
|
|
Loading…
Reference in New Issue