This commit is contained in:
fit2-zhao 2021-03-24 17:25:07 +08:00
commit 5b4740f838
6 changed files with 41 additions and 30 deletions

View File

@ -5,7 +5,6 @@ import io.metersphere.api.service.*;
import io.metersphere.base.domain.ApiDefinitionExecResult;
import io.metersphere.base.domain.ApiScenarioReport;
import io.metersphere.base.domain.ApiTestReport;
import io.metersphere.base.domain.TestPlanReport;
import io.metersphere.commons.constants.*;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.LogUtil;
@ -15,7 +14,6 @@ import io.metersphere.notice.sender.NoticeModel;
import io.metersphere.notice.service.NoticeSendService;
import io.metersphere.service.SystemParameterService;
import io.metersphere.track.service.TestPlanReportService;
import io.metersphere.track.service.TestPlanService;
import io.metersphere.track.service.TestPlanTestCaseService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -206,7 +204,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
} else {
apiDefinitionExecResultService.saveApiResult(testResult, ApiRunMode.API_PLAN.name());
}
} else if (StringUtils.equalsAny(this.runMode, ApiRunMode.SCENARIO.name(), ApiRunMode.SCENARIO_PLAN.name(), ApiRunMode.SCHEDULE_SCENARIO_PLAN.name())) {
} else if (StringUtils.equalsAny(this.runMode, ApiRunMode.SCENARIO.name(), ApiRunMode.SCENARIO_PLAN.name(), ApiRunMode.SCHEDULE_SCENARIO_PLAN.name(),ApiRunMode.SCHEDULE_SCENARIO.name())) {
// 执行报告不需要存储由用户确认后在存储
testResult.setTestId(testId);
ApiScenarioReport scenarioReport = apiScenarioReportService.complete(testResult, this.runMode);

View File

@ -149,10 +149,11 @@ public class ApiTestCaseService {
public ApiTestCaseWithBLOBs get(String id) {
// ApiTestCaseWithBLOBs returnBlobs = apiTestCaseMapper.selectByPrimaryKey(id);
ApiTestCaseInfo model = extApiTestCaseMapper.selectApiCaseInfoByPrimaryKey(id);
if(StringUtils.equalsIgnoreCase(model.getApiMethod(),"esb")){
esbApiParamService.handleApiEsbParams(model);
if(model != null ){
if(StringUtils.equalsIgnoreCase(model.getApiMethod(),"esb")){
esbApiParamService.handleApiEsbParams(model);
}
}
return model;
}

View File

@ -1,5 +1,5 @@
package io.metersphere.commons.constants;
public enum ApiRunMode {
RUN, DEBUG, DEFINITION, SCENARIO, API_PLAN, JENKINS_API_PLAN, JENKINS, SCENARIO_PLAN, API, SCHEDULE_API_PLAN, SCHEDULE_SCENARIO_PLAN, SCHEDULE_PERFORMANCE_TEST
RUN, DEBUG, DEFINITION, SCENARIO, API_PLAN, JENKINS_API_PLAN, JENKINS, SCENARIO_PLAN, API, SCHEDULE_API_PLAN, SCHEDULE_SCENARIO,SCHEDULE_SCENARIO_PLAN, SCHEDULE_PERFORMANCE_TEST
}

View File

@ -3,6 +3,7 @@ package io.metersphere.job.sechedule;
import io.metersphere.api.dto.automation.ExecuteType;
import io.metersphere.api.dto.automation.RunScenarioRequest;
import io.metersphere.api.service.ApiAutomationService;
import io.metersphere.commons.constants.ApiRunMode;
import io.metersphere.commons.constants.ReportTriggerMode;
import io.metersphere.commons.constants.ScheduleGroup;
import io.metersphere.commons.utils.CommonBeanFactory;
@ -58,6 +59,7 @@ public class ApiScenarioTestJob extends MsScheduleJob {
request.setExecuteType(ExecuteType.Saved.name());
request.setIds(this.scenarioIds);
request.setReportUserID(this.userId);
request.setRunMode(ApiRunMode.SCHEDULE_SCENARIO.name());
apiAutomationService.run(request);
}

View File

@ -611,6 +611,9 @@ public class TestPlanService {
List<ReportComponent> components = ReportComponentFactory.createComponents(componentIds.toJavaList(String.class), testPlan);
List<Issues> issues = buildFunctionalCaseReport(planId, components);
buildApiCaseReport(planId, components);
buildScenarioCaseReport(planId, components);
buildLoadCaseReport(planId, components);
TestCaseReportMetricDTO testCaseReportMetricDTO = new TestCaseReportMetricDTO();
components.forEach(component -> {

View File

@ -5,9 +5,13 @@
<!--操作按钮-->
<div class="ms-opt-btn">
<el-button v-if="type!='add'" id="inputDelay" type="primary" size="small" @click="saveCase" title="ctrl + s">
{{ $t('commons.save') }}
</el-button>
<ms-table-button v-if="type!='add'" :is-tester-permission="true"
id="inputDelay"
type="primary"
:content="$t('commons.save')"
size="small" @exec="saveCase"
icon=""
title="ctrl + s"/>
<el-dropdown v-else split-button type="primary" class="ms-api-buttion" @click="handleCommand"
@command="handleCommand" size="small" style="float: right;margin-right: 20px">
{{ $t('commons.save') }}
@ -297,10 +301,12 @@ import {ELEMENTS} from "@/business/components/api/automation/scenario/Setting";
import TestCaseComment from "@/business/components/track/case/components/TestCaseComment";
import ReviewCommentItem from "@/business/components/track/review/commom/ReviewCommentItem";
import {API_STATUS, REVIEW_STATUS, TEST} from "@/business/components/api/definition/model/JsonData";
import MsTableButton from "@/business/components/common/components/MsTableButton";
export default {
name: "TestCaseEdit",
components: {
MsTableButton,
ReviewCommentItem,
TestCaseComment, MsPreviousNextButton, MsInputTag, CaseComment, MsDialogFooter, TestCaseAttachment
@ -311,8 +317,8 @@ export default {
multiple: true,
lazy: true,
lazyLoad: ((node, resolve) => {
const { level } = node;
if(node.level==0){
const {level} = node;
if (node.level == 0) {
const nodes = TEST
.map(item => ({
value: item.id,
@ -321,10 +327,10 @@ export default {
}));
resolve(nodes)
}
if(node.level==1){
if (node.level == 1) {
this.testOptions = [];
let url = '';
this.form.type=node.data.value
this.form.type = node.data.value
if (this.form.type === 'testcase' || this.form.type === 'automation') {
url = '/api/' + this.form.type + '/list/' + this.projectId
} else if (this.form.type === 'performance' || this.form.type === 'api') {
@ -347,7 +353,7 @@ export default {
}),
},
options: REVIEW_STATUS,
statuOptions:API_STATUS,
statuOptions: API_STATUS,
comments: [],
result: {},
dialogFormVisible: false,
@ -366,13 +372,13 @@ export default {
desc: '',
result: ''
}],
selected: [],
selected: [],
remark: '',
tags: [],
demandId: '',
demandName: '',
status:'Prepare',
reviewStatus:'Prepare',
status: 'Prepare',
reviewStatus: 'Prepare',
},
readOnly: false,
moduleOptions: [],
@ -465,14 +471,15 @@ export default {
this.saveCase();
} else {
this.saveCase();
let tab={}
tab.name='add'
this.$emit('addTab',tab)}
let tab = {}
tab.name = 'add'
this.$emit('addTab', tab)
}
})
}else {
} else {
this.saveCase();
}
},
},
openComment() {
this.$refs.testCaseComment.open()
},
@ -649,9 +656,9 @@ export default {
this.dialogFormVisible = false;
},
saveCase() {
/*
document.getElementById("inputDelay").focus();
*/
/*
document.getElementById("inputDelay").focus();
*/
// input
this.$refs['caseFrom'].validate((valid) => {
@ -703,7 +710,7 @@ export default {
if (this.form.tags instanceof Array) {
this.form.tags = JSON.stringify(this.form.tags);
}
param.testId=JSON.stringify(this.form.selected)
param.testId = JSON.stringify(this.form.selected)
param.tags = this.form.tags;
param.type = 'functional'
return param;
@ -797,14 +804,14 @@ export default {
},
getDemandOptions() {
if (this.demandOptions.length === 0) {
this.result = {loading : true};
this.result = {loading: true};
this.$get("demand/list/" + this.projectId).then(response => {
this.demandOptions = response.data.data;
this.demandOptions.unshift({id: 'other', name: this.$t('test_track.case.other'), platform: 'Other'})
this.result = {loading : false};
this.result = {loading: false};
}).catch(() => {
this.demandOptions.unshift({id: 'other', name: this.$t('test_track.case.other'), platform: 'Other'})
this.result = {loading : false};
this.result = {loading: false};
})
}
},