自动化测试优化

This commit is contained in:
陈裕财
2024-08-16 09:55:16 +08:00
parent 0e0ec4196c
commit 634a6b4ab8
17 changed files with 225 additions and 210 deletions

View File

@@ -73,7 +73,7 @@
"vue-clipboard3": "^2.0.0",
"vue-dompurify-html": "^4.1.4",
"vue-i18n": "9.9.1",
"vue-json-viewer": "^2.2.22",
"vue-json-viewer": "^3.0.4",
"vue-router": "^4.3.0",
"vue-types": "^5.1.1",
"vue3-tree-org": "^4.2.2",

View File

@@ -61,7 +61,7 @@ import XmComponents from '@/views/xm/index.js'
//import MdpDesigner from '@/views/mdp/form/formDef/components/index.js'
import DataV from '@/views/datav/datav.js';
//import DataV from '@/views/datav/datav.js';
//唛盟公共api
@@ -113,7 +113,7 @@ const setupAll = async () => {
// app.component(DataV[m].name, DataV[m]);
// }
app.use(DataV)
//app.use(DataV)
await router.isReady()

View File

@@ -239,7 +239,7 @@
<el-tabs v-model="showPanel" v-if="xmIteration && xmIteration.id">
<el-tab-pane label="迭代概览" name="iterationOverview" >
<xm-iteration-overview v-show="xmIteration && showPanel=='iterationOverview'" :xm-iteration="xmIteration" :sel-project="projectInfo" />
<xm-iteration-overview v-show="xmIteration && showPanel=='iterationOverview'" :xm-iteration="xmIteration" :sel-project="projectInfo" @edit-fields="onEditFields"/>
</el-tab-pane>
<el-tab-pane label="执行统计" name="iterationCalc" >
@@ -307,7 +307,8 @@ import { useXmStore,useXmStore2 } from '@/store/modules/xm'
import XmIterationMenuMng from '../xmIterationMenu/XmIterationMenuMng.vue';
import { editSomeFieldsXmIteration } from '@/api/xm/core/xmIteration';
import { loadTasksToXmIterationState } from '@/api/xm/core/xmIterationState';
import { loadTasksToXmIterationState } from '@/api/xm/core/xmIterationState';
import { listXmIterationWithState } from "@/api/xm/core/xmIteration";
export default {
computed: {
...mapState(useUserStore,[
@@ -367,10 +368,24 @@ import { useXmStore,useXmStore2 } from '@/store/modules/xm'
loadTasksToXmIterationState(){
this.load.calcIteration=true;
loadTasksToXmIterationState({id:this.xmIteration.id}).then(res=>{
this.load.calcIteration=false;
var tips =res.tips;
this.$notify({position:'bottom-left',showClose:true,message: tips.msg, type: tips.isOk?'success':'error'});
});
if(tips.isOk){
listXmIterationWithState({id:this.xmIteration.id}).then(res2=>{
var tips2=res2.tips;
this.load.calcIteration=false;
this.$message({showClose:true,message: tips2.msg, type: tips2.isOk?'success':'error'});
if(tips2.isOk && res2.data.length>0){
var data=res2.data[0]
useXmStore2().setXmIteration(data)
this.onEditFields(data)
}
})
}else{
this.load.calcIteration=false;
this.$message({showClose:true,message: tips.msg, type: tips.isOk?'success':'error'});
}
});
},
/**end 自定义函数请在上面加**/

View File

@@ -13,7 +13,7 @@
trigger="click" >
<el-row>
<el-button type="primary" @click="loadTasksToXmIterationState" v-loading="load.calcProduct">计算迭代汇总数据</el-button>
<el-button type="primary" @click="loadTasksToXmIterationState" v-loading="load.calcIteration">计算迭代汇总数据</el-button>
<br/>
<font color="blue" style="font-size:10px;">将从项目任务及迭代任务中汇总进度预算工作量实际工作量预算金额实际金额缺陷数需求数等数据到迭代统计表</font>
</el-row>
@@ -343,7 +343,7 @@ export default {
},
data() {
return {
load:{list:false,add:false,calcProject:false,calcSettle:false},
load:{list:false,add:false,calcIteration:false,calcSettle:false},
};
},
@@ -876,13 +876,19 @@ export default {
loadTasksToXmIterationState(){
var row=this.xmIteration;
var params={productId:row.id}
this.load.calcProject=true;
this.load.calcIteration=true;
loadTasksToXmIterationState(params).then((res1) => {
this.load.calcProject=false;
this.load.list=true;
let tips = res1.tips
if(!tips.isOk){
this.load.calcIteration=false;
this.$message({showClose:true,message: tips.msg, type: tips.isOk?'success':'error'});
return;
}
listXmIterationWithState({id:row.id}).then(res=>{
this.load.list=false;
this.load.calcIteration=false;
var tips = res.tips;
this.$message({showClose:true,message: tips.msg, type: tips.isOk?'success':'error'});
if(tips.isOk){
var xmIteration=res.data[0]
if(this.xmIteration && this.xmIteration.id){
@@ -891,19 +897,18 @@ export default {
Object.assign(this.xmIteration,xmIteration)
this.$emit("edit-fields",xmIteration);
}
this.$notify({position:'bottom-left',showClose:true,message: tips.msg, type: tips.isOk?'success':'error'});
})
})
}).catch( err => this.load.calcProject=false );
}).catch( err => this.load.calcIteration=false );
},
loadTasksToXmMenuState(){
var row=this.xmIteration;
var params={productId:row.id}
loadTasksToXmMenuState(params).then((res) => {
this.load.calcProject=false;
this.load.calcIteration=false;
var tips=res.tips;
this.$notify({position:'bottom-left',showClose:true,message: tips.msg, type: tips.isOk?'success':'error'});
}).catch( err => this.load.calcProject=false );
}).catch( err => this.load.calcIteration=false );
},
},

