This commit is contained in:
chenjianxing 2021-01-28 12:04:52 +08:00
commit 363e58067c
17 changed files with 102 additions and 57 deletions

View File

@ -227,12 +227,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
LogUtil.error(e.getMessage(), e);
}
}
try {
sendTask(report, reportUrl, testResult);
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
}
}
private static void sendTask(ApiTestReport report, String reportUrl, TestResult testResult) {

View File

@ -19,7 +19,7 @@
select
t.id, t.environment_id, t.create_time, t.update_time, t.last_result, t.pass_rate, t.report_id,
c.id as case_id, c.project_id, c.user_id,c.api_scenario_module_id, c.module_path, c.name, c.level,
c.status, c.principal, c.step_total, c.follow_people, c.schedule, c.description,
c.status, c.principal, c.step_total, c.follow_people, c.schedule, c.description, c.tags, c.num,
p.name as project_name, p.id as project_id, u.name as user_name
from
test_plan_api_scenario t
@ -44,7 +44,9 @@
</foreach>
</if>
<if test="request.name != null and request.name!=''">
and c.name like CONCAT('%', #{request.name},'%')
and (c.name like CONCAT('%', #{request.name},'%')
or c.num like CONCAT('%', #{request.name},'%')
or c.tags like CONCAT('%', #{request.name},'%'))
</if>
<if test="request.status != null and request.status!=''">
and t.last_result like CONCAT('%', #{request.status},'%')

View File

@ -20,10 +20,13 @@ public class MailNoticeSender extends AbstractNoticeSender {
private MailService mailService;
private void sendMail(MessageDetail messageDetail, String context, NoticeModel noticeModel) throws MessagingException {
LogUtil.info("发送邮件开始 ");
JavaMailSenderImpl javaMailSender = mailService.getMailSender();
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);
helper.setFrom(javaMailSender.getUsername());
LogUtil.info("发件人地址"+javaMailSender.getUsername());
LogUtil.info("helper"+helper);
helper.setSubject("MeterSphere " + noticeModel.getSubject());
List<String> emails = super.getUserEmails(messageDetail.getUserIds());
String[] users = emails.toArray(new String[0]);
@ -38,6 +41,7 @@ public class MailNoticeSender extends AbstractNoticeSender {
String context = super.getHtmlContext(messageDetail, noticeModel);
try {
sendMail(messageDetail, context, noticeModel);
LogUtil.info("发送邮件结束");
} catch (Exception e) {
LogUtil.error(e);
}

View File

@ -286,8 +286,7 @@
},
response: {}
}
}
,
},
created() {
if (!this.currentScenario.apiScenarioModuleId) {
this.currentScenario.apiScenarioModuleId = "";
@ -857,6 +856,9 @@
if (this.currentScenario.tags != undefined && !(this.currentScenario.tags instanceof Array)) {
this.currentScenario.tags = JSON.parse(this.currentScenario.tags);
}
if (!this.currentScenario.variables) {
this.currentScenario.variables = [];
}
if (this.currentScenario.id) {
this.result = this.$get("/api/automation/getApiScenario/" + this.currentScenario.id, response => {
if (response.data) {
@ -1044,7 +1046,7 @@
.ms-tree >>> .el-icon-caret-right:before {
content: '\e723';
font-size: 18px;
font-size: 20px;
}
.ms-tree >>> .el-tree-node__expand-icon.is-leaf {
@ -1058,6 +1060,6 @@
.ms-tree >>> .el-tree-node__expand-icon.expanded.el-icon-caret-right:before {
color: #7C3985;
content: "\e722";
font-size: 18px;
font-size: 20px;
}
</style>

View File

@ -37,15 +37,17 @@
</el-tooltip>
</div>
</div>
<div class="header">
<el-collapse-transition>
<div v-if="data.active && showCollapse" :draggable="draggable">
<fieldset :disabled="data.disabled" class="ms-fieldset">
<el-divider></el-divider>
<slot></slot>
</fieldset>
</div>
</el-collapse-transition>
</div>
<el-collapse-transition>
<div v-if="data.active && showCollapse" :draggable="draggable">
<fieldset :disabled="data.disabled" style="border: 0px">
<el-divider></el-divider>
<slot></slot>
</fieldset>
</div>
</el-collapse-transition>
</el-card>
</template>
@ -148,5 +150,12 @@
.enable-switch {
margin-right: 10px;
}
fieldset {
padding: 0px;
margin: 0px;
min-width: 100%;
min-inline-size: 0px;
border: 0px;
}
</style>

View File

@ -76,18 +76,20 @@
</el-select>
<el-input size="small" v-model="controller.whileController.value" :placeholder="$t('api_test.value')" v-if="!hasEmptyOperator" style="width: 20%;margin-left: 20px"/>
<span class="ms-span ms-radio">{{$t('loop.timeout')}}</span>
<el-input-number size="small" v-model="controller.whileController.timeout" :placeholder="$t('commons.millisecond')" :max="1000*10000000" :min="1" :step="1000"/>
<el-input-number size="small" v-model="controller.whileController.timeout" :placeholder="$t('commons.millisecond')" :max="1000*10000000" :min="3000" :step="1000"/>
<span class="ms-span ms-radio">ms</span>
</div>
<p class="tip">{{$t('api_test.definition.request.res_param')}} </p>
<el-tabs v-model="activeName">
<el-tab-pane :label="item.name" :name="item.name" v-for="(item,index) in requestResult.scenarios" :key="index">
<div v-for="(result,i) in item.requestResults" :key="i" style="margin-bottom: 5px">
<api-response-component :result="result"/>
</div>
</el-tab-pane>
</el-tabs>
<div>
<el-tabs v-model="activeName" closable class="ms-tabs">
<el-tab-pane :label="item.name" :name="item.name" v-for="(item,index) in requestResult.scenarios" :key="index">
<div v-for="(result,i) in item.requestResults" :key="i" style="margin-bottom: 5px">
<api-response-component :result="result"/>
</div>
</el-tab-pane>
</el-tabs>
</div>
</api-base-component>
@ -331,6 +333,11 @@
margin: 20px 0;
}
.ms-tabs >>> .el-icon-close:before {
content: "";
}
.icon.is-active {
transform: rotate(90deg);
}

View File

@ -35,7 +35,6 @@
this.$refs.nameInput.focus();
}
}
}
</script>

View File

@ -124,7 +124,7 @@ import MsContainer from "../../../../common/components/MsContainer";
import MsBottomContainer from "../BottomContainer";
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
import MsBatchEdit from "../basis/BatchEdit";
import {API_METHOD_COLOUR, CASE_PRIORITY, REQ_METHOD} from "../../model/JsonData";
import {API_METHOD_COLOUR, CASE_PRIORITY, DUBBO_METHOD, REQ_METHOD, SQL_METHOD, TCP_METHOD} from "../../model/JsonData";
import {getBodyUploadFiles, getCurrentProjectID} from "@/common/js/utils";
import ApiListContainer from "./ApiListContainer";
@ -409,6 +409,15 @@ export default {
// }
},
handleEditBatch() {
if(this.currentProtocol =='HTTP'){
this.valueArr.method = REQ_METHOD;
}else if(this.currentProtocol =='TCP'){
this.valueArr.method = TCP_METHOD;
}else if(this.currentProtocol =='SQL'){
this.valueArr.method = SQL_METHOD;
}else if(this.currentProtocol =='DUBBO'){
this.valueArr.method = DUBBO_METHOD;
}
this.$refs.batchEdit.open();
},
batchEdit(form) {

View File

@ -162,11 +162,10 @@
import MsBottomContainer from "../BottomContainer";
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
import MsBatchEdit from "../basis/BatchEdit";
import {API_METHOD_COLOUR, API_STATUS, REQ_METHOD} from "../../model/JsonData";
import {API_METHOD_COLOUR, API_STATUS, REQ_METHOD,TCP_METHOD,SQL_METHOD,DUBBO_METHOD} from "../../model/JsonData";
import {_filter, _sort, getCurrentProjectID} from "@/common/js/utils";
import {WORKSPACE_ID} from '@/common/js/constants';
import ApiListContainer from "./ApiListContainer";
// import MsTableSelectAll from "../../../../common/components/table/MsTableSelectAll";
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
import ApiStatus from "@/business/components/api/definition/components/list/ApiStatus";
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
@ -513,6 +512,15 @@
}
},
handleEditBatch() {
if(this.currentProtocol =='HTTP'){
this.valueArr.method = REQ_METHOD;
}else if(this.currentProtocol =='TCP'){
this.valueArr.method = TCP_METHOD;
}else if(this.currentProtocol =='SQL'){
this.valueArr.method = SQL_METHOD;
}else if(this.currentProtocol =='DUBBO'){
this.valueArr.method = DUBBO_METHOD;
}
this.$refs.batchEdit.open();
},
batchEdit(form) {

View File

@ -86,10 +86,9 @@
import ApiRequestMethodSelect from "../../collapse/ApiRequestMethodSelect";
import {REQUEST_HEADERS} from "@/common/js/constants";
import MsApiVariable from "../../ApiVariable";
import {createComponent} from "../../jmeter/components";
import MsApiAssertions from "../../assertion/ApiAssertions";
import MsApiExtract from "../../extract/ApiExtract";
import {Assertions, Body, Extract, KeyValue} from "../../../model/ApiTestModel";
import {Body, KeyValue} from "../../../model/ApiTestModel";
import {getUUID} from "@/common/js/utils";
import BatchAddParameter from "../../basis/BatchAddParameter";
import MsApiAdvancedConfig from "./ApiAdvancedConfig";

View File

@ -8,7 +8,9 @@
</el-tab-pane>
<el-tab-pane :label="$t('api_test.definition.request.response_header')" name="headers" class="pane">
<pre>{{ response.responseResult.headers }}</pre>
<div style="width: 400px">
<pre>{{ response.responseResult.headers }}</pre>
</div>
</el-tab-pane>
<!--<el-tab-pane label="Cookie" name="cookie" class="pane cookie">-->
<!--<pre>{{response.cookies}}</pre>-->
@ -25,7 +27,9 @@
</el-tab-pane>
<el-tab-pane :label="$t('api_test.request.extract.label')" name="label" class="pane">
<pre>{{response.responseResult.vars}}</pre>
<div style="width: 400px">
<pre>{{response.responseResult.vars}}</pre>
</div>
</el-tab-pane>
<el-tab-pane :label="$t('api_report.request_body')" name="request_body" class="pane">

View File

@ -44,6 +44,15 @@ export const REQ_METHOD = [
{id: 'HEAD', label: 'HEAD'},
{id: 'CONNECT', label: 'CONNECT'}
]
export const TCP_METHOD = [
{id: 'TCP', label: 'TCP'}
]
export const SQL_METHOD = [
{id: 'SQL', label: 'SQL'}
]
export const DUBBO_METHOD = [
{id: 'dubbo://', label: 'dubbo://'},
]
export const CASE_PRIORITY = [
{id: 'P0', label: 'P0'},

View File

@ -15,23 +15,6 @@
props: ['total', 'pageSize'],
data() {
return {
gridData: [{
date: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
}, {
date: '2016-05-04',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
}, {
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
}, {
date: '2016-05-03',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
}]
};
}
}

View File

@ -81,7 +81,8 @@
if (size) {
this.size = size;
} else {
this.size = this.$parent.selectRows.size;
// this.size = this.$parent.selectRows.size;
this.size = this.$parent.selectDataCounts;
}
listenGoBack(this.handleClose);
},

View File

@ -46,7 +46,7 @@
<el-table-column width="40" :resizable="false" align="center">
<template v-slot:default="scope">
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectRows.size"/>
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectDataCounts"/>
</template>
</el-table-column>
<el-table-column
@ -292,6 +292,7 @@ export default {
},
currentCaseId: null,
projectId: "",
selectDataCounts: 0,
}
},
props: {
@ -328,6 +329,7 @@ export default {
this.condition.nodeIds = [];
this.condition.selectAll = false;
this.condition.unSelectIds = [];
this.selectDataCounts = 0;
if (this.planId) {
// param.planId = this.planId;
this.condition.planId = this.planId;
@ -435,6 +437,7 @@ export default {
_handleSelect(this, selection, row, this.selectRows);
this.setUnSelectIds();
},
importTestCase() {
if (!getCurrentProjectID()) {
this.$warning(this.$t('commons.check_project_tip'));
@ -553,6 +556,11 @@ export default {
this.condition.unSelectIds = allIDs.filter(function (val) {
return ids.indexOf(val) === -1
});
if (this.condition.selectAll) {
this.selectDataCounts = this.total - this.condition.unSelectIds.length;
} else {
this.selectDataCounts = this.selectRows.size;
}
},
moveSave(param) {
param.condition = this.condition;

View File

@ -15,6 +15,7 @@
<show-more-btn :is-show="isSelect(row)" :buttons="buttons" :size="selectRows.length"/>
</template>
</el-table-column>
<el-table-column prop="num" label="ID"/>
<el-table-column prop="name" :label="$t('api_test.automation.scenario_name')"
show-overflow-tooltip/>
<el-table-column prop="level" :label="$t('api_test.automation.case_level')"
@ -29,7 +30,7 @@
</el-table-column>
<el-table-column prop="tagNames" :label="$t('api_test.automation.tag')" width="200px">
<template v-slot:default="scope">
<div v-for="itemName in scope.row.tagNames" :key="itemName">
<div v-for="(itemName,index) in scope.row.tags" :key="index">
<ms-tag type="success" effect="plain" :content="itemName"/>
</div>
</template>
@ -159,6 +160,11 @@
let data = response.data;
this.total = data.itemCount;
this.tableData = data.listObject;
this.tableData.forEach(item => {
if (item.tags && item.tags.length > 0) {
item.tags = JSON.parse(item.tags);
}
});
this.loading = false;
});
},

View File

@ -3,7 +3,7 @@
:condition="condition"
@search="$emit('refresh')"
:show-create="false"
:tip="$t('commons.search_by_name_or_id')">
:tip="$t('commons.search_by_id_name_tag')">
<template v-slot:title>
场景用例
</template>