report
This commit is contained in:
@@ -87,7 +87,6 @@ public class TestCaseController extends BaseController {
|
|||||||
@PostMapping("/run")
|
@PostMapping("/run")
|
||||||
public AjaxResult run(@RequestBody IDQO qo) {
|
public AjaxResult run(@RequestBody IDQO qo) {
|
||||||
log.info("执行用例 id:{}, jmeterHomePath:{}", qo.getId(), jmeterHomePath);
|
log.info("执行用例 id:{}, jmeterHomePath:{}", qo.getId(), jmeterHomePath);
|
||||||
testCaseService.executeTestCaseById(qo.getId(), jmeterHomePath);
|
return success(testCaseService.executeTestCaseById(qo.getId(), jmeterHomePath));
|
||||||
return toAjax(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.test.test.controller;
|
|||||||
|
|
||||||
import com.test.common.core.controller.BaseController;
|
import com.test.common.core.controller.BaseController;
|
||||||
import com.test.common.core.domain.AjaxResult;
|
import com.test.common.core.domain.AjaxResult;
|
||||||
|
import com.test.test.domain.TestCaseResult;
|
||||||
import com.test.test.domain.qo.IDQO;
|
import com.test.test.domain.qo.IDQO;
|
||||||
import com.test.test.service.ITestCaseResultService;
|
import com.test.test.service.ITestCaseResultService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -28,4 +29,11 @@ public class TestCaseResultController extends BaseController
|
|||||||
{
|
{
|
||||||
return success(testCaseResultService.selectTestCaseResultById(qo.getId()));
|
return success(testCaseResultService.selectTestCaseResultById(qo.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
public AjaxResult getList(@RequestParam String sid) {
|
||||||
|
TestCaseResult testCaseResult = new TestCaseResult();
|
||||||
|
testCaseResult.setCaseSid(sid);
|
||||||
|
return success(testCaseResultService.selectTestCaseResultList(testCaseResult));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.test.test.domain.vo;
|
||||||
|
|
||||||
|
import com.test.test.domain.TestCaseResult;
|
||||||
|
import com.test.test.domain.TestCaseStep;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class TestCaseResultVO {
|
||||||
|
TestCaseStep step;
|
||||||
|
TestCaseResult result;
|
||||||
|
}
|
||||||
@@ -68,5 +68,5 @@ public interface ITestCaseService
|
|||||||
* @param jmeterHomePath jmeter安装路径
|
* @param jmeterHomePath jmeter安装路径
|
||||||
* @return 是否成功
|
* @return 是否成功
|
||||||
*/
|
*/
|
||||||
public boolean executeTestCaseById(Long id, String jmeterHomePath);
|
public String executeTestCaseById(Long id, String jmeterHomePath);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,18 +139,18 @@ public class TaskManagerService {
|
|||||||
try {
|
try {
|
||||||
// 测试用例执行逻辑
|
// 测试用例执行逻辑
|
||||||
log.info("Executing test case {} for task {}", testCaseId, taskId);
|
log.info("Executing test case {} for task {}", testCaseId, taskId);
|
||||||
boolean result = testCaseService.executeTestCaseById(testCaseId, jmeterHomePath);
|
String result = testCaseService.executeTestCaseById(testCaseId, jmeterHomePath);
|
||||||
if (!result && retry == 0) {
|
if (result==null && retry == 0) {
|
||||||
if (retryCount != null && retryCount > 0) {
|
if (retryCount != null && retryCount > 0) {
|
||||||
for (int i = 0; i < retryCount; i++) {
|
for (int i = 0; i < retryCount; i++) {
|
||||||
result = testCaseService.executeTestCaseById(testCaseId, jmeterHomePath);
|
result = testCaseService.executeTestCaseById(testCaseId, jmeterHomePath);
|
||||||
if (result) {
|
if (result!=null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result!=null;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Test case {} for task {} failed: ", testCaseId, taskId, e);
|
log.error("Test case {} for task {} failed: ", testCaseId, taskId, e);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -135,11 +135,11 @@ public class TestCaseServiceImpl implements ITestCaseService
|
|||||||
* @return 是否成功
|
* @return 是否成功
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean executeTestCaseById(Long id, String jmeterHomePath) {
|
public String executeTestCaseById(Long id, String jmeterHomePath) {
|
||||||
TestCase testCase = this.selectTestCaseById(id);
|
TestCase testCase = this.selectTestCaseById(id);
|
||||||
if (testCase == null || "2".equals(testCase.getDelFlag())) {
|
if (testCase == null || "2".equals(testCase.getDelFlag())) {
|
||||||
log.error("用例计划已被删除,不能执行!");
|
log.error("用例计划已被删除,不能执行!");
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
TestCaseLog testCaseLog = new TestCaseLog();
|
TestCaseLog testCaseLog = new TestCaseLog();
|
||||||
testCaseLog.setCaseId(id);
|
testCaseLog.setCaseId(id);
|
||||||
@@ -157,7 +157,7 @@ public class TestCaseServiceImpl implements ITestCaseService
|
|||||||
testCaseLog.setOperDetail("失败");
|
testCaseLog.setOperDetail("失败");
|
||||||
testCaseLogMapper.insertTestCaseLog(testCaseLog);
|
testCaseLogMapper.insertTestCaseLog(testCaseLog);
|
||||||
log.error("用例步骤:{}执行失败!", testCaseStep.getName());
|
log.error("用例步骤:{}执行失败!", testCaseStep.getName());
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
} else if (testCaseStep.getType() == 2L) {
|
} else if (testCaseStep.getType() == 2L) {
|
||||||
// 数据库接口处理
|
// 数据库接口处理
|
||||||
@@ -166,7 +166,7 @@ public class TestCaseServiceImpl implements ITestCaseService
|
|||||||
testCaseLog.setOperDetail("失败");
|
testCaseLog.setOperDetail("失败");
|
||||||
testCaseLogMapper.insertTestCaseLog(testCaseLog);
|
testCaseLogMapper.insertTestCaseLog(testCaseLog);
|
||||||
log.error("数据源用例步骤:{}执行失败!", testCaseStep.getName());
|
log.error("数据源用例步骤:{}执行失败!", testCaseStep.getName());
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
} else if (testCaseStep.getType() == 3L) {
|
} else if (testCaseStep.getType() == 3L) {
|
||||||
// 循环节点处理
|
// 循环节点处理
|
||||||
@@ -175,7 +175,7 @@ public class TestCaseServiceImpl implements ITestCaseService
|
|||||||
testCaseLog.setOperDetail("失败");
|
testCaseLog.setOperDetail("失败");
|
||||||
testCaseLogMapper.insertTestCaseLog(testCaseLog);
|
testCaseLogMapper.insertTestCaseLog(testCaseLog);
|
||||||
log.error("循环用例步骤:{}执行失败!", testCaseStep.getName());
|
log.error("循环用例步骤:{}执行失败!", testCaseStep.getName());
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
} else if (testCaseStep.getType() == 4L) {
|
} else if (testCaseStep.getType() == 4L) {
|
||||||
// 轮询节点处理
|
// 轮询节点处理
|
||||||
@@ -184,7 +184,7 @@ public class TestCaseServiceImpl implements ITestCaseService
|
|||||||
testCaseLog.setOperDetail("失败");
|
testCaseLog.setOperDetail("失败");
|
||||||
testCaseLogMapper.insertTestCaseLog(testCaseLog);
|
testCaseLogMapper.insertTestCaseLog(testCaseLog);
|
||||||
log.error("轮询用例步骤:{}执行失败!", testCaseStep.getName());
|
log.error("轮询用例步骤:{}执行失败!", testCaseStep.getName());
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.error("错误的用例步骤类型!");
|
log.error("错误的用例步骤类型!");
|
||||||
@@ -192,7 +192,7 @@ public class TestCaseServiceImpl implements ITestCaseService
|
|||||||
}
|
}
|
||||||
testCaseLog.setOperDetail("成功");
|
testCaseLog.setOperDetail("成功");
|
||||||
testCaseLogMapper.insertTestCaseLog(testCaseLog);
|
testCaseLogMapper.insertTestCaseLog(testCaseLog);
|
||||||
return true;
|
return caseSid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -54,3 +54,12 @@ export function delCaseStep(id) {
|
|||||||
data: {id}
|
data: {id}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询步骤日志详细
|
||||||
|
export function getCaseResult(sid) {
|
||||||
|
return request({
|
||||||
|
url: '/test/testCaseStepResult/list',
|
||||||
|
method: 'get',
|
||||||
|
params: {sid: sid}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -22,19 +22,26 @@
|
|||||||
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList"/>
|
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList"/>
|
||||||
</div>
|
</div>
|
||||||
<el-empty v-else/>
|
<el-empty v-else/>
|
||||||
|
<el-dialog title="操作日志详细" :visible.sync="open" >
|
||||||
|
<div v-if="open">
|
||||||
|
<report :sid="caseSID"/>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
</folder-page>
|
</folder-page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import FolderPage from "@/components/FolderPage/index.vue";
|
import FolderPage from "@/components/FolderPage/index.vue";
|
||||||
|
import Report from "@/views/test/case/report/index.vue";
|
||||||
import {addCase, delCase, listCase, runCase} from "@/api/test/case";
|
import {addCase, delCase, listCase, runCase} from "@/api/test/case";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Case",
|
name: "Case",
|
||||||
components: {FolderPage},
|
components: {FolderPage, Report},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
|
open: false,
|
||||||
showSearch: true,
|
showSearch: true,
|
||||||
total: 0,
|
total: 0,
|
||||||
dataList: [],
|
dataList: [],
|
||||||
@@ -43,6 +50,7 @@ export default {
|
|||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
groupId: null,
|
groupId: null,
|
||||||
},
|
},
|
||||||
|
caseSID: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -83,8 +91,10 @@ export default {
|
|||||||
handleRun(id) {
|
handleRun(id) {
|
||||||
this.$modal.confirm('是否确认执行用例?').then(function () {
|
this.$modal.confirm('是否确认执行用例?').then(function () {
|
||||||
return runCase(id);
|
return runCase(id);
|
||||||
}).then(() => {
|
}).then((res) => {
|
||||||
this.$modal.msgSuccess("执行成功");
|
this.$modal.msgSuccess("执行成功");
|
||||||
|
this.caseSID = res.msg
|
||||||
|
this.open = true;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleRowClick(row) {
|
handleRowClick(row) {
|
||||||
|
|||||||
@@ -5,111 +5,43 @@
|
|||||||
<el-button size="mini" plain type="warning" icon="el-icon-rank" circle style="margin-right: 12px" class="drag-handle"/>
|
<el-button size="mini" plain type="warning" icon="el-icon-rank" circle style="margin-right: 12px" class="drag-handle"/>
|
||||||
<el-tag effect="plain" style="width: 70px;text-align: center;margin-right: 12px;" class="drag-handle">{{ dict.type.step_type.findLast(t => t.value == item.type).label }}</el-tag>
|
<el-tag effect="plain" style="width: 70px;text-align: center;margin-right: 12px;" class="drag-handle">{{ dict.type.step_type.findLast(t => t.value == item.type).label }}</el-tag>
|
||||||
<el-tag v-if="item.name" effect="plain" style="width: 240px;text-align: center;margin-right: 12px;" type="info" class="drag-handle">{{ item.name }}</el-tag>
|
<el-tag v-if="item.name" effect="plain" style="width: 240px;text-align: center;margin-right: 12px;" type="info" class="drag-handle">{{ item.name }}</el-tag>
|
||||||
<el-tag v-if="item.datasourceId" effect="plain" style="width: 240px;text-align: center;margin-right: 12px;" type="info" class="drag-handle">{{ datasourceList.findLast(t => t.id === item.datasourceId).name }}</el-tag>
|
<el-tag v-if="item.datasourceId && item.type < 3" effect="plain" style="width: 240px;text-align: center;margin-right: 12px;" type="info" class="drag-handle">{{ datasourceList.findLast(t => t.id === item.datasourceId).name }}</el-tag>
|
||||||
<el-tag v-if="item.requestUrl" effect="plain" style="text-align: center;margin-right: 12px;" type="success" class="drag-handle">{{ item.requestUrl }}</el-tag>
|
<el-tag v-if="item.requestUrl" effect="plain" style="text-align: center;margin-right: 12px;" type="success" class="drag-handle">{{ item.requestUrl }}</el-tag>
|
||||||
<el-tag effect="plain" style="text-align: center;margin-right: 12px;" class="drag-handle">{{ index + 1 }}</el-tag>
|
<el-tag effect="plain" style="text-align: center;margin-right: 12px;" class="drag-handle">{{ index + 1 }}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
<el-tabs v-model="tabsActiveName" v-if="item.type == 2 || item.type == 1">
|
<el-tabs v-model="tabsActiveName" v-if="item.type == 2 || item.type == 1">
|
||||||
<el-tab-pane v-if="item.type == 1" label="Headers" name="Headers">
|
<el-tab-pane v-if="item.type == 1" label="Headers" name="Headers">
|
||||||
<el-table :data="form.requestHeader">
|
<el-table :data="form.requestHeader">
|
||||||
<el-table-column label="参数名">
|
<el-table-column label="参数名" prop="key" />
|
||||||
<template slot-scope="scope">
|
<el-table-column label="示例值" prop="value" />
|
||||||
<el-input placeholder="请输入参数名" v-model="form.requestHeader[scope.$index].key" @input="e => handleTableEdit(e, 'header', scope)" clearable/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="示例值">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-input placeholder="请输入参数名" v-model="form.requestHeader[scope.$index].value" @input="e => handleTableEdit(e, 'header', scope)" clearable/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="操作" width="60">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-button v-if="form.requestHeader.length > scope.$index+1" size="mini" type="text" icon="el-icon-delete" @click="handleDelete('header', scope)">删除</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane v-if="item.type == 1" label="Params" name="Params">
|
<el-tab-pane v-if="item.type == 1" label="Params" name="Params">
|
||||||
<el-table :data="form.requestParams">
|
<el-table :data="form.requestParams">
|
||||||
<el-table-column label="参数名">
|
<el-table-column label="参数名" prop="key" />
|
||||||
<template slot-scope="scope">
|
<el-table-column label="示例值" prop="value" />
|
||||||
<el-input placeholder="请输入参数名" v-model="form.requestParams[scope.$index].key" @input="e => handleTableEdit(e, 'param', scope)" clearable/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="示例值">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-input placeholder="请输入示例值" v-model="form.requestParams[scope.$index].value" @input="e => handleTableEdit(e, 'param', scope)" clearable/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="操作" width="60">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-button v-if="form.requestParams.length > scope.$index+1" size="mini" type="text" icon="el-icon-delete" @click="handleDelete('param', scope)">删除</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane v-if="item.type == 1" label="Body" name="Body">
|
<el-tab-pane v-if="item.type == 1" label="Body" name="Body">
|
||||||
<JsonEditorVue mode="text" v-model="form.requestBody" class="jse-theme-dark"/>
|
<JsonEditorVue mode="text" v-model="item.requestBody" class="jse-theme-dark"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane v-if="item.type == 2" label="SQL指令" name="sql">
|
<el-tab-pane v-if="item.type == 2" label="SQL指令" name="sql">
|
||||||
<codemirror v-model="form.sqlCommand" :options="editorOptions" />
|
<div>{{item.sqlCommand}}</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="提取" name="assignment">
|
<el-tab-pane label="提取" name="assignment">
|
||||||
<el-table :data="form.assignment">
|
<el-table :data="item.sqlResult">
|
||||||
<el-table-column label="变量名">
|
<el-table-column label="变量名" prop="name" />
|
||||||
<template slot-scope="scope">
|
<el-table-column label="提取方式" prop="type" />
|
||||||
<el-input placeholder="请输入变量名" v-model="form.assignment[scope.$index].name" @input="e => handleTableEdit(e, 'assignment', scope)" clearable/>
|
<el-table-column label="提取对象" prop="content" />
|
||||||
</template>
|
<el-table-column label="提取表达式" prop="path" />
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="提取方式">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-input placeholder="请输入提取方式" v-model="form.assignment[scope.$index].type" @input="e => handleTableEdit(e, 'assignment', scope)" clearable/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="提取对象">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-input placeholder="请输入提取对象" v-model="form.assignment[scope.$index].content" @input="e => handleTableEdit(e, 'assignment', scope)" clearable/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="提取表达式">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-input placeholder="请输入提取表达式" v-model="form.assignment[scope.$index].path" @input="e => handleTableEdit(e, 'assignment', scope)" clearable/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="操作" width="60">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-button v-if="form.assignment.length > scope.$index+1" size="mini" type="text" icon="el-icon-delete" @click="handleDelete('assignment', scope)">删除</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="校验" name="assertion">
|
<el-tab-pane label="校验" name="assertion">
|
||||||
<el-table :data="form.assertion">
|
<el-table :data="item.assertion">
|
||||||
<el-table-column label="描述">
|
<el-table-column label="描述" prop="name" />
|
||||||
<template slot-scope="scope">
|
<el-table-column label="对象" prop="source" />
|
||||||
<el-input placeholder="请输入描述" v-model="form.assertion[scope.$index].name" @input="e => handleTableEdit(e, 'assertion', scope)" clearable/>
|
<el-table-column label="条件" prop="fn" />
|
||||||
</template>
|
<el-table-column label="内容" prop="target" />
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="对象">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-input placeholder="请输入对象" v-model="form.assertion[scope.$index].source" @input="e => handleTableEdit(e, 'assertion', scope)" clearable/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="条件">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-input placeholder="请输入条件" v-model="form.assertion[scope.$index].fn" @input="e => handleTableEdit(e, 'assertion', scope)" clearable/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="内容">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-input placeholder="请输入内容" v-model="form.assertion[scope.$index].target" @input="e => handleTableEdit(e, 'assertion', scope)" clearable/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="操作" width="60">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-button v-if="form.assertion.length > scope.$index+1" size="mini" type="text" icon="el-icon-delete" @click="handleDelete('assertion', scope)">删除</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
@@ -166,64 +98,22 @@
|
|||||||
<JsonEditorVue mode="text" v-model="form.requestBody" class="jse-theme-dark"/>
|
<JsonEditorVue mode="text" v-model="form.requestBody" class="jse-theme-dark"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane v-if="item.type == 2" label="SQL指令" name="sql">
|
<el-tab-pane v-if="item.type == 2" label="SQL指令" name="sql">
|
||||||
<codemirror v-model="form.sqlCommand" :options="editorOptions" />
|
<div>{{item.sqlCommand}}</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="提取" name="assignment">
|
<el-tab-pane label="提取" name="assignment">
|
||||||
<el-table :data="form.assignment">
|
<el-table :data="item.sqlResult">
|
||||||
<el-table-column label="变量名">
|
<el-table-column label="变量名" prop="name" />
|
||||||
<template slot-scope="scope">
|
<el-table-column label="提取方式" prop="type" />
|
||||||
<el-input placeholder="请输入变量名" v-model="form.assignment[scope.$index].name" @input="e => handleTableEdit(e, 'assignment', scope)" clearable/>
|
<el-table-column label="提取对象" prop="content" />
|
||||||
</template>
|
<el-table-column label="提取表达式" prop="path" />
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="提取方式">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-input placeholder="请输入提取方式" v-model="form.assignment[scope.$index].type" @input="e => handleTableEdit(e, 'assignment', scope)" clearable/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="提取对象">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-input placeholder="请输入提取对象" v-model="form.assignment[scope.$index].content" @input="e => handleTableEdit(e, 'assignment', scope)" clearable/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="提取表达式">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-input placeholder="请输入提取表达式" v-model="form.assignment[scope.$index].path" @input="e => handleTableEdit(e, 'assignment', scope)" clearable/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="操作" width="60">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-button v-if="form.assignment.length > scope.$index+1" size="mini" type="text" icon="el-icon-delete" @click="handleDelete('assignment', scope)">删除</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="校验" name="assertion">
|
<el-tab-pane label="校验" name="assertion">
|
||||||
<el-table :data="form.assertion">
|
<el-table :data="item.assertion">
|
||||||
<el-table-column label="描述">
|
<el-table-column label="描述" prop="name" />
|
||||||
<template slot-scope="scope">
|
<el-table-column label="对象" prop="source" />
|
||||||
<el-input placeholder="请输入描述" v-model="form.assertion[scope.$index].name" @input="e => handleTableEdit(e, 'assertion', scope)" clearable/>
|
<el-table-column label="条件" prop="fn" />
|
||||||
</template>
|
<el-table-column label="内容" prop="target" />
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="对象">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-input placeholder="请输入对象" v-model="form.assertion[scope.$index].source" @input="e => handleTableEdit(e, 'assertion', scope)" clearable/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="条件">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-input placeholder="请输入条件" v-model="form.assertion[scope.$index].fn" @input="e => handleTableEdit(e, 'assertion', scope)" clearable/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="内容">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-input placeholder="请输入内容" v-model="form.assertion[scope.$index].target" @input="e => handleTableEdit(e, 'assertion', scope)" clearable/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="操作" width="60">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-button v-if="form.assertion.length > scope.$index+1" size="mini" type="text" icon="el-icon-delete" @click="handleDelete('assertion', scope)">删除</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
@@ -236,17 +126,46 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
import JsonEditorVue from "json-editor-vue";
|
import JsonEditorVue from "json-editor-vue";
|
||||||
|
import {getCaseResult} from "@/api/test/caseStep";
|
||||||
|
import {listDatasource} from "@/api/test/database";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {JsonEditorVue},
|
components: {JsonEditorVue},
|
||||||
|
props: ["sid"],
|
||||||
|
dicts: ['step_type'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
form: {},
|
form: {},
|
||||||
activeName: '',
|
activeName: '',
|
||||||
tabsActiveName: '',
|
tabsActiveName: '',
|
||||||
childrenTabsActiveName: '',
|
childrenTabsActiveName: '',
|
||||||
list: []
|
list: [],
|
||||||
|
datasourceList: [],
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
listDatasource().then(res => {
|
||||||
|
this.datasourceList = res.data;
|
||||||
|
})
|
||||||
|
getCaseResult(this.sid).then(res => {
|
||||||
|
res.data.forEach(item => {
|
||||||
|
this.list.push({
|
||||||
|
...item.step,
|
||||||
|
...item.result,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
this.list.forEach(item => {
|
||||||
|
item = {
|
||||||
|
...item,
|
||||||
|
assertion: item.assertion ? JSON.parse(item.assertion) : [],
|
||||||
|
assignment: item.assignment ? JSON.parse(item.assignment) : [],
|
||||||
|
requestHeader: item.requestHeader ? JSON.parse(item.requestHeader) : [],
|
||||||
|
requestParams: item.requestParams ? JSON.parse(item.requestParams) : [],
|
||||||
|
sqlResult: item.requestParams ? JSON.parse(item.requestParams) : [],
|
||||||
|
}
|
||||||
|
})
|
||||||
|
console.log(this.list)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user