This commit is contained in:
fit2-zhao 2021-03-10 11:15:29 +08:00
commit b9d43558bc
31 changed files with 562 additions and 211 deletions

View File

@ -378,11 +378,8 @@ public class APITestController {
String testName = runRequest.getName();
//将jmx处理封装为通用方法
jmxString = apiTestService.updateJmxString(jmxString,testName,false);
JmxInfoDTO dto = new JmxInfoDTO();
JmxInfoDTO dto = apiTestService.updateJmxString(jmxString,testName,false);
dto.setName(runRequest.getName() + ".jmx");
dto.setXml(jmxString);
return dto;
}

View File

@ -1,32 +1,18 @@
package io.metersphere.api.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.metersphere.api.dto.document.ApiDocumentInfoDTO;
import io.metersphere.api.dto.document.ApiDocumentRequest;
import io.metersphere.api.dto.document.ApiDocumentShareRequest;
import io.metersphere.api.dto.document.ApiDocumentSimpleInfoDTO;
import io.metersphere.api.dto.document.ApiDocumentShareDTO;
import io.metersphere.api.dto.document.ApiDocumentShareRequest;
import io.metersphere.api.service.APITestService;
import io.metersphere.api.service.ApiDefinitionService;
import io.metersphere.api.service.ApiDocumentService;
import io.metersphere.base.domain.ApiDefinition;
import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
import io.metersphere.base.domain.ApiDocumentShare;
import io.metersphere.base.domain.ApiDocumentShareExample;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
import org.python.antlr.ast.Str;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author song.tianyang
@ -68,28 +54,4 @@ public class ApiDocumentController {
ApiDocumentShareDTO returnDTO = apiDocumentService.conversionApiDocumentShareToDTO(apiShare);
return returnDTO;
}
@GetMapping("/updateJmxByFile")
public String updateJmxByFile(){
StringBuilder jmxBuilder = new StringBuilder();
try {
String filePath = "/Users/admin/Downloads/成功吧 (20).jmx";
File file = new File(filePath);
BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
String strLine = null;
while(null != (strLine = bufferedReader.readLine())){
if(StringUtils.isNotEmpty(strLine)){
jmxBuilder.append(strLine);
}
}
}catch(Exception e){
e.printStackTrace();
}
String jmx = apiTestService.updateJmxString(jmxBuilder.toString(),null,false);
return jmx;
}
}

View File

@ -1,8 +1,11 @@
package io.metersphere.api.dto;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import java.util.Map;
/**
* @author song.tianyang
* @Date 2021/1/5 5:48 下午
@ -10,7 +13,9 @@ import lombok.Setter;
*/
@Getter
@Setter
@AllArgsConstructor
public class JmxInfoDTO {
private String name;
private String xml;
private Map<String, String> attachFiles;
}

View File

