Merge branch 'master' of https://github.com/metersphere/metersphere
This commit is contained in:
commit
7489fcaec3
|
@ -102,7 +102,12 @@
|
|||
<if test="request.orders != null and request.orders.size() > 0">
|
||||
ORDER BY
|
||||
<foreach collection="request.orders" separator="," item="order">
|
||||
load_test.${order.name} ${order.type}
|
||||
<if test="order.name == 'user_name'">
|
||||
user_name ${order.type}
|
||||
</if>
|
||||
<if test="order.name != 'user_name'">
|
||||
load_test.${order.name} ${order.type}
|
||||
</if>
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -238,9 +238,11 @@ public class PerformanceTestService {
|
|||
// 相减
|
||||
List<String> deleteFileIds = ListUtils.subtract(originFileIds, updatedFileIds);
|
||||
// 删除已经不相关的文件
|
||||
LoadTestFileExample example3 = new LoadTestFileExample();
|
||||
example3.createCriteria().andFileIdIn(deleteFileIds);
|
||||
loadTestFileMapper.deleteByExample(example3);
|
||||
if (!CollectionUtils.isEmpty(deleteFileIds)) {
|
||||
LoadTestFileExample example3 = new LoadTestFileExample();
|
||||
example3.createCriteria().andFileIdIn(deleteFileIds);
|
||||
loadTestFileMapper.deleteByExample(example3);
|
||||
}
|
||||
|
||||
// 导入项目里其他的文件
|
||||
List<String> addFileIds = ListUtils.subtract(updatedFileIds, originFileIds);
|
||||
|
|
|
@ -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())) {
|
||||
|
|
|
@ -147,6 +147,9 @@ alter table schedule drop column custom_data;
|
|||
-- add sort column
|
||||
alter table load_test_file add sort int default 0;
|
||||
|
||||
alter table file_metadata
|
||||
add project_id VARCHAR(50) null;
|
||||
|
||||
UPDATE file_metadata JOIN (SELECT file_id, project_id
|
||||
FROM load_test_file
|
||||
JOIN load_test ON test_id = load_test.id) temp ON file_id = file_metadata.id
|
||||
|
|
|
@ -199,7 +199,7 @@ export default {
|
|||
});
|
||||
|
||||
},
|
||||
beforeUploadFile(file) {
|
||||
async beforeUploadFile(file) {
|
||||
if (!this.fileValidator(file)) {
|
||||
/// todo: 显示错误信息
|
||||
return false;
|
||||
|
@ -215,7 +215,8 @@ export default {
|
|||
async function f() {
|
||||
return await axios.post('/performance/file/' + getCurrentProjectID() + '/getMetadataByName', {filename: file.name})
|
||||
}
|
||||
f().then(res => {
|
||||
|
||||
await f().then(res => {
|
||||
let response = res.data;
|
||||
if (response.data.length === 0) {
|
||||
let type = file.name.substring(file.name.lastIndexOf(".") + 1);
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
|
||||
<script>
|
||||
import MsDialogFooter from "../../common/components/MsDialogFooter";
|
||||
import {listenGoBack, removeGoBackListener} from "../../../../common/js/utils";
|
||||
import {listenGoBack, publicKeyEncrypt, removeGoBackListener} from "../../../../common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "LdapSetting",
|
||||
|
@ -204,9 +204,15 @@ export default {
|
|||
})
|
||||
},
|
||||
login(form) {
|
||||
let publicKey = localStorage.getItem("publicKey");
|
||||
|
||||
this.$refs[form].validate(valid => {
|
||||
if (valid) {
|
||||
this.result = this.$post("/ldap/test/login", this.loginForm, () => {
|
||||
let form = {
|
||||
username: publicKeyEncrypt(this.loginForm.username, publicKey),
|
||||
password: publicKeyEncrypt(this.loginForm.password, publicKey),
|
||||
};
|
||||
this.result = this.$post("/ldap/test/login", form, () => {
|
||||
this.$success(this.$t('ldap.login_success'));
|
||||
});
|
||||
} else {
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
<slot name="footer"></slot>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div style="margin-bottom: 15px;margin-right: 0">
|
||||
<el-checkbox v-model="checked">同步添加关联的接口和性能测试</el-checkbox>
|
||||
</div>
|
||||
<ms-dialog-footer @cancel="close" @confirm="save"/>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -41,6 +44,7 @@
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
checked: true,
|
||||
result: {},
|
||||
currentProject: {},
|
||||
projectId: '',
|
||||
|
@ -70,7 +74,7 @@
|
|||
},
|
||||
|
||||
save() {
|
||||
this.$emit('save');
|
||||
this.$emit('save', this.checked);
|
||||
},
|
||||
|
||||
close() {
|
||||
|
|
|
@ -63,10 +63,6 @@
|
|||
|
||||
<div v-if="!lineStatus" style="text-align: center">{{ $t('test_track.review_view.last_page') }}</div>
|
||||
<div style="text-align: center">共 {{ total }} 条</div>
|
||||
<div style="margin-bottom: 15px;margin-right: 0">
|
||||
<el-checkbox v-model="checked">同步添加关联的接口和性能测试</el-checkbox>
|
||||
</div>
|
||||
|
||||
</test-case-relevance-base>
|
||||
|
||||
</template>
|
||||
|
@ -162,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'];
|
||||
|
|
|
@ -133,6 +133,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
checked: true,
|
||||
result: {},
|
||||
currentProject: {},
|
||||
dialogFormVisible: false,
|
||||
|
@ -202,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