View File

@@ -209,7 +209,7 @@
<el-col :xl="21" :lg="21" :md="21" :sm="21" :xs="19" class="padding-left padding-right">
<el-tabs v-model="showPanel" >
<el-tab-pane label="迭代概览" name="overview" >
<xm-iteration-overview v-show="showPanel=='overview'" :xm-iteration="xmIteration" />
<xm-iteration-overview v-show="showPanel=='overview'" :xm-iteration="xmIteration" @edit-fields="onEditFields"/>
</el-tab-pane>
@@ -299,21 +299,26 @@ export default {
})
},
loadTasksToXmIterationState(){
this.load.edit=true;
loadTasksToXmIterationState({id:this.xmIteration.id}).then(res=>{
this.load.edit=false;
this.load.calcIteration=true;
loadTasksToXmIterationState({id:this.xmIteration.id}).then(res=>{
var tips =res.tips;
if(tips.isOk){
listXmIterationWithState({id:this.xmIteration.id}).then(res2=>{
var tips2=res2.data.tips;
if(tips2.isOk && res2.data.data.length>0){
var data=res2.data.data[0]
listXmIterationWithState({id:this.xmIteration.id}).then(res2=>{
this.load.calcIteration=false;
var tips2=res2.tips;
this.$message({showClose:true,message: tips2.msg, type: tips2.isOk?'success':'error'});
if(tips2.isOk && res2.data.length>0){
var data=res2.data[0]
useXmStore2().setXmIteration(data)
this.onEditFields(data)
}
})
}else{
this.load.calcIteration=false;
this.$message({showClose:true,message: tips.msg, type: tips.isOk?'success':'error'});
}
this.$notify({position:'bottom-left',showClose:true,message: tips.msg, type: tips.isOk?'success':'error'});
});
});
},
onMenuToolBarSelect(menuIndex){
this.showPanel=menuIndex;

View File

@@ -96,13 +96,14 @@
<vue-editor :height="250" :key="'description_' + addForm?.menuId"
class="rich-context" :editorId="'description_' + addForm?.menuId" :branch-id="userInfo.branchId"
v-model="addForm.remark" />
<el-row class="footer">
</el-tab-pane>
</el-tabs>
<el-row class="footer">
<el-button @click="handleCancel">关闭</el-button>
<el-button v-loading="load.add" type="primary" @click="addSubmit(1)" :disabled="load.add==true">提交(关闭窗口)</el-button>
<el-button v-loading="load.add" type="primary" @click="addSubmit(2)" :disabled="load.add==true">提交(继续新增)</el-button>
</el-row>
</el-tab-pane>
</el-tabs>
</el-form>

View File

@@ -345,7 +345,7 @@ export default {
},
data() {
return {
load: { list: false, add: false, calcProject: false, calcSettle: false },
load: { list: false, add: false, calcProduct: false, calcSettle: false },
isActive: true,
maxTableHeight: 300,
};
@@ -905,13 +905,12 @@ export default {
loadTasksToXmProductState() {
var row = this.xmProduct;
var params = { productId: row.id }
this.load.calcProject = true;
loadTasksToXmProductState(params).then((res1) => {
this.load.calcProject = false;
this.load.list = true;
this.load.calcProduct = true;
loadTasksToXmProductState(params).then((res1) => {
listXmProductWithState({ id: row.id }).then(res => {
this.load.list = false;
this.load.calcProduct = false;
var tips = res.tips;
this.$message({showClose:true,message: tips.msg, type: tips.isOk?'success':'error'});
if (tips.isOk) {
var xmProduct = res.data[0]
if (this.xmProduct && this.xmProduct.id) {
@@ -920,19 +919,20 @@ export default {
Object.assign(this.xmProduct, xmProduct)
this.$emit("edit-fields", xmProduct);
}
this.$notify({ position: 'bottom-left', showClose: true, message: tips.msg, type: tips.isOk ? 'success' : 'error' });
})
})
}).catch(err => this.load.calcProject = false);
}).catch(err => this.load.calcProduct = false);
},
loadTasksToXmMenuState() {
var row = this.xmProduct;
var params = { productId: row.id }
this.load.calcMenu = true;
loadTasksToXmMenuState(params).then((res) => {
this.load.calcProject = false;
this.load.calcMenu = false;
var tips = res.tips;
this.$notify({ position: 'bottom-left', showClose: true, message: tips.msg, type: tips.isOk ? 'success' : 'error' });
}).catch(err => this.load.calcProject = false);
this.$message({showClose:true,message: tips.msg, type: tips.isOk?'success':'error'});
}).catch(err => this.load.calcMenu = false);
},
},

View File

@@ -152,7 +152,7 @@
<el-tabs v-model="showPanel" v-if="selProject && selProject.id" >
<el-tab-pane label="项目概览" name="projectOverview">
<xm-project-overview :xm-product="xmProduct"
:xm-iteration="xmIteration" :sel-project="selProject" />
:xm-iteration="xmIteration" :sel-project="selProject" @edit-fields="onEditFields"/>
</el-tab-pane>
<el-tab-pane label="项目详情" name="detail">
<xm-project-detail subOpType="edit" :sel-project="selProject" @submit="onEditFields" ref="detail"
@@ -243,13 +243,13 @@ import XmProjectDetail from "./XmProjectDetail.vue"; //新增界面
import XmProductProjectLinkMng from "../xmProductProjectLink/XmProductProjectLinkMng.vue";
import XmPlan from "../xmTask/XmPlan.vue";
import xmGroupMng from '../xmGroup/XmGroupMng.vue';
import xmGroupMng from '../xmGroup/XmGroupMng.vue';
import {
getDefOptions,
editXmProjectSomeFields,
listXmProject
} from "@/api/xm/core/xmProject";
import {
loadTasksToXmProjectState,
@@ -326,16 +326,29 @@ export default {
loadTasksToXmProjectState() {
var row = this.selProject;
var params = { projectId: row.id };
this.load.calcProject = true;
loadTasksToXmProjectState(params)
.then((res) => {
this.load.calcProject = false;
var tips = res.tips;
this.$notify({
position: "bottom-left",
showClose: true,
message: tips.msg,
type: tips.isOk ? "success" : "error",
});
if(!tips.isOk){
this.$message({showClose:true,message: tips.msg, type: tips.isOk?'success':'error'});
this.load.calcProject = false;
return;
}
listXmProject({id:row.id}).then(res=>{
this.load.calcProject=false;
tips = res.tips;
this.$message({showClose:true,message: tips.msg, type: tips.isOk?'success':'error'});
if(tips.isOk){
var selProject=res.data[0]
this.onEditFields(selProject)
}
})
})
.catch((err) => (this.load.calcProject = false));
},
@@ -358,6 +371,7 @@ export default {
onEditFields(row) {
Object.assign(this.selProject, row);
this.$emit("edit-fields", row);
useXmStore2().setProjectInfo(this.selProject)
},
showCurrFlow() {
this.showPanel = "currFlow";

View File

@@ -900,20 +900,20 @@ export default {
var params={projectId:row.id}
this.load.calcProject=true;
loadTasksToXmProjectState(params).then((res1) => {
this.load.calcProject=false;
this.load.list=true;
listXmProject({id:row.id}).then(res=>{
this.load.list=false;
var tips = res.tips;
if(tips.isOk){
var selProject=res.data[0]
if(this.projectInfo && this.projectInfo.id){
useXmStore2().setProjectInfo(selProject)
}
Object.assign(this.selProject,selProject)
let tips=res1.tips
if(!tips.isOk){
this.load.calcProject=false
this.$message({showClose:true,message: tips.msg, type: tips.isOk?'success':'error'});
return;
}
listXmProject({id:row.id}).then(res=>{
var tips = res.tips;
this.load.calcProject=false;
this.$message({showClose:true,message: tips.msg, type: tips.isOk?'success':'error'});
if(tips.isOk){
var selProject=res.data[0]
this.$emit("edit-fields",selProject);
}
this.$notify({position:'bottom-left',showClose:true,message: tips.msg, type: tips.isOk?'success':'error'});
})
}).catch( err => this.load.calcProject=false );

View File

@@ -144,7 +144,7 @@
label="项目概览"
name="overview"
>
<xm-project-overview v-show="showPanelName=='overview' && projectInfo && projectInfo.id" :sel-project="projectInfo" />
<xm-project-overview v-show="showPanelName=='overview' && projectInfo && projectInfo.id" :sel-project="projectInfo" @edit-fields="onEditFields"/>
</el-tab-pane>
<el-tab-pane
@@ -277,17 +277,25 @@ export default {
loadTasksToXmProjectState(){
var row=this.projectInfo;
var params={projectId:row.id}
loadTasksToXmProjectState(params).then((res) => {
this.load.calcProject=false;
var tips=res.tips;
this.load.calcProject=true;
loadTasksToXmProjectState(params).then((res) => {
var tips=res.tips;
if(!tips.isOk){
this.$message({showClose:true,message: tips.msg, type: tips.isOk?'success':'error'});
this.load.calcProject=false;
return;
}
listXmProject({id:this.projectInfo.id}).then(res=>{
var tips = res.tips;
this.load.calcProject=false;
var tips = res.tips;
this.$message({showClose:true,message: tips.msg, type: tips.isOk?'success':'error'});
if(tips.isOk){
var projectInfo=res.data[0]
this.onEditFields(projectInfo)
}
})
this.$notify({position:'bottom-left',showClose:true,message: tips.msg, type: tips.isOk?'success':'error'});
}).catch( err => this.load.calcProject=false );
},
loadTasksSettleToXmProjectState(){
@@ -311,8 +319,9 @@ export default {
})
},
onEditFields(row){
Object.assign(this.projectInfo,row)
onEditFields(row){
Object.assign(this.projectInfo,row)
useXmStore2().setProjectInfo(this.projectInfo)
this.$emit("edit-fields",row);
},
goBack() {

View File

@@ -636,12 +636,9 @@ import { MdpFormMixin } from '@/components/mdp-ui/mixin/MdpFormMixin';
this.editForm.wtype = "2"
this.editForm.level='2'
if (!this.editForm.startTime) {
const beginDate = new Date();
const endDate = new Date();
endDate.setTime(beginDate.getTime() + 3600 * 1000 * 24 * 7 * 4);
this.editForm.startTime = util.formatDate(beginDate, "YYYY-MM-DD HH:mm:ss"),
this.editForm.endTime = util.formatDate(endDate, "YYYY-MM-DD HH:mm:ss")
if (!this.editForm.startTime) {
this.editForm.startTime = util.moment().startOf('day').format('YYYY-MM-DD HH:mm:ss'),
this.editForm.endTime = util.moment().add(2,'days').endOf('day').format('YYYY-MM-DD HH:mm:ss')
this.onBudgetDateRangerChange();
}

View File

@@ -42,13 +42,20 @@
</el-col>
</el-row>
<el-form-item label="接口地址" prop="url" v-if="editForm.testType == '1'">
<el-space>
<mdp-select label="请求方法" v-model="autoStep.method" itemCode="autoTestMethod" />
<el-input style="width:600px;" v-model="autoStep.url"
placeholder="url 如#{baseApi}/user/list,支持通过 #{变量名}引用环境变量" />
<el-button type="primary" @click="sendMsgForTestSetting" title="执行用例">发送</el-button>
</el-space>
<el-form-item label="接口地址" prop="url" v-if="editForm.testType == '1'">
<el-input v-model="autoStep.url"
placeholder="url 如#{baseApi}/user/list,支持通过 #{变量名}引用环境变量" >
<template #prefix>
<mdp-select style="padding-bottom:2px;" placeholder="请求方法" v-model="autoStep.method" itemCode="autoTestMethod" />
</template>
<template #suffix>
<el-button type="primary" @click="sendMsgForTestSetting" title="执行用例">发送</el-button>
</template>
</el-input>
</el-form-item>
<el-tabs v-model="activeTab">
<el-tab-pane name="1" label="基本信息">
@@ -75,25 +82,11 @@
</el-form-item>
</el-tab-pane>
<el-tab-pane name="12" label="Params" v-if="editForm.testType == '1'">
<el-form-item label="url" class="field">
<div class="field-text">
<i class="edit"></i>{{ autoStep.url }}
</div>
<div class="field-bar">
<el-input v-model="autoStep.url" placeholder="url 如#{baseApi}/user/list,支持通过 #{变量名}引用环境变量" />
</div>
</el-form-item>
<el-form-item label="请求方法">
<mdp-select show-style="tag" label="请求方法" v-model="autoStep.method" itemCode="autoTestMethod" />
</el-form-item>
<el-form-item label="查询参数" class="field">
<div class="field-text">
<i class="edit"></i>{{ queryStrCpd || '暂无' }}
</div>
<div class="field-bar">
<el-input type="textarea" :rows="3" v-model="queryStr" placeholder="查询参数" @focus="initQueryStr"
@change="onQueryStrChange" />
</div>
@change="onQueryStrChange" />
</el-form-item>
<el-table :data="autoStep.params" style="width: 100%">
<el-table-column prop="id" label="参数名" min-width="200">
@@ -117,16 +110,13 @@
<el-button @click="addParamsRow(scope.row, scope.$index)" icon="plus" circle plain />
</template>
</el-table-column>
</el-table>
<el-row class="padding" style="float:right;">
<el-button @click="sendMsgForTestSetting"
title="仅仅用于测试用例配置是否正确,不会保存任何执行结果,如果需要正式使用,请构建测试计划,进行统一管理">发送</el-button>
<el-button @click="saveAutoStep" type="primary">保存</el-button>
</el-row>
</el-table>
</el-tab-pane>
<el-tab-pane name="13" label="Body" v-if="editForm.testType == '1'">
<mdp-select show-style="x" size="medium" style="margin-bottom:10px;" class="padding" label="参数格式"
<div class="padding">
<mdp-select show-style="x" size="medium" class="padding" label="参数格式"
v-model="autoStep.bodyType" itemCode="autoTestBodyType" />
</div>
<el-input v-if="autoStep.bodyType == 'json'" type="textarea" :rows="10" v-model="autoStep.body" />
<el-input v-if="autoStep.bodyType == 'xml'" type="textarea" :rows="10" v-model="autoStep.body" />
@@ -153,12 +143,7 @@
<el-button @click="addBodyRow(scope.row, scope.$index)" icon="plus" circle plain />
</template>
</el-table-column>
</el-table>
<el-row class="padding" style="float:right;">
<el-button @click="sendMsgForTestSetting"
title="仅仅用于测试用例配置是否正确,不会保存任何执行结果,如果需要正式使用,请构建测试计划,进行统一管理">发送</el-button>
<el-button @click="saveAutoStep" type="primary">保存</el-button>
</el-row>
</el-table>
</el-tab-pane>
<el-tab-pane name="14" label="Cookie" v-if="editForm.testType == '1'">
@@ -184,12 +169,7 @@
<el-button @click="addCookieRow(scope.row, scope.$index)" icon="plus" circle plain />
</template>
</el-table-column>
</el-table>
<el-row class="padding" style="float:right;">
<el-button @click="sendMsgForTestSetting"
title="仅仅用于测试用例配置是否正确,不会保存任何执行结果,如果需要正式使用,请构建测试计划,进行统一管理">发送</el-button>
<el-button @click="saveAutoStep" type="primary">保存</el-button>
</el-row>
</el-table>
</el-tab-pane>
<el-tab-pane name="15" label="Header" v-if="editForm.testType == '1'">
<el-table :data="autoStep.headers" style="width: 100%">
@@ -214,54 +194,27 @@
<el-button @click="addHeaderRow(scope.row, scope.$index)" icon="plus" circle plain />
</template>
</el-table-column>
</el-table>
<el-row class="padding" style="float:right;">
<el-button @click="sendMsgForTestSetting"
title="仅仅用于测试用例配置是否正确,不会保存任何执行结果,如果需要正式使用,请构建测试计划,进行统一管理">发送</el-button>
<el-button @click="saveAutoStep" type="primary">保存</el-button>
</el-row>
</el-table>
</el-tab-pane>
<el-tab-pane name="16" label="Auth" v-if="editForm.testType == '1'">
<mdp-select show-style="x" size="medium" style="margin-bottom:10px;" class="padding" label="授权方式"
<div class="padding">
<mdp-select show-style="x" size="medium" class="padding" label="授权方式"
v-model="autoStep.authType" itemCode="autoTestAuthType" />
</div>
<el-row v-if="autoStep.authType == 'basic-auth'">
<el-form-item label="username" class="field">
<div class="field-text">
<i class="edit"></i>{{ autoStep.authData.username }}
</div>
<div class="field-bar">
<el-input v-model="autoStep.authData.username" placeholder="username 支持通过 #{变量名}引用环境变量" />
</div>
<div v-if="autoStep.authType == 'basic-auth'" class="padding">
<el-form-item label="username" class="field">
<el-input v-model="autoStep.authData.username" placeholder="username 支持通过 #{变量名}引用环境变量" />
</el-form-item>
<el-form-item label="password" class="field">
<div class="field-text">
<i class="edit"></i>{{ autoStep.authData.password || '暂无' }}
</div>
<div class="field-bar">
<el-input v-model="autoStep.authData.password" placeholder="password 支持通过 #{变量名}引用环境变量" />
</div>
<el-form-item label="password" class="field">
<el-input v-model="autoStep.authData.password" placeholder="password 支持通过 #{变量名}引用环境变量" />
</el-form-item>
</el-row>
<el-row v-if="autoStep.authType == 'bearer-token'">
<el-form-item label="Bearer" class="field">
<div class="field-text">
<i class="edit"></i>{{ autoStep.authData.bearerToken }}
</div>
<div class="field-bar">
<el-input type="textarea" autosize v-model="autoStep.authData.bearerToken"
placeholder="Bearer 支持通过 #{变量名}引用环境变量" />
</div>
</el-form-item>
</el-row>
<el-row class="padding" style="float:right;">
<el-button @click="sendMsgForTestSetting"
title="仅仅用于测试用例配置是否正确,不会保存任何执行结果,如果需要正式使用,请构建测试计划,进行统一管理">发送</el-button>
<el-button @click="saveAutoStep" type="primary">保存</el-button>
</el-row>
</div>
<el-form-item label="Bearer" v-if="autoStep.authType == 'bearer-token'" class=" field padding">
<el-input type="textarea" rows="4" autosize v-model="autoStep.authData.bearerToken"
placeholder="Bearer 支持通过 #{变量名}引用环境变量" />
</el-form-item>
</el-tab-pane>
<el-tab-pane name="17" label="响应" v-if="editForm.testType == '1'">
<el-row class="padding">可使用的变量 res={config:{协议配置},data:{接口返回的业务数据对象}
@@ -280,15 +233,9 @@
}<br />
</el-form-item>
<el-form-item label="响应数据预览">
<el-row> <el-checkbox v-model="resDataVisible">显示响应数据</el-checkbox></el-row>
<json-viewer v-if="resDataVisible == true" :value="testRes" copyable theme="my-awesome-json-theme" />
<el-checkbox v-model="resDataVisible">显示响应数据</el-checkbox>
<json-viewer v-if="resDataVisible == true" :value="testRes" copyable theme="my-awesome-json-theme" />
</el-form-item>
<el-row class="padding" style="float:right;">
<el-button @click="sendMsgForTestSetting"
title="仅仅用于测试用例配置是否正确,不会保存任何执行结果,如果需要正式使用,请构建测试计划,进行统一管理">发送</el-button>
<el-button @click="saveAutoStep" type="primary">保存</el-button>
</el-row>
</el-tab-pane>
<el-tab-pane name="2" label="缺陷" v-if="currOpType !== 'add'">
<xm-question-mng v-if="activeTab == '2'" :xm-test-case="editForm"
@@ -305,12 +252,15 @@
<el-tab-pane name="4" label="日志" v-if="currOpType !== 'add'" />
</el-tabs>
<el-row v-if="currOpType == 'add'" class="footer">
<span style="float:right;">
<el-button @click="handleCancel">取消</el-button>
<el-button v-loading="load.edit" type="primary" @click="saveSubmit" :disabled="load.edit == true">提交</el-button>
</span>
</el-row>
<div v-if="currOpType == 'add'" class="footer">
<el-button @click="handleCancel">取消</el-button>
<el-button v-loading="load.edit" type="primary" @click="saveSubmit" :disabled="load.edit == true">提交</el-button>
</div>
<div v-if="currOpType == 'edit' && editForm.testType=='1'" class="footer">
<el-button @click="handleCancel">取消</el-button>
<el-button v-loading="load.edit" type="primary" @click="saveAutoStep" :disabled="load.edit == true">保存自动化测试配置</el-button>
</div>
</el-col>
<el-col :span="6" class="padding-left padding-bottom border">
@@ -453,6 +403,7 @@ import { MdpFormMixin } from '@/components/mdp-ui/mixin/MdpFormMixin';
params: [],
body: [],
cookies: [],
headers:[],
expectResult: ''
},
autoStepInit: {
@@ -464,7 +415,8 @@ import { MdpFormMixin } from '@/components/mdp-ui/mixin/MdpFormMixin';
bodyType: '',
params: [],
body: [],
cookies: [],
cookies: [],
headers:[],
expectResult: ''
},
apis:{

View File

@@ -1,6 +1,6 @@
<template>
<xm-test-plan-info v-if="xmTestPlan && xmTestPlan.id" :xm-test-casedb="testCasedb" :xm-test-plan="xmTestPlan" />
<xm-test-plan-info v-if="xmTestPlan && xmTestPlan.id" :xm-test-casedb="testCasedb" :xm-test-plan="xmTestPlan" @refresh="onRefresh"/>
</template>
@@ -9,6 +9,7 @@
import { useUserStore } from '@/store/modules/user';
import { useXmStore } from '@/store/modules/xm';
import XmTestPlanInfo from './XmTestPlanInfo.vue'
import { listXmTestPlan } from '@/api/xm/core/xmTestPlan';
export default {
computed: {
@@ -38,7 +39,18 @@ import { useXmStore } from '@/store/modules/xm';
this.xmTestPlan=JSON.parse(str)
}
}
}
},
onRefresh(){
var planId=this.$route.query.id
listXmTestPlan({id:planId}).then(res=>{
var key="xm-test-plan-info-"+planId
if(res.tips.isOk && res.data.length>0){
sessionStorage.setItem(key,JSON.stringify(res.data[0]))
this.xmTestPlan=res.data[0]
}
})
}
},//end methods
components: {
XmTestPlanInfo,

View File

@@ -161,6 +161,13 @@ export default {
}
return true;
},
afterEditSomeFields(res,isOk,params,row){
var key="xm-test-plan-info-"+row.id
sessionStorage.setItem(key,JSON.stringify(row))
},
onPorjectConfirm(row) {
this.editForm.projectId = row.id
this.editForm.projectName = row.name

View File

@@ -177,6 +177,7 @@ export default {
type: tips.isOk ? 'success' : 'error'
})
if (tips.isOk) {
this.$emit('refresh')
}
})
},

View File

@@ -241,6 +241,11 @@ export default {
id:row.id
}
})
},
onEditFields(row){
this.afterEditFields(row)
var key="xm-test-plan-info-"+this.editForm.id
sessionStorage.setItem(key,JSON.stringify(this.editForm))
},
calcXmTestPlan(row){
calcXmTestPlan({id:row.id}).then(res=>{

View File

@@ -2,21 +2,9 @@
<el-form :model="editForm" label-width="120px" :rules="editFormRules" ref="editFormRef" label-position="left">
<el-row>
<el-col :span="18" class="border padding">
<el-form-item label="" prop="caseName" label-width="0px">
<el-form-item prop="caseName" label="用例名称">
{{ editForm.caseName }}<span class="label-font-color"> &nbsp;&nbsp; {{ editForm.caseId }} </span>
<el-row>
名称{{ editForm.caseName }}<span class="label-font-color"> &nbsp;&nbsp; {{ editForm.caseId }} </span>
</el-row>
<el-row v-if="editForm.testType == '1'" class="padding-bottom">
<div style="display:flex;">
<mdp-select show-style="tag" label="请求方法" v-model="autoStep.method" itemCode="autoTestMethod"
:disabled="true" />
<span>{{ autoStep.url }}</span>
<el-button style="margin-left:10px;" type="primary" @click="sendMsgForTestSetting"
title="执行用例">执行用例</el-button>
</div>
</el-row>
</el-form-item>
<el-row class="padding">
<el-col :span="6">
@@ -40,19 +28,19 @@
@change="editSomeFields(editForm, 'execStatus', $event)" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-button v-if="currOpType != 'add'" style="margin-top:12px;float:right;" @click="$emit('next', editForm)"
type="primary">下一条</el-button>
<el-row v-if="currOpType == 'add'">
<el-button @click="handleCancel">取消</el-button>
<el-button v-loading="load.edit" type="primary" @click="saveSubmit"
:disabled="load.edit == true">提交</el-button>
</el-row>
</el-form-item>
</el-col>
</el-row>
</el-col>
</el-row>
<el-form-item label="接口地址" prop="url" v-if="editForm.testType == '1'">
<el-input v-model="autoStep.url" readonly
placeholder="url 如#{baseApi}/user/list,支持通过 #{变量名}引用环境变量" >
<template #prefix>
<mdp-select style="padding-bottom:2px;" placeholder="请求方法" v-model="autoStep.method" itemCode="autoTestMethod" :disabled="true"/>
</template>
</el-input>
</el-form-item>
<el-tabs v-model="activateName">
<el-tab-pane name="1" label="用例信息">
<el-row>
@@ -221,7 +209,11 @@
</el-tab-pane>
<el-tab-pane name="4" label="附件" />
</el-tabs>
<div class="footer">
<el-button @click="$emit('next', editForm)"
type="primary">下一条</el-button>
<el-button type="primary" v-if="editForm.testType=='1'" @click="sendMsgForTestSetting" title="执行用例">执行用例</el-button>
</div>
</el-col>
<el-col :span="6" class="border padding-left padding-right padding-top">
<el-form-item label="测试库" prop="casedbName">