@ -85,6 +85,7 @@ public class MsScenario extends MsTestElement {
JSONObject element = JSON.parseObject(scenario.getScenarioDefinition());
hashTree = mapper.readValue(element.getString("hashTree"), new TypeReference<LinkedList<MsTestElement>>() {
});
OldVersionUtil.transferHashTree(hashTree);
// 场景变量
if (StringUtils.isNotEmpty(element.getString("variables"))) {
LinkedList<ScenarioVariable> variables = mapper.readValue(element.getString("variables"),

View File

@ -161,6 +161,7 @@ public abstract class MsTestElement {
element = mapper.readValue(apiDefinition.getRequest(), new TypeReference<MsTestElement>() {
});
hashTree.add(element);
OldVersionUtil.transferHashTree(hashTree);
}
} catch (Exception ex) {
ex.printStackTrace();

View File

@ -0,0 +1,23 @@
package io.metersphere.api.dto.definition.request;
import io.metersphere.commons.utils.SessionUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.List;
public class OldVersionUtil {
public static void transferHashTree(List<MsTestElement> hashTree) {
for (int i = 0; i < hashTree.size(); i++) {
MsTestElement element = hashTree.get(i);
if (StringUtils.isBlank(element.getProjectId())) {
element.setProjectId(SessionUtils.getCurrentProjectId());
}
if (element.getHashTree() != null && element.getHashTree().size() > 0) {
transferHashTree(element.getHashTree());
}
}
}
}

View File

@ -472,11 +472,13 @@ public class APITestService {
* @return
* @author song tianyang
*/
public String updateJmxString(String jmxString, String testNameParam, boolean isFromScenario) {
public JmxInfoDTO updateJmxString(String jmxString, String testNameParam, boolean isFromScenario) {
// 与1.7分支合并时如果该方法产生冲突请以master为准
String attribute_testName = "testname";
String[] requestElementNameArr = new String[]{"HTTPSamplerProxy", "TCPSampler", "JDBCSampler", "DubboSample"};
List<String> attachmentFilePathList = new ArrayList<>();
try {
//将ThreadGroup的testname改为接口名称
Document doc = DocumentHelper.parseText(jmxString);// 获取可续保保单列表报文模板
@ -511,6 +513,9 @@ public class APITestService {
for (Element configTestElement : hashTreeConfigTestElementList) {
this.updateDubboDefaultConfigGuiElement(configTestElement);
}
//HTTPSamplerProxy 进行附件转化 1.elementProp里去掉路径 2elementProp->filePath获取路径并读出来
attachmentFilePathList.addAll(this.parseAttachmentFileInfo(element));
}
}
jmxString = root.asXML();
@ -521,7 +526,60 @@ public class APITestService {
if (!jmxString.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")) {
jmxString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + jmxString;
}
return jmxString;
//处理附件
Map<String, String> attachmentFiles = new HashMap<>();
int fileIndex = 0;
for (String filePath: attachmentFilePathList) {
File file = new File(filePath);
if(file.exists() && file.isFile()){
try{
FileMetadata fileMetadata = fileService.saveFile(file,FileUtil.readAsByteArray(file),fileIndex++);
attachmentFiles.put(fileMetadata.getId(),fileMetadata.getName());
}catch (Exception e){
e.printStackTrace();
}
}
}
JmxInfoDTO returnDTO = new JmxInfoDTO("Demo.jmx",jmxString,attachmentFiles);
return returnDTO;
}
private List<String> parseAttachmentFileInfo(Element parentHashTreeElement) {
List<String> attachmentFilePathList = new ArrayList<>();
List<Element> parentElementList = parentHashTreeElement.elements();
for (Element parentElement: parentElementList) {
String qname = parentElement.getQName().getName();
if (StringUtils.equals(qname,"HTTPSamplerProxy")){
List<Element> elementPropElementList = parentElement.elements("elementProp");
for (Element element : elementPropElementList) {
if(StringUtils.equals(element.attributeValue("name"),"HTTPsampler.Files")){
String name = element.getName();
List<Element> collectionPropList = element.elements("collectionProp");
for (Element prop: collectionPropList) {
List<Element> elementProps = prop.elements();
for (Element elementProp: elementProps) {
if(StringUtils.equals(elementProp.attributeValue("elementType"),"HTTPFileArg")){
try{
String filePath = elementProp.attributeValue("name");
File file = new File(filePath);
if(file.exists() && file.isFile()){
attachmentFilePathList.add(filePath);
String fileName = file.getName();
elementProp.attribute("name").setText(fileName);
}
}catch (Exception e){
}
}
}
}
}
}
}
}
return attachmentFilePathList;
}
private void updateDubboDefaultConfigGuiElement(Element configTestElement) {

View File

@ -376,6 +376,7 @@ public class ApiAutomationService {
return report;
}
private void parse(String scenarioDefinition, MsScenario scenario) {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@ -743,12 +744,10 @@ public class ApiAutomationService {
}
MsTestPlan testPlan = new MsTestPlan();
testPlan.setHashTree(new LinkedList<>());
String jmx = apiTestService.updateJmxString(generateJmx(apiScenarios.get(0)), testName, true);
JmxInfoDTO dto = apiTestService.updateJmxString(generateJmx(apiScenarios.get(0)), testName, true);
String name = request.getName() + ".jmx";
JmxInfoDTO dto = new JmxInfoDTO();
dto.setName(name);
dto.setXml(jmx);
return dto;
}
@ -897,7 +896,7 @@ public class ApiAutomationService {
if (StringUtils.isNotEmpty(item.getScenarioDefinition())) {
String jmx = generateJmx(item);
if (StringUtils.isNotEmpty(jmx)) {
ApiScenrioExportJmx scenrioExportJmx = new ApiScenrioExportJmx(item.getName(), apiTestService.updateJmxString(jmx, null, true));
ApiScenrioExportJmx scenrioExportJmx = new ApiScenrioExportJmx(item.getName(), apiTestService.updateJmxString(jmx, null, true).getXml());
resList.add(scenrioExportJmx);
}
}

View File

@ -100,7 +100,7 @@
select test_case_review_test_case.id as id, test_case.id as caseId, test_case.name, test_case.priority,
test_case.type, test_case.node_path, test_case.method, test_case.num, test_case_review_test_case.reviewer,
test_case.review_status, test_case_review_test_case.update_time, test_case_node.name as model,
project.name as projectName, test_case_review_test_case.review_id as reviewId
project.name as projectName, test_case_review_test_case.review_id as reviewId,test_case.test_id as testId
from test_case_review_test_case
inner join test_case on test_case_review_test_case.case_id = test_case.id
left join test_case_node on test_case_node.id=test_case.node_id

View File

@ -150,6 +150,11 @@ public class PerformanceTestController {
return fileService.getFileMetadataByTestId(testId);
}
@GetMapping("/file/getMetadataById/{metadataId}")
public FileMetadata getMetadataById(@PathVariable String metadataId) {
return fileService.getFileMetadataById(metadataId);
}
@PostMapping("/file/download")
public ResponseEntity<byte[]> downloadJmx(@RequestBody FileOperationRequest fileOperationRequest) {
byte[] bytes = fileService.loadFileAsBytes(fileOperationRequest.getId());

View File

@ -12,4 +12,5 @@ import java.util.Map;
public class SaveTestPlanRequest extends TestPlanRequest {
private List<FileMetadata> updatedFileList;
private Map<String, Integer> fileSorts;
private List<String> conversionFileIdList;
}

View File

@ -138,10 +138,35 @@ public class PerformanceTestService {
this.importFiles(importFileIds, loadTest.getId(), request.getFileSorts());
// 保存上传的文件
this.saveUploadFiles(files, loadTest.getId(), request.getFileSorts());
//关联转化的文件
this.conversionFiles(loadTest.getId(),request.getConversionFileIdList());
return loadTest.getId();
}
private void conversionFiles(String id, List<String> conversionFileIdList) {
for (String metaFileId : conversionFileIdList) {
if(!this.loadTestFileExsits(id,metaFileId)){
LoadTestFile loadTestFile = new LoadTestFile();
loadTestFile.setTestId(id);
loadTestFile.setFileId(metaFileId);
loadTestFileMapper.insert(loadTestFile);
}
}
}
private boolean loadTestFileExsits(String testId, String metaFileId) {
boolean fileExsits = fileService.isFileExsits(metaFileId);
LoadTestFileExample example = new LoadTestFileExample();
example.createCriteria().andTestIdEqualTo(testId).andFileIdEqualTo(metaFileId);
long loadTestFiles = loadTestFileMapper.countByExample(example);
if(!fileExsits && loadTestFiles>0){
return false;
}else {
return true;
}
}
private void saveUploadFiles(List<MultipartFile> files, String testId, Map<String, Integer> fileSorts) {
if (files != null) {
for (int i = 0; i < files.size(); i++) {

View File

@ -12,6 +12,7 @@ import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
@ -113,6 +114,26 @@ public class FileService {
return fileMetadata;
}
public FileMetadata saveFile(File file, byte[] fileByte, Integer sort) {
final FileMetadata fileMetadata = new FileMetadata();
fileMetadata.setId(UUID.randomUUID().toString());
fileMetadata.setName(file.getName());
fileMetadata.setSize(file.length());
fileMetadata.setCreateTime(System.currentTimeMillis());
fileMetadata.setUpdateTime(System.currentTimeMillis());
FileType fileType = getFileType(fileMetadata.getName());
fileMetadata.setType(fileType.name());
fileMetadata.setSort(sort);
fileMetadataMapper.insert(fileMetadata);
FileContent fileContent = new FileContent();
fileContent.setFileId(fileMetadata.getId());
fileContent.setFile(fileByte);
fileContentMapper.insert(fileContent);
return fileMetadata;
}
public FileMetadata saveFile(byte[] fileByte, String fileName, Long fileSize) {
final FileMetadata fileMetadata = new FileMetadata();
fileMetadata.setId(UUID.randomUUID().toString());
@ -185,4 +206,15 @@ public class FileService {
public void updateFileMetadata(FileMetadata fileMetadata) {
fileMetadataMapper.updateByPrimaryKeySelective(fileMetadata);
}
public boolean isFileExsits(String fileId) {
FileMetadataExample example = new FileMetadataExample();
example.createCriteria().andIdEqualTo(fileId);
long fileCount = fileMetadataMapper.countByExample(example);
if(fileCount>0){
return true;
}else {
return false;
}
}
}

View File

@ -68,8 +68,8 @@ public class TestCaseReviewController {
@PostMapping("/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void editCaseReview(@RequestBody SaveTestCaseReviewRequest testCaseReview) {
testCaseReviewService.editCaseReview(testCaseReview);
public String editCaseReview(@RequestBody SaveTestCaseReviewRequest testCaseReview) {
return testCaseReviewService.editCaseReview(testCaseReview);
}
@GetMapping("/delete/{reviewId}")

View File

@ -203,7 +203,7 @@ public class TestCaseReviewService {
return extTestCaseReviewMapper.listByWorkspaceId(currentWorkspaceId, SessionUtils.getUserId(), SessionUtils.getCurrentProjectId());
}
public void editCaseReview(SaveTestCaseReviewRequest testCaseReview) {
public String editCaseReview(SaveTestCaseReviewRequest testCaseReview) {
editCaseReviewer(testCaseReview);
testCaseReview.setUpdateTime(System.currentTimeMillis());
checkCaseReviewExist(testCaseReview);
@ -221,6 +221,7 @@ public class TestCaseReviewService {
.event(NoticeConstants.Event.UPDATE)
.build();
noticeSendService.send(NoticeConstants.TaskType.REVIEW_TASK, noticeModel);
return testCaseReview.getId();
}
private void editCaseReviewer(SaveTestCaseReviewRequest testCaseReview) {

View File

@ -1,15 +1,18 @@
<template>
<el-card>
<div class="card-content">
<div class="ms-main-div" @click="showAll">
<div class="ms-main-div" @click="showAll" v-if="type!=='detail'">
<!--操作按钮-->
<div class="ms-opt-btn">
<el-button id="inputDelay" type="primary" size="small" @click="editScenario" title="ctrl + s">{{$t('commons.save')}}</el-button>
<el-button id="inputDelay" type="primary" size="small" @click="editScenario" title="ctrl + s">
{{ $t('commons.save') }}
</el-button>
</div>
<div class="tip">{{$t('test_track.plan_view.base_info')}}</div>
<el-form :model="currentScenario" label-position="right" label-width="80px" size="small" :rules="rules" ref="currentScenario" style="margin-right: 20px">
<div class="tip">{{ $t('test_track.plan_view.base_info') }}</div>
<el-form :model="currentScenario" label-position="right" label-width="80px" size="small" :rules="rules"
ref="currentScenario" style="margin-right: 20px">
<!-- 基础信息 -->
<el-row>
<el-col :span="7">
@ -99,7 +102,7 @@
<div class="ms-debug-div" @click="showAll">
<el-row style="margin: 5px">
<el-col :span="6" class="ms-col-one ms-font">
{{currentScenario.name ===undefined || ''? $t('api_test.scenario.name') : currentScenario.name}}
{{ currentScenario.name === undefined || '' ? $t('api_test.scenario.name') : currentScenario.name }}
</el-col>
<el-col :span="3" class="ms-col-one ms-font">
{{$t('api_test.automation.step_total')}}{{scenarioDefinition.length}}
@ -160,30 +163,35 @@
</div>
<!--接口列表-->
<scenario-api-relevance @save="pushApiOrCase" ref="scenarioApiRelevance"/>
<scenario-api-relevance @save="pushApiOrCase" ref="scenarioApiRelevance" v-if="type!=='detail'"/>
<!--自定义接口-->
<el-drawer :visible.sync="customizeVisible" :destroy-on-close="true" direction="ltr" :withHeader="false" :title="$t('api_test.automation.customize_req')" style="overflow: auto" :modal="false" size="90%">
<el-drawer v-if="type!=='detail'" :visible.sync="customizeVisible" :destroy-on-close="true" direction="ltr"
:withHeader="false" :title="$t('api_test.automation.customize_req')" style="overflow: auto"
:modal="false" size="90%">
<ms-api-customize :request="customizeRequest" @addCustomizeApi="addCustomizeApi"/>
</el-drawer>
<!--场景导入 -->
<scenario-relevance @save="addScenario" ref="scenarioRelevance"/>
<scenario-relevance v-if="type!=='detail'" @save="addScenario" ref="scenarioRelevance"/>
<!-- 环境 -->
<api-environment-config ref="environmentConfig" @close="environmentConfigClose"/>
<api-environment-config v-if="type!=='detail'" ref="environmentConfig" @close="environmentConfigClose"/>
<!--执行组件-->
<ms-run :debug="true" :environment="projectEnvMap" :reportId="reportId" :run-data="debugData"
<ms-run :debug="true" v-if="type!=='detail'" :environment="projectEnvMap" :reportId="reportId"
:run-data="debugData"
@runRefresh="runRefresh" ref="runTest"/>
<!-- 调试结果 -->
<el-drawer :visible.sync="debugVisible" :destroy-on-close="true" direction="ltr" :withHeader="true" :modal="false" size="90%">
<el-drawer v-if="type!=='detail'" :visible.sync="debugVisible" :destroy-on-close="true" direction="ltr"
:withHeader="true" :modal="false" size="90%">
<ms-api-report-detail :report-id="reportId" :debug="true" :currentProjectId="projectId"/>
</el-drawer>
<!--场景公共参数-->
<ms-variable-list @setVariables="setVariables" ref="scenarioParameters" class="ms-sc-variable-header"/>
<ms-variable-list v-if="type!=='detail'" @setVariables="setVariables" ref="scenarioParameters"
class="ms-sc-variable-header"/>
<!--外部导入-->
<api-import ref="apiImport" :saved="false" @refresh="apiImport"/>
<api-import v-if="type!=='detail'" ref="apiImport" :saved="false" @refresh="apiImport"/>
</div>
</el-card>
</template>
@ -222,6 +230,7 @@
props: {
moduleOptions: Array,
currentScenario: {},
type: String
},
components: {
MsVariableList,
@ -532,6 +541,9 @@
if (arr[i].type === ELEMENT_TYPE.LoopController && arr[i].hashTree && arr[i].hashTree.length > 1) {
arr[i].countController.proceed = true;
}
if (!arr[i].projectId) {
arr[i].projectId = getCurrentProjectID();
}
if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) {
this.recursiveSorting(arr[i].hashTree);
}
@ -544,6 +556,9 @@
&& this.scenarioDefinition[i].hashTree.length > 1) {
this.scenarioDefinition[i].countController.proceed = true;
}
if (!this.scenarioDefinition[i].projectId) {
this.scenarioDefinition.projectId = getCurrentProjectID();
}
if (this.scenarioDefinition[i].hashTree != undefined && this.scenarioDefinition[i].hashTree.length > 0) {
this.recursiveSorting(this.scenarioDefinition[i].hashTree);
}
@ -919,14 +934,15 @@
}
this.enableCookieShare = obj.enableCookieShare;
this.scenarioDefinition = obj.hashTree;
this.initProjectIds();
}
}
if (this.currentScenario.copy) {
this.path = "/api/automation/create";
}
}
this.getEnvironments();
this.sort();
this.initProjectIds();
// this.getEnvironments();
})
}
},

View File

@ -55,6 +55,8 @@
let jmxObj = {};
jmxObj.name = response.data.name;
jmxObj.xml = response.data.xml;
jmxObj.attachFiles = response.data.attachFiles;
jmxObj.attachByteFiles = response.data.attachByteFiles;
this.$store.commit('setTest', {
name: row.name,
jmx: jmxObj

View File

@ -108,6 +108,9 @@
recursive(arr) {
for (let i in arr) {
arr[i].disabled = true;
if (!arr[i].projectId) {
arr[i].projectId = getCurrentProjectID();
}
if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) {
this.recursive(arr[i].hashTree);
}
@ -116,6 +119,9 @@
setDisabled(scenarioDefinition) {
for (let i in scenarioDefinition) {
scenarioDefinition[i].disabled = true;
if (!scenarioDefinition[i].projectId) {
scenarioDefinition[i].projectId = getCurrentProjectID();
}
if (scenarioDefinition[i].hashTree != undefined && scenarioDefinition[i].hashTree.length > 0) {
this.recursive(scenarioDefinition[i].hashTree);
}

View File

@ -1,6 +1,6 @@
<template>
<el-card style="margin-top: 5px" @click.native="selectTestCase(apiCase,$event)">
<div @click="active(apiCase)">
<div @click="active(apiCase)" v-if="type!=='detail'">
<el-row>
<el-col :span="5">
<el-row>
@ -79,16 +79,14 @@
</div>
</el-col>
</el-row>
<el-divider ></el-divider>
</div>
<!-- 请求参数-->
<el-collapse-transition>
<div v-if="apiCase.active">
<el-divider></el-divider>
<div v-if="apiCase.active||type==='detail'">
<p class="tip">{{ $t('api_test.definition.request.req_param') }} </p>
<ms-api-request-form :isShowEnable="true" :showScript="true" :is-read-only="isReadOnly" :headers="apiCase.request.headers " :request="apiCase.request" v-if="api.protocol==='HTTP'"/>
<ms-api-request-form :isShowEnable="true" :showScript="true" :is-read-only="isReadOnly" :headers="apiCase.request.headers " :request="apiCase.request" v-if="api.protocol==='HTTP'"/>
<ms-tcp-basis-parameters :showScript="true" :request="apiCase.request" v-if="api.protocol==='TCP'"/>
<ms-sql-basis-parameters :showScript="true" :request="apiCase.request" v-if="api.protocol==='SQL'"/>
<ms-dubbo-basis-parameters :showScript="true" :request="apiCase.request" v-if="api.protocol==='DUBBO'"/>
@ -99,12 +97,13 @@
<ms-jmx-step :request="apiCase.request" :response="apiCase.responseData"/>
<!-- 保存操作 -->
<el-button type="primary" size="small" style="margin: 20px; float: right" @click="saveTestCase(apiCase)" v-tester>
<el-button type="primary" size="small" style="margin: 20px; float: right" @click="saveTestCase(apiCase)" v-tester v-if="type!=='detail'">
{{ $t('commons.save') }}
</el-button>
</div>
</el-collapse-transition>
</el-card>
</template>
<script>
@ -183,6 +182,7 @@
return {}
}
},
type:String,
isCaseEdit: Boolean,
},
watch: {},

View File

@ -597,6 +597,8 @@ export default {
let jmxObj = {};
jmxObj.name = response.data.name;
jmxObj.xml = response.data.xml;
jmxObj.attachFiles = response.data.attachFiles;
jmxObj.attachByteFiles = response.data.attachByteFiles;
this.$store.commit('setTest', {
name: row.name,
jmx: jmxObj

View File

@ -87,6 +87,8 @@
let jmxObj = {};
jmxObj.name = response.data.name;
jmxObj.xml = response.data.xml;
jmxObj.attachFiles = response.data.attachFiles;
jmxObj.attachByteFiles = response.data.attachByteFiles;
this.$store.commit('setTest', {
name: row.name,
jmx: jmxObj

View File

@ -132,7 +132,8 @@
isReadOnly: {
type: Boolean,
default: false
}
},
type: String,
},
data() {

View File

@ -178,8 +178,11 @@ export default {
},
methods: {
calculateLoadConfiguration: function (data) {
for (let i = 0; i < data.length; i++) {
for (let i = 0; i < this.threadGroups.length; i++) {
let d = data[i];
if (!d) {
return;
}
d.forEach(item => {
switch (item.key) {
case TARGET_LEVEL:
@ -225,7 +228,7 @@ export default {
default:
break;
}
})
});
this.calculateChart(this.threadGroups[i]);
}

View File

@ -129,6 +129,15 @@ export default {
let file = new File([blob], apiTest.jmx.name);
this.$refs.basicConfig.beforeUploadJmx(file);
this.$refs.basicConfig.handleUpload({file: file});
if(JSON.stringify(apiTest.jmx.attachFiles) != "{}"){
let attachFiles = [];
for(let fileID in apiTest.jmx.attachFiles){
attachFiles.push(fileID);
}
if(attachFiles.length > 0){
this.$refs.basicConfig.selectAttachFileById(attachFiles);
}
}
this.active = '1';
this.$store.commit("clearTest");
}
@ -191,6 +200,7 @@ export default {
//
this.test.updatedFileList = this.$refs.basicConfig.updatedFileList();
this.test.fileSorts = this.$refs.basicConfig.fileSorts();
this.test.conversionFileIdList = this.$refs.basicConfig.conversionMetadataIdList();
//
this.test.loadConfiguration = JSON.stringify(this.$refs.pressureConfig.convertProperty());
this.test.testResourcePoolId = this.$refs.pressureConfig.resourcePool;
@ -215,6 +225,30 @@ export default {
}
};
},
stringToByte(str) {
var bytes = new Array();
var len, c;
len = str.length;
for(var i = 0; i < len; i++) {
c = str.charCodeAt(i);
if(c >= 0x010000 && c <= 0x10FFFF) {
bytes.push(((c >> 18) & 0x07) | 0xF0);
bytes.push(((c >> 12) & 0x3F) | 0x80);
bytes.push(((c >> 6) & 0x3F) | 0x80);
bytes.push((c & 0x3F) | 0x80);
} else if(c >= 0x000800 && c <= 0x00FFFF) {
bytes.push(((c >> 12) & 0x0F) | 0xE0);
bytes.push(((c >> 6) & 0x3F) | 0x80);
bytes.push((c & 0x3F) | 0x80);
} else if(c >= 0x000080 && c <= 0x0007FF) {
bytes.push(((c >> 6) & 0x1F) | 0xC0);
bytes.push((c & 0x3F) | 0x80);
} else {
bytes.push(c & 0xFF);
}
}
return bytes;
},
cancel() {
this.$router.push({path: '/performance/test/all'})
},

View File

@ -47,7 +47,8 @@
label="ThreadGroup">
<template v-slot:default="{row}">
<el-select v-model="row.tgType" :placeholder="$t('commons.please_select')" size="small">
<el-option v-for="tg in threadGroupForSelect" :key="tg.tagName" :label="tg.name" :value="tg.testclass"></el-option>
<el-option v-for="tg in threadGroupForSelect" :key="tg.tagName" :label="tg.name"
:value="tg.testclass"></el-option>
</el-select>
</template>
</el-table-column>
@ -163,11 +164,13 @@ export default {
result: {},
projectLoadingResult: {},
getFileMetadataPath: "/performance/file/metadata",
getFileMetadataById: "/performance/file/getMetadataById",
jmxDownloadPath: '/performance/file/download',
jmxDeletePath: '/performance/file/delete',
fileList: [],
tableData: [],
uploadList: [],
metadataIdList:[],
fileNumLimit: 10,
threadGroups: [],
loadFileVisible: false,
@ -211,6 +214,7 @@ export default {
this.fileList = [];
this.tableData = [];
this.uploadList = [];
this.metadataIdList = [];
this.result = this.$get(this.getFileMetadataPath + "/" + test.id, response => {
let files = response.data;
if (!files) {
@ -280,6 +284,22 @@ export default {
};
jmxReader.readAsText(file);
},
selectAttachFileById(metadataIdArr) {
this.metadataIdList = metadataIdArr;
for (let i = 0; i < metadataIdArr.length; i++) {
let id = metadataIdArr[i];
this.result = this.$get(this.getFileMetadataById + "/" + id, response => {
let files = response.data;
if (files) {
this.fileList.push(JSON.parse(JSON.stringify(files)));
this.tableData.push(JSON.parse(JSON.stringify(files)));
this.tableData.map(f => {
f.size = (f.size / 1024).toFixed(2) + ' KB';
});
}
})
}
},
handleDownload(file) {
let data = {
name: file.name,
@ -364,6 +384,9 @@ export default {
updatedFileList() {
return this.fileList;//
},
conversionMetadataIdList() {
return this.metadataIdList;//
},
fileSorts() {
let fileSorts = {};
this.tableData.forEach((f, index) => {

View File

@ -85,7 +85,7 @@
<el-button type="primary" @click="saveReview">
{{ $t('test_track.confirm') }}
</el-button>
<el-button type="primary" @click="reviewInfo('form')">
<el-button type="primary" @click="reviewInfo">
{{ $t('test_track.planning_execution') }}
</el-button>
</div>
@ -137,7 +137,23 @@ export default {
};
},
methods: {
reviewInfo(form) {
openCaseReviewEditDialog(caseReview) {
this.resetForm();
this.setReviewerOptions();
this.operationType = 'save';
if (caseReview) {
//
this.operationType = 'edit';
let tmp = {};
Object.assign(tmp, caseReview);
Object.assign(this.form, tmp);
this.dbProjectIds = JSON.parse(JSON.stringify(this.form.projectIds));
}
listenGoBack(this.close);
this.dialogFormVisible = true;
},
reviewInfo() {
this.$refs['reviewForm'].validate((valid) => {
if (valid) {
let param = {};
@ -155,7 +171,6 @@ export default {
if (!this.compareTime(new Date().getTime(), this.form.endTime)) {
return false;
}
this.result = this.$post('/test/case/review/' + this.operationType, param, response => {
this.dialogFormVisible = false;
this.$router.push('/track/review/view/' + response.data);
@ -165,21 +180,7 @@ export default {
}
});
},
openCaseReviewEditDialog(caseReview) {
this.resetForm();
this.setReviewerOptions();
this.operationType = 'save';
if (caseReview) {
//
this.operationType = 'edit';
let tmp = {};
Object.assign(tmp, caseReview);
Object.assign(this.form, tmp);
this.dbProjectIds = JSON.parse(JSON.stringify(this.form.projectIds));
}
listenGoBack(this.close);
this.dialogFormVisible = true;
},
saveReview() {
this.$refs['reviewForm'].validate((valid) => {
if (valid) {

View File

@ -14,7 +14,7 @@
<el-menu-item index="functional">功能测试用例</el-menu-item>
<el-menu-item index="api">接口测试用例</el-menu-item>
<el-menu-item index="load">性能测试用例</el-menu-item>
<el-menu-item index="report">报告统计</el-menu-item>
<!-- <el-menu-item index="report">报告统计</el-menu-item>-->
</el-menu>
</template>
</ms-test-plan-header-bar>
@ -24,6 +24,7 @@
:review-id="reviewId"></test-review-api>
<test-review-load v-if="activeIndex === 'load'" :redirectCharType="redirectCharType" :clickType="clickType"
:review-id="reviewId"></test-review-load>
</div>
</template>

View File

@ -1,55 +1,116 @@
<template>
<ms-test-plan-common-component>
<template v-slot:aside>
<ms-node-tree
class="node-tree"
:all-label="$t('commons.all_label.review')"
v-loading="result.loading"
<ms-api-module
v-if="model === 'api'"
@nodeSelectEvent="nodeChange"
:tree-nodes="treeNodes"
ref="nodeTree"/>
@protocolChange="handleProtocolChange"
@refreshTable="refreshTable"
@setModuleOptions="setModuleOptions"
:review-id="reviewId"
:is-read-only="true"
:redirectCharType="redirectCharType"
ref="apiNodeTree"
>
<template v-slot:header>
<div class="model-change-radio">
<el-radio v-model="model" label="api">接口用例</el-radio>
<el-radio v-model="model" label="scenario">场景用例</el-radio>
</div>
</template>
</ms-api-module>
<ms-api-scenario-module
v-if="model === 'scenario'"
@nodeSelectEvent="nodeChange"
@refreshTable="refreshTable"
@setModuleOptions="setModuleOptions"
:is-read-only="true"
:review-id="reviewId"
ref="scenarioNodeTree">
<template v-slot:header>
<div class="model-change-radio">
<el-radio v-model="model" label="api">接口用例</el-radio>
<el-radio v-model="model" label="scenario">场景用例</el-radio>
</div>
</template>
</ms-api-scenario-module>
</template>
<template v-slot:main>
<test-review-test-case-list
class="table-list"
@openTestReviewRelevanceDialog="openTestReviewRelevanceDialog"
@refresh="refresh"
:review-id="reviewId"
<test-plan-api-case-list
v-if="model === 'api'"
:current-protocol="currentProtocol"
:currentRow="currentRow"
:select-node-ids="selectNodeIds"
:trash-enable="trashEnable"
:is-case-relevance="true"
:model="'plan'"
:review-id="reviewId"
:clickType="clickType"
@refresh="refreshTree"
@relevanceCase="openTestCaseRelevanceDialog"
ref="apiCaseList"/>
<ms-test-plan-api-scenario-list
v-if="model === 'scenario'"
:select-node-ids="selectNodeIds"
:select-parent-nodes="selectParentNodes"
:trash-enable="trashEnable"
:review-id="reviewId"
:clickType="clickType"
ref="testPlanTestCaseList"/>
@refresh="refreshTree"
@relevanceCase="openTestCaseRelevanceDialog"
ref="apiScenarioList"/>
</template>
<test-review-relevance
<test-case-api-relevance
@refresh="refresh"
:review-id="reviewId"
ref="testReviewRelevance"/>
:model="model"
ref="apiCaseRelevance"/>
<test-case-scenario-relevance
@refresh="refresh"
:review-id="reviewId"
:model="model"
ref="scenarioCaseRelevance"/>
</ms-test-plan-common-component>
</template>
<script>
import MsTestPlanCommonComponent from "@/business/components/track/plan/view/comonents/base/TestPlanCommonComponent";
import FunctionalTestCaseList from "@/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList";
import MsNodeTree from "@/business/components/track/common/NodeTree";
import TestReviewRelevance from "@/business/components/track/review/view/components/TestReviewRelevance";
import TestReviewTestCaseList from "@/business/components/track/review/view/components/TestReviewTestCaseList";
import TestCaseScenarioRelevance from "@/business/components/track/plan/view/comonents/api/TestCaseScenarioRelevance";
import MsTestPlanApiScenarioList from "@/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList";
import MsApiScenarioModule from "@/business/components/api/automation/scenario/ApiScenarioModule";
import ApiCaseSimpleList from "@/business/components/api/definition/components/list/ApiCaseSimpleList";
import TestCaseApiRelevance from "@/business/components/track/plan/view/comonents/api/TestCaseApiRelevance";
import TestPlanApiCaseList from "@/business/components/track/plan/view/comonents/api/TestPlanApiCaseList";
import TestCaseRelevance from "@/business/components/track/plan/view/comonents/functional/TestCaseFunctionalRelevance";
import NodeTree from "@/business/components/track/common/NodeTree";
import MsApiModule from "../../../../api/definition/components/module/ApiModule"
export default {
name: "TestReviewApi",
components: {
TestReviewTestCaseList,
TestReviewRelevance, MsNodeTree, FunctionalTestCaseList, MsTestPlanCommonComponent
TestCaseScenarioRelevance,
MsTestPlanApiScenarioList,
MsApiScenarioModule,
ApiCaseSimpleList,
TestCaseApiRelevance,
TestPlanApiCaseList,
MsTestPlanCommonComponent,
TestCaseRelevance,
NodeTree,
MsApiModule,
},
data() {
return {
result: {},
testReviews: [],
currentReview: {},
selectNodeIds: [],
selectParentNodes: [],
treeNodes: [],
isMenuShow: true,
currentRow: "",
trashEnable: false,
currentProtocol: null,
currentModule: null,
selectNodeIds: [],
moduleOptions: {},
model: 'api'
}
},
props: [
@ -58,32 +119,66 @@ export default {
'clickType'
],
mounted() {
this.getNodeTreeByReviewId()
this.checkRedirectCharType();
},
activated() {
this.getNodeTreeByReviewId()
watch: {
model() {
this.selectNodeIds = [];
this.moduleOptions = {};
},
redirectCharType(){
if(this.redirectCharType=='scenario'){
this.model = 'scenario';
}else{
this.model = 'api';
}
}
},
methods: {
refresh() {
this.selectNodeIds = [];
this.selectParentNodes = [];
this.$refs.testReviewRelevance.search();
this.getNodeTreeByReviewId();
},
nodeChange(node, nodeIds, pNodes) {
this.selectNodeIds = nodeIds;
this.selectParentNodes = pNodes;
},
getNodeTreeByReviewId() {
if (this.reviewId) {
this.result = this.$get("/case/node/list/review/" + this.reviewId, response => {
this.treeNodes = response.data;
});
checkRedirectCharType(){
if(this.redirectCharType=='scenario'){
this.model = 'scenario';
}else{
this.model = 'api';
}
},
openTestReviewRelevanceDialog() {
this.$refs.testReviewRelevance.openTestReviewRelevanceDialog();
refresh() {
this.refreshTree();
this.refreshTable();
},
refreshTable() {
if (this.$refs.apiCaseList) {
this.$refs.apiCaseList.initTable();
}
if (this.$refs.apiScenarioList) {
this.$refs.apiScenarioList.search();
}
},
refreshTree() {
if (this.$refs.apiNodeTree) {
this.$refs.apiNodeTree.list();
}
if (this.$refs.scenarioNodeTree) {
this.$refs.scenarioNodeTree.list();
}
},
nodeChange(node, nodeIds, pNodes) {
this.selectNodeIds = nodeIds;
},
handleProtocolChange(protocol) {
this.currentProtocol = protocol;
},
setModuleOptions(data) {
this.moduleOptions = data;
},
openTestCaseRelevanceDialog(model) {
if (model === 'scenario') {
this.$refs.scenarioCaseRelevance.open();
} else {
this.$refs.apiCaseRelevance.open();
}
},
}
}

View File

@ -1,55 +1,52 @@
<template>
<ms-test-plan-common-component>
<template v-slot:aside>
<ms-node-tree
<node-tree
class="node-tree"
:all-label="$t('commons.all_label.review')"
v-loading="result.loading"
@nodeSelectEvent="nodeChange"
:tree-nodes="treeNodes"
ref="nodeTree"/>
</template>
<template v-slot:main>
<test-review-test-case-list
<test-plan-load-case-list
class="table-list"
@openTestReviewRelevanceDialog="openTestReviewRelevanceDialog"
@refresh="refresh"
:review-id="reviewId"
:select-node-ids="selectNodeIds"
:select-parent-nodes="selectParentNodes"
:clickType="clickType"
ref="testPlanTestCaseList"/>
:select-project-id="selectProjectId"
:select-parent-nodes="selectParentNodes"
@relevanceCase="openTestCaseRelevanceDialog"
ref="testPlanLoadCaseList"/>
</template>
<test-review-relevance
<test-case-load-relevance
@refresh="refresh"
:review-id="reviewId"
ref="testReviewRelevance"/>
ref="testCaseLoadRelevance"/>
</ms-test-plan-common-component>
</template>
<script>
import MsTestPlanCommonComponent from "@/business/components/track/plan/view/comonents/base/TestPlanCommonComponent";
import FunctionalTestCaseList from "@/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList";
import MsNodeTree from "@/business/components/track/common/NodeTree";
import TestReviewRelevance from "@/business/components/track/review/view/components/TestReviewRelevance";
import TestReviewTestCaseList from "@/business/components/track/review/view/components/TestReviewTestCaseList";
import NodeTree from "@/business/components/track/common/NodeTree";
import TestPlanLoadCaseList from "@/business/components/track/plan/view/comonents/load/TestPlanLoadCaseList";
import TestCaseLoadRelevance from "@/business/components/track/plan/view/comonents/load/TestCaseLoadRelevance";
export default {
name: "TestReviewLoad",
components: {
TestReviewTestCaseList,
TestReviewRelevance, MsNodeTree, FunctionalTestCaseList, MsTestPlanCommonComponent
MsTestPlanCommonComponent,
NodeTree,
TestPlanLoadCaseList,
TestCaseLoadRelevance,
},
data() {
return {
result: {},
testReviews: [],
currentReview: {},
selectNodeIds: [],
selectParentNodes: [],
selectProjectId: "",
treeNodes: [],
isMenuShow: true,
}
},
props: [
@ -57,34 +54,42 @@ export default {
'redirectCharType',
'clickType'
],
mounted() {
this.getNodeTreeByReviewId()
watch: {
planId() {
this.initData();
}
},
activated() {
this.getNodeTreeByReviewId()
mounted() {
this.initData();
},
methods: {
refresh() {
this.selectNodeIds = [];
this.selectProjectId = '';
this.selectParentNodes = [];
this.$refs.testReviewRelevance.search();
this.getNodeTreeByReviewId();
this.$refs.testPlanLoadCaseList.initTable();
this.getNodeTreeByPlanId();
},
initData() {
this.getNodeTreeByPlanId();
},
openTestCaseRelevanceDialog() {
this.$refs.testCaseLoadRelevance.open();
},
nodeChange(node, nodeIds, pNodes) {
this.selectNodeIds = nodeIds;
this.selectParentNodes = pNodes;
this.selectProjectId = node.key;
// node
this.$refs.testPlanLoadCaseList.currentPage = 1;
this.$refs.testPlanLoadCaseList.pageSize = 10;
},
getNodeTreeByReviewId() {
if (this.reviewId) {
this.result = this.$get("/case/node/list/review/" + this.reviewId, response => {
getNodeTreeByPlanId() {
if (this.planId) {
this.result = this.$get("/case/node/list/plan/" + this.planId, response => {
this.treeNodes = response.data;
//
this.treeNodes.map(node => node.children = null);
});
}
},
openTestReviewRelevanceDialog() {
this.$refs.testReviewRelevance.openTestReviewRelevanceDialog();
},
}
}
</script>

View File

@ -39,11 +39,14 @@
<el-divider direction="vertical"></el-divider>
<el-button type="success" size="mini"
:disabled="isReadOnly" :icon="testCase.reviewStatus === 'Pass' ? 'el-icon-check' : ''" @click="saveCase('Pass')">
:disabled="isReadOnly" :icon="testCase.reviewStatus === 'Pass' ? 'el-icon-check' : ''"
@click="saveCase('Pass')">
{{ $t('test_track.review.pass') }}
</el-button>
<el-button type="danger" size="mini"
:disabled="isReadOnly" :icon="testCase.reviewStatus === 'UnPass' ? 'el-icon-check' : ''" @click="saveCase('UnPass')">
:disabled="isReadOnly"
:icon="testCase.reviewStatus === 'UnPass' ? 'el-icon-check' : ''"
@click="saveCase('UnPass')">
{{ $t('test_track.review.un_pass') }}
</el-button>
</el-col>
@ -66,29 +69,22 @@
</el-col>
<el-col :span="5">
<span class="cast_label">{{ $t('test_track.case.case_type') }}</span>
<span class="cast_item" v-if="testCase.type === 'functional'">{{
$t('commons.functional')
}}</span>
<span class="cast_item" v-if="testCase.type === 'automation'">
场景用例
</span>
<span class="cast_item"
v-if="testCase.type === 'performance'">{{ $t('commons.performance') }}</span>
<span class="cast_item" v-if="testCase.type === 'api'">{{ $t('commons.api') }}</span>
<span class="cast_item" v-if="testCase.type === 'testcase'">接口用例</span>
</el-col>
</el-row>
<el-row>
<el-col :span="4" :offset="1">
<span class="cast_label">{{ $t('test_track.case.method') }}</span>
<span v-if="testCase.method === 'manual'">{{ $t('test_track.case.manual') }}</span>
<span v-if="testCase.method === 'auto'">{{ $t('test_track.case.auto') }}</span>
</el-col>
<el-col :span="5">
<el-col :offset="1">
<span class="cast_label">{{ $t('test_track.case.module') }}</span>
<span class="cast_item">{{ testCase.nodePath }}</span>
</el-col>
<el-col :span="4" :offset="1">
<span class="cast_label">{{ $t('test_track.plan.plan_project') }}</span>
<span class="cast_item">{{ testCase.projectName }}</span>
</el-col>
</el-row>
<el-row>
@ -98,7 +94,7 @@
</el-col>
</el-row>
<el-row v-if="testCase.method === 'auto' && testCase.testId">
<el-row>
<el-col class="test-detail" :span="20" :offset="1">
<el-tabs v-model="activeTab" type="border-card">
<el-tab-pane name="detail" :label="$t('test_track.plan_view.test_detail')">
@ -108,12 +104,17 @@
:is-read-only="true"
:id="testCase.testId"
ref="performanceTestDetail"/>
<api-case-item :type="mark" :api="api" :api-case="apiCase" v-if="testCase.type==='testcase'"
ref="apiCaseConfig"/>
<ms-edit-api-scenario :type="mark" v-if="testCase.type==='automation'" :currentScenario="currentScenario"
ref="autoScenarioConfig"></ms-edit-api-scenario>
</el-tab-pane>
</el-tabs>
</el-col>
</el-row>
<el-row v-if="testCase.method && testCase.method !== 'auto'">
<el-row v-if="testCase.type === 'function'">
<el-col :span="20" :offset="1">
<div>
<span class="cast_label">{{ $t('test_track.case.steps') }}</span>
@ -229,7 +230,8 @@
<i class="el-icon-refresh" @click="getComments(testCase)"
style="margin-left:10px;font-size: 14px; cursor: pointer"/>
</template>
<review-comment :comments="comments" :case-id="testCase.caseId" :review-id="testCase.reviewId" @getComments="getComments"/>
<review-comment :comments="comments" :case-id="testCase.caseId" :review-id="testCase.reviewId"
@getComments="getComments"/>
</el-card>
</el-col>
</div>
@ -248,9 +250,11 @@ import PerformanceTestDetail from "../../../plan/view/comonents/test/Performance
import ApiTestResult from "../../../plan/view/comonents/test/ApiTestResult";
import ApiTestDetail from "../../../plan/view/comonents/test/ApiTestDetail";
import TestPlanTestCaseStatusButton from "../../../plan/common/TestPlanTestCaseStatusButton";
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
import {getCurrentProjectID, listenGoBack, removeGoBackListener} from "@/common/js/utils";
import ReviewComment from "../../commom/ReviewComment";
import TestCaseAttachment from "@/business/components/track/case/components/TestCaseAttachment";
import ApiCaseItem from "@/business/components/api/definition/components/case/ApiCaseItem";
import MsEditApiScenario from "@/business/components/api/automation/scenario/EditApiScenario"
export default {
name: "TestReviewTestCaseEdit",
@ -261,7 +265,10 @@ export default {
ApiTestDetail,
TestPlanTestCaseStatusButton,
ReviewComment,
TestCaseAttachment
TestCaseAttachment,
ApiCaseItem,
MsEditApiScenario
},
data() {
return {
@ -277,7 +284,11 @@ export default {
users: [],
activeName: 'comment',
comments: [],
tableData: []
tableData: [],
currentScenario: {},
mark: 'detail',
api: {},
apiCase: {},
};
},
props: {
@ -378,16 +389,55 @@ export default {
listenGoBack(this.handleClose);
this.initData(testCase);
this.getComments(testCase);
this.getApiTestCase(testCase);
this.getCurrentScenario(testCase)
},
getApiTestCase(testCase) {
let param = {}
param.projectId = getCurrentProjectID();
param.id = testCase.testId;
this.result = this.$post("/api/testcase/list", param, response => {
let apiCaseList = []
this.apiCaseList = response.data;
this.apiCaseList.forEach(apiCase => {
if (apiCase.tags && apiCase.tags.length > 0) {
apiCase.tags = JSON.parse(apiCase.tags);
this.$set(apiCase, 'selected', false);
}
if (Object.prototype.toString.call(apiCase.request).match(/\[object (\w+)\]/)[1].toLowerCase() != 'object') {
apiCase.request = JSON.parse(apiCase.request);
}
if (!apiCase.request.hashTree) {
apiCase.request.hashTree = [];
}
this.apiCase = apiCase
this.handleTestCase(apiCase)
})
});
},
getCurrentScenario(testCase) {
this.result = this.$get("/api/automation/getApiScenario/" + testCase.testId, response => {
this.currentScenario=response.data
});
},
handleTestCase(testCase) {
this.$get('/api/definition/get/' + testCase.apiDefinitionId, (response) => {
this.api = response.data;
});
},
initTest() {
this.$nextTick(() => {
if (this.testCase.testId && this.testCase.testId !== 'other') {
if (this.testCase.method === 'auto') {
if (this.$refs.apiTestDetail && this.testCase.type === 'api') {
this.$refs.apiTestDetail.init();
} else if (this.testCase.type === 'performance') {
this.$refs.performanceTestDetail.init();
}
if (this.$refs.apiTestDetail && this.testCase.type === 'api') {
this.$refs.apiTestDetail.init();
} else if (this.testCase.type === 'performance') {
this.$refs.performanceTestDetail.init();
} else if (this.testCase.type === 'testcase') {
this.$refs.apiCaseConfig.active(this.api);
} else if (this.testCase.type === 'automation') {
this.$refs.autoScenarioConfig.showAll();
}
}
});

View File

@ -84,7 +84,7 @@
</template>
</el-table-column>
<el-table-column
<!-- <el-table-column
v-if="item.id=='method'"
prop="method"
:filters="methodFilters"
@ -95,7 +95,7 @@
<template v-slot:default="scope">
<method-table-item :value="scope.row.method"/>
</template>
</el-table-column>
</el-table-column>-->
<el-table-column
v-if="item.id=='nodePath'"