Merge remote-tracking branch 'origin/v1.8' into v1.8

# Conflicts:
#	frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue
This commit is contained in:
song.tianyang 2021-03-26 18:33:52 +08:00
commit ae3d1adf33
33 changed files with 296 additions and 97 deletions

View File

@ -7,12 +7,12 @@ import io.metersphere.api.dto.definition.*;
import io.metersphere.api.service.ApiTestCaseService; import io.metersphere.api.service.ApiTestCaseService;
import io.metersphere.base.domain.ApiTestCase; import io.metersphere.base.domain.ApiTestCase;
import io.metersphere.base.domain.ApiTestCaseWithBLOBs; import io.metersphere.base.domain.ApiTestCaseWithBLOBs;
import io.metersphere.commons.constants.ApiRunMode;
import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager; import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.SessionUtils; import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest; import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
import io.metersphere.track.service.TestPlanApiCaseService;
import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles; import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -29,7 +29,8 @@ public class ApiTestCaseController {
@Resource @Resource
private ApiTestCaseService apiTestCaseService; private ApiTestCaseService apiTestCaseService;
@Resource
private TestPlanApiCaseService testPlanApiCaseService;
@PostMapping("/list") @PostMapping("/list")
public List<ApiTestCaseResult> list(@RequestBody ApiTestCaseRequest request) { public List<ApiTestCaseResult> list(@RequestBody ApiTestCaseRequest request) {
request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId()); request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
@ -48,6 +49,12 @@ public class ApiTestCaseController {
return null; return null;
} }
} }
@GetMapping("/getStateByTestPlan/{id}")
public String getStateByTestPlan(@PathVariable String id ) {
String status=testPlanApiCaseService.getState(id);
return status;
}
@PostMapping("/list/{goPage}/{pageSize}") @PostMapping("/list/{goPage}/{pageSize}")
public Pager<List<ApiTestCaseDTO>> listSimple(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiTestCaseRequest request) { public Pager<List<ApiTestCaseDTO>> listSimple(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiTestCaseRequest request) {
@ -133,5 +140,6 @@ public class ApiTestCaseController {
@GetMapping(value = "/jenkins/exec/result/{id}") @GetMapping(value = "/jenkins/exec/result/{id}")
public String getExecResult(@PathVariable String id) { public String getExecResult(@PathVariable String id) {
return apiTestCaseService.getExecResult(id); return apiTestCaseService.getExecResult(id);
} }
} }

View File

@ -183,9 +183,16 @@ public class MsHTTPSamplerProxy extends MsTestElement {
if (!url.startsWith("http://") && !url.startsWith("https://")) { if (!url.startsWith("http://") && !url.startsWith("https://")) {
url = "http://" + url; url = "http://" + url;
} }
if (StringUtils.isNotEmpty(this.getPort()) && this.getPort().startsWith("${")) {
url.replaceAll(this.getPort(), "10990");
}
URL urlObject = new URL(url); URL urlObject = new URL(url);
sampler.setDomain(URLDecoder.decode(urlObject.getHost(), "UTF-8")); sampler.setDomain(URLDecoder.decode(urlObject.getHost(), "UTF-8"));
if (urlObject.getPort() > 0 && urlObject.getPort() != 10990 && StringUtils.isNotEmpty(this.getPort()) && this.getPort().startsWith("${")) {
sampler.setPort(urlObject.getPort()); sampler.setPort(urlObject.getPort());
} else {
sampler.setProperty("HTTPSampler.port", this.getPort());
}
sampler.setProtocol(urlObject.getProtocol()); sampler.setProtocol(urlObject.getProtocol());
String envPath = StringUtils.equals(urlObject.getPath(), "/") ? "" : urlObject.getPath(); String envPath = StringUtils.equals(urlObject.getPath(), "/") ? "" : urlObject.getPath();
sampler.setPath(envPath); sampler.setPath(envPath);

View File

@ -1,12 +1,10 @@
package io.metersphere.api.jmeter; package io.metersphere.api.jmeter;
import io.metersphere.api.dto.definition.ApiTestCaseInfo;
import io.metersphere.api.dto.scenario.request.RequestType; import io.metersphere.api.dto.scenario.request.RequestType;
import io.metersphere.api.service.*; import io.metersphere.api.service.*;
import io.metersphere.base.domain.ApiDefinitionExecResult; import io.metersphere.base.domain.ApiDefinitionExecResult;
import io.metersphere.base.domain.ApiScenarioReport; import io.metersphere.base.domain.ApiScenarioReport;
import io.metersphere.base.domain.ApiTestReport; import io.metersphere.base.domain.ApiTestReport;
import io.metersphere.base.domain.TestPlanReport;
import io.metersphere.commons.constants.*; import io.metersphere.commons.constants.*;
import io.metersphere.commons.utils.CommonBeanFactory; import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.LogUtil; import io.metersphere.commons.utils.LogUtil;
@ -16,7 +14,6 @@ import io.metersphere.notice.sender.NoticeModel;
import io.metersphere.notice.service.NoticeSendService; import io.metersphere.notice.service.NoticeSendService;
import io.metersphere.service.SystemParameterService; import io.metersphere.service.SystemParameterService;
import io.metersphere.track.service.TestPlanReportService; import io.metersphere.track.service.TestPlanReportService;
import io.metersphere.track.service.TestPlanService;
import io.metersphere.track.service.TestPlanTestCaseService; import io.metersphere.track.service.TestPlanTestCaseService;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -250,9 +247,12 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
} }
} }
if (StringUtils.equals(ReportTriggerMode.API.name(), report.getTriggerMode())||StringUtils.equals(ReportTriggerMode.SCHEDULE.name(), report.getTriggerMode())) {
sendTask(report, reportUrl, testResult); sendTask(report, reportUrl, testResult);
} }
}
private static void sendTask(ApiTestReport report, String reportUrl, TestResult testResult) { private static void sendTask(ApiTestReport report, String reportUrl, TestResult testResult) {
if (report == null) { if (report == null) {
return; return;

View File

@ -19,6 +19,7 @@ import io.metersphere.api.jmeter.JMeterService;
import io.metersphere.base.domain.*; import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.*; import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.*; import io.metersphere.base.mapper.ext.*;
import io.metersphere.commons.constants.ApiRunMode;
import io.metersphere.commons.constants.TestPlanStatus; import io.metersphere.commons.constants.TestPlanStatus;
import io.metersphere.commons.exception.MSException; import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.*; import io.metersphere.commons.utils.*;
@ -551,7 +552,14 @@ public class ApiTestCaseService {
} }
public String run(RunCaseRequest request) { public String run(RunCaseRequest request) {
ApiTestCaseWithBLOBs testCaseWithBLOBs = apiTestCaseMapper.selectByPrimaryKey(request.getCaseId()); ApiTestCaseWithBLOBs testCaseWithBLOBs=new ApiTestCaseWithBLOBs();
if(StringUtils.equals(request.getRunMode(), ApiRunMode.JENKINS_API_PLAN.name())){
testCaseWithBLOBs= apiTestCaseMapper.selectByPrimaryKey(request.getReportId());
request.setCaseId(request.getReportId());
}else{
testCaseWithBLOBs= apiTestCaseMapper.selectByPrimaryKey(request.getCaseId());
}
// 多态JSON普通转换会丢失内容需要通过 ObjectMapper 获取 // 多态JSON普通转换会丢失内容需要通过 ObjectMapper 获取
if (testCaseWithBLOBs != null && StringUtils.isNotEmpty(testCaseWithBLOBs.getRequest())) { if (testCaseWithBLOBs != null && StringUtils.isNotEmpty(testCaseWithBLOBs.getRequest())) {
try { try {

View File

@ -91,6 +91,9 @@
<if test="reportRequest.projectId != null"> <if test="reportRequest.projectId != null">
AND project.id = #{reportRequest.projectId,jdbcType=VARCHAR} AND project.id = #{reportRequest.projectId,jdbcType=VARCHAR}
</if> </if>
<if test="reportRequest.testId != null">
AND ltr.test_id = #{reportRequest.testId,jdbcType=VARCHAR}
</if>
<if test="reportRequest.filters != null and reportRequest.filters.size() > 0"> <if test="reportRequest.filters != null and reportRequest.filters.size() > 0">
<foreach collection="reportRequest.filters.entrySet()" index="key" item="values"> <foreach collection="reportRequest.filters.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0"> <if test="values != null and values.size() > 0">

View File

@ -12,6 +12,7 @@ import java.util.Map;
public class ReportRequest { public class ReportRequest {
private String name; private String name;
private String workspaceId; private String workspaceId;
private String testId;
private String userId; private String userId;
private List<OrderRequest> orders; private List<OrderRequest> orders;
private Map<String, List<String>> filters; private Map<String, List<String>> filters;

View File

@ -14,13 +14,11 @@ import io.metersphere.excel.domain.ExcelResponse;
import io.metersphere.service.CheckPermissionService; import io.metersphere.service.CheckPermissionService;
import io.metersphere.service.FileService; import io.metersphere.service.FileService;
import io.metersphere.track.dto.TestCaseDTO; import io.metersphere.track.dto.TestCaseDTO;
import io.metersphere.track.dto.TestPlanCaseDTO;
import io.metersphere.track.request.testcase.EditTestCaseRequest; import io.metersphere.track.request.testcase.EditTestCaseRequest;
import io.metersphere.track.request.testcase.QueryTestCaseRequest; import io.metersphere.track.request.testcase.QueryTestCaseRequest;
import io.metersphere.track.request.testcase.TestCaseBatchRequest; import io.metersphere.track.request.testcase.TestCaseBatchRequest;
import io.metersphere.track.request.testcase.TestCaseMinderEditRequest; import io.metersphere.track.request.testcase.TestCaseMinderEditRequest;
import io.metersphere.track.request.testplan.FileOperationRequest; import io.metersphere.track.request.testplan.FileOperationRequest;
import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest;
import io.metersphere.track.service.TestCaseService; import io.metersphere.track.service.TestCaseService;
import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles; import org.apache.shiro.authz.annotation.RequiresRoles;
@ -126,8 +124,8 @@ public class TestCaseController {
@PostMapping(value = "/edit", consumes = {"multipart/form-data"}) @PostMapping(value = "/edit", consumes = {"multipart/form-data"})
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR) @RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void editTestCase(@RequestPart("request") EditTestCaseRequest request, @RequestPart(value = "file") List<MultipartFile> files) { public String editTestCase(@RequestPart("request") EditTestCaseRequest request, @RequestPart(value = "file") List<MultipartFile> files) {
testCaseService.edit(request, files); return testCaseService.edit(request, files);
} }
@PostMapping("/delete/{testCaseId}") @PostMapping("/delete/{testCaseId}")

View File

@ -165,7 +165,7 @@ public class TestCaseService {
String steps = tc.getSteps(); String steps = tc.getSteps();
String remark = tc.getRemark(); String remark = tc.getRemark();
if (StringUtils.equals(steps, testCase.getSteps()) && StringUtils.equals(remark, caseRemark)) { if (StringUtils.equals(steps, testCase.getSteps()) && StringUtils.equals(remark, caseRemark)) {
MSException.throwException(Translator.get("test_case_already_exists")); //MSException.throwException(Translator.get("test_case_already_exists"));
isExt = true; isExt = true;
} }
} }

View File

@ -1,21 +1,13 @@
package io.metersphere.track.service; package io.metersphere.track.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import io.metersphere.api.dto.definition.ApiTestCaseDTO; import io.metersphere.api.dto.definition.ApiTestCaseDTO;
import io.metersphere.api.dto.definition.ApiTestCaseRequest; import io.metersphere.api.dto.definition.ApiTestCaseRequest;
import io.metersphere.api.dto.definition.RunDefinitionRequest;
import io.metersphere.api.dto.definition.TestPlanApiCaseDTO; import io.metersphere.api.dto.definition.TestPlanApiCaseDTO;
import io.metersphere.api.dto.definition.request.MsTestElement;
import io.metersphere.api.dto.definition.request.MsTestPlan;
import io.metersphere.api.dto.definition.request.MsThreadGroup;
import io.metersphere.api.service.ApiDefinitionExecResultService; import io.metersphere.api.service.ApiDefinitionExecResultService;
import io.metersphere.api.service.ApiDefinitionService; import io.metersphere.api.service.ApiDefinitionService;
import io.metersphere.api.service.ApiTestCaseService; import io.metersphere.api.service.ApiTestCaseService;
import io.metersphere.base.domain.ApiTestCaseExample;
import io.metersphere.base.domain.ApiTestCaseWithBLOBs;
import io.metersphere.base.domain.TestPlanApiCase; import io.metersphere.base.domain.TestPlanApiCase;
import io.metersphere.base.domain.TestPlanApiCaseExample; import io.metersphere.base.domain.TestPlanApiCaseExample;
import io.metersphere.base.mapper.TestPlanApiCaseMapper; import io.metersphere.base.mapper.TestPlanApiCaseMapper;
@ -25,15 +17,16 @@ import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.ServiceUtils; import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.SessionUtils; import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.track.request.testcase.TestPlanApiCaseBatchRequest; import io.metersphere.track.request.testcase.TestPlanApiCaseBatchRequest;
import org.apache.jmeter.testelement.TestElement;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*; import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@Service @Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -150,4 +143,11 @@ public class TestPlanApiCaseService {
}); });
} }
} }
public String getState(String id) {
TestPlanApiCaseExample example = new TestPlanApiCaseExample();
example.createCriteria().andApiCaseIdEqualTo(id);
return testPlanApiCaseMapper.selectByExample(example).get(0).getStatus();
}
} }

View File

@ -1,2 +0,0 @@
-- api_scenario_report modify column length
ALTER TABLE api_scenario_report MODIFY COLUMN name VARCHAR(300);

View File

@ -381,7 +381,6 @@
}, },
methods: { methods: {
customHeader() { customHeader() {
getLabel(this, API_SCENARIO_LIST);
this.$refs.headerCustom.open(this.tableLabel) this.$refs.headerCustom.open(this.tableLabel)
}, },
selectByParam() { selectByParam() {

View File

@ -267,11 +267,9 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.caseTable.bodyWrapper.scrollTop = 5 this.$refs.caseTable.bodyWrapper.scrollTop = 5
}) })
getLabel(this, API_CASE_LIST);
}, },
watch: { watch: {
selectNodeIds() { selectNodeIds() {
getLabel(this, API_CASE_LIST);
this.selectAll = false; this.selectAll = false;
this.unSelection = []; this.unSelection = [];
this.selectDataCounts = 0; this.selectDataCounts = 0;
@ -306,11 +304,9 @@ export default {
}, },
methods: { methods: {
customHeader() { customHeader() {
getLabel(this, API_CASE_LIST);
this.$refs.headerCustom.open(this.tableLabel) this.$refs.headerCustom.open(this.tableLabel)
}, },
initTable() { initTable() {
getLabel(this, API_CASE_LIST);
this.selectRows = new Set(); this.selectRows = new Set();
this.condition.status = ""; this.condition.status = "";
this.condition.moduleIds = this.selectNodeIds; this.condition.moduleIds = this.selectNodeIds;

View File

@ -383,7 +383,6 @@
this.getSystemLabel(this.type) this.getSystemLabel(this.type)
this.initTable(); this.initTable();
this.getMaintainerOptions(); this.getMaintainerOptions();
getLabel(this, API_LIST);
}, },
watch: { watch: {
selectNodeIds() { selectNodeIds() {
@ -416,7 +415,6 @@
}) })
}, },
customHeader() { customHeader() {
getLabel(this, API_LIST);
this.$refs.headerCustom.open(this.tableLabel) this.$refs.headerCustom.open(this.tableLabel)
}, },
handleBatchMove() { handleBatchMove() {

View File

@ -0,0 +1,40 @@
<template>
<ms-container>
<ms-main-container>
<el-card>
</el-card>
</ms-main-container>
</ms-container>
</template>
<script>
import MsContainer from "@/business/components/common/components/MsContainer";
import MsMainContainer from "@/business/components/common/components/MsMainContainer";
import {checkoutTestManagerOrTestUser} from "@/common/js/utils";
export default {
name: "PerformanceReportCompare",
components: {MsMainContainer, MsContainer},
mounted() {
let reportId = this.$route.path.split('/')[4];
console.log(reportId);
let items = localStorage.getItem("compareReportIds");
console.log(JSON.parse(items));
},
computed: {
isReadOnly() {
return !checkoutTestManagerOrTestUser();
}
},
data() {
return {}
},
methods: {}
}
</script>
<style scoped>
</style>

View File

@ -28,10 +28,6 @@
<el-button :disabled="isReadOnly" type="warning" plain size="mini" @click="downloadJtl()"> <el-button :disabled="isReadOnly" type="warning" plain size="mini" @click="downloadJtl()">
{{ $t('report.downloadJtl') }} {{ $t('report.downloadJtl') }}
</el-button> </el-button>
<!--<el-button :disabled="isReadOnly" type="warning" plain size="mini">-->
<!--{{$t('report.compare')}}-->
<!--</el-button>-->
</el-row> </el-row>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
@ -83,6 +79,7 @@
</div> </div>
</el-dialog> </el-dialog>
</ms-main-container> </ms-main-container>
<same-test-reports ref="compareReports"/>
</ms-container> </ms-container>
</template> </template>
@ -99,11 +96,13 @@ import {checkoutTestManagerOrTestUser, exportPdf} from "@/common/js/utils";
import html2canvas from 'html2canvas'; import html2canvas from 'html2canvas';
import MsPerformanceReportExport from "./PerformanceReportExport"; import MsPerformanceReportExport from "./PerformanceReportExport";
import {Message} from "element-ui"; import {Message} from "element-ui";
import SameTestReports from "@/business/components/performance/report/components/SameTestReports";
export default { export default {
name: "PerformanceReportView", name: "PerformanceReportView",
components: { components: {
SameTestReports,
MsPerformanceReportExport, MsPerformanceReportExport,
MsReportErrorLog, MsReportErrorLog,
MsReportLogDetails, MsReportLogDetails,
@ -312,6 +311,9 @@ export default {
Message.error({message: JSON.parse(data).message || e.message, showClose: true}); Message.error({message: JSON.parse(data).message || e.message, showClose: true});
}); });
}); });
},
compareReports() {
this.$refs.compareReports.open(this.report);
} }
}, },
created() { created() {

View File

@ -25,37 +25,32 @@
<el-table-column <el-table-column
prop="name" prop="name"
:label="$t('commons.name')" :label="$t('commons.name')"
width="150"
show-overflow-tooltip> show-overflow-tooltip>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="testName" prop="testName"
:label="$t('report.test_name')" :label="$t('report.test_name')"
width="150"
show-overflow-tooltip> show-overflow-tooltip>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="projectName" prop="projectName"
:label="$t('report.project_name')" :label="$t('report.project_name')"
width="150"
show-overflow-tooltip> show-overflow-tooltip>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="userName" prop="userName"
:label="$t('report.user_name')" :label="$t('report.user_name')"
width="150"
show-overflow-tooltip> show-overflow-tooltip>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="createTime" prop="createTime"
sortable sortable
width="250"
:label="$t('commons.create_time')"> :label="$t('commons.create_time')">
<template v-slot:default="scope"> <template v-slot:default="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span> <span>{{ scope.row.createTime | timestampFormatDate }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="triggerMode" width="150" :label="'触发方式'" column-key="triggerMode" <el-table-column prop="triggerMode" width="150" :label="$t('test_track.report.list.trigger_mode')" column-key="triggerMode"
:filters="triggerFilters"> :filters="triggerFilters">
<template v-slot:default="scope"> <template v-slot:default="scope">
<report-trigger-mode-item :trigger-mode="scope.row.triggerMode"/> <report-trigger-mode-item :trigger-mode="scope.row.triggerMode"/>
@ -85,6 +80,7 @@
:total="total"/> :total="total"/>
</el-card> </el-card>
</ms-main-container> </ms-main-container>
<same-test-reports ref="compareReports"/>
</ms-container> </ms-container>
</template> </template>
@ -101,11 +97,14 @@ import MsTableHeader from "../../common/components/MsTableHeader";
import {LIST_CHANGE, PerformanceEvent} from "@/business/components/common/head/ListEvent"; import {LIST_CHANGE, PerformanceEvent} from "@/business/components/common/head/ListEvent";
import ShowMoreBtn from "../../track/case/components/ShowMoreBtn"; import ShowMoreBtn from "../../track/case/components/ShowMoreBtn";
import {_filter, _sort} from "@/common/js/tableUtils"; import {_filter, _sort} from "@/common/js/tableUtils";
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
import SameTestReports from "@/business/components/performance/report/components/SameTestReports";
export default { export default {
name: "PerformanceTestReportList", name: "PerformanceTestReportList",
components: { components: {
SameTestReports,
MsDialogFooter,
MsTableHeader, MsTableHeader,
ReportTriggerModeItem, ReportTriggerModeItem,
MsTableOperatorButton, MsTableOperatorButton,
@ -200,6 +199,9 @@ export default {
} }
}); });
}, },
handleDiff(report) {
this.$refs.compareReports.open(report);
},
_handleDeleteNoMsg(report) { _handleDeleteNoMsg(report) {
this.result = this.$post(this.deletePath + report.id, {}, () => { this.result = this.$post(this.deletePath + report.id, {}, () => {
this.initTableData(); this.initTableData();

View File

@ -37,7 +37,7 @@
<el-table-column <el-table-column
prop="ko" prop="ko"
label="KO" label="FAIL"
align="center" align="center"
/> />

View File

@ -0,0 +1,117 @@
<template>
<el-dialog :close-on-click-modal="false"
:destroy-on-close="true"
:title="$t('已完成的测试报告')" width="60%"
:visible.sync="loadReportVisible">
<el-table v-loading="reportLoadingResult.loading"
class="basic-config"
:data="compareReports"
@select-all="handleSelectAll"
@select="handleSelectionChange">
<el-table-column type="selection"/>
<el-table-column
prop="name"
:label="$t('commons.name')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="userName"
:label="$t('report.user_name')"
show-overflow-tooltip>
</el-table-column>
<el-table-column prop="triggerMode"
:label="$t('test_track.report.list.trigger_mode')">
<template v-slot:default="scope">
<report-trigger-mode-item :trigger-mode="scope.row.triggerMode"/>
</template>
</el-table-column>
<el-table-column
:label="$t('commons.create_time')">
<template v-slot:default="scope">
<i class="el-icon-time"/>
<span class="last-modified">{{ scope.row.createTime | timestampFormatDate }}</span>
</template>
</el-table-column>
</el-table>
<ms-table-pagination :change="getCompareReports" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
<template v-slot:footer>
<ms-dialog-footer @cancel="close" @confirm="handleCompare"/>
</template>
</el-dialog>
</template>
<script>
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
import ReportTriggerModeItem from "@/business/components/common/tableItem/ReportTriggerModeItem";
export default {
name: "SameTestReports",
components: {ReportTriggerModeItem, MsDialogFooter, MsTablePagination},
data() {
return {
loadReportVisible: false,
reportLoadingResult: {},
compareReports: [],
currentPage: 1,
pageSize: 10,
total: 0,
selectIds: new Set,
}
},
methods: {
open(report) {
this.getCompareReports(report.testId);
this.loadReportVisible = true;
},
close() {
this.loadReportVisible = false;
},
getCompareReports(testId) {
let condition = {
testId: testId,
filters: {status: ["Completed"]}
};
this.reportLoadingResult = this.$post('/performance/report/list/all/' + this.currentPage + "/" + this.pageSize, condition, res => {
let data = res.data;
this.total = data.itemCount;
this.compareReports = data.listObject;
})
},
handleCompare() {
let reportIds = [...this.selectIds];
localStorage.setItem("compareReportIds", JSON.stringify(reportIds));
this.close();
this.$router.push({path: '/performance/report/compare/' + reportIds[0]});
},
handleSelectAll(selection) {
if (selection.length > 0) {
this.compareReports.forEach(item => {
this.selectIds.add(item.id);
});
} else {
this.compareReports.forEach(item => {
if (this.selectIds.has(item.id)) {
this.selectIds.delete(item.id);
}
});
}
},
handleSelectionChange(selection, row) {
if (this.selectIds.has(row.id)) {
this.selectIds.delete(row.id);
} else {
this.selectIds.add(row.id);
}
},
}
}
</script>
<style scoped>
</style>

View File

@ -1,5 +1,3 @@
import MsProject from "@/business/components/settings/project/MsProject";
const PerformanceTest = () => import('@/business/components/performance/PerformanceTest') const PerformanceTest = () => import('@/business/components/performance/PerformanceTest')
const PerformanceTestHome = () => import('@/business/components/performance/home/PerformanceTestHome') const PerformanceTestHome = () => import('@/business/components/performance/home/PerformanceTestHome')
const EditPerformanceTest = () => import('@/business/components/performance/test/EditPerformanceTest') const EditPerformanceTest = () => import('@/business/components/performance/test/EditPerformanceTest')
@ -7,6 +5,7 @@ const PerformanceTestList = () => import('@/business/components/performance/test
const PerformanceTestReportList = () => import('@/business/components/performance/report/PerformanceTestReportList') const PerformanceTestReportList = () => import('@/business/components/performance/report/PerformanceTestReportList')
const PerformanceChart = () => import('@/business/components/performance/report/components/PerformanceChart') const PerformanceChart = () => import('@/business/components/performance/report/components/PerformanceChart')
const PerformanceReportView = () => import('@/business/components/performance/report/PerformanceReportView') const PerformanceReportView = () => import('@/business/components/performance/report/PerformanceReportView')
const PerformanceReportCompare = () => import('@/business/components/performance/report/PerformanceReportCompare')
export default { export default {
path: "/performance", path: "/performance",
@ -62,6 +61,11 @@ export default {
path: "report/view/:reportId", path: "report/view/:reportId",
name: "perReportView", name: "perReportView",
component: PerformanceReportView component: PerformanceReportView
} },
{
path: "report/compare/:reportId",
name: "ReportCompare",
component: PerformanceReportCompare,
},
] ]
} }

View File

@ -285,6 +285,7 @@ export default {
} }
}, },
nodeChange(node, nodeIds, pNodes) { nodeChange(node, nodeIds, pNodes) {
this.activeName = "default";
this.selectNodeIds = nodeIds; this.selectNodeIds = nodeIds;
this.selectNode = node; this.selectNode = node;
this.selectParentNodes = pNodes; this.selectParentNodes = pNodes;
@ -323,11 +324,23 @@ export default {
showTestCaseDetail(testCase) { showTestCaseDetail(testCase) {
this.testCaseReadOnly = true; this.testCaseReadOnly = true;
}, },
refresh() { refresh(data) {
this.selectNodeIds = []; this.selectNodeIds = [];
this.selectParentNodes = []; this.selectParentNodes = [];
this.selectNode = {}; this.selectNode = {};
this.refreshTable(); this.refreshTable();
this.setTable(data);
},
setTable(data) {
console.log(data)
for (let index in this.tabs) {
let tab = this.tabs[index];
if (tab.name === this.activeName) {
tab.label = data.name;
break;
}
}
}, },
refreshAll() { refreshAll() {
this.$refs.nodeTree.list(); this.$refs.nodeTree.list();

View File

@ -380,6 +380,7 @@ export default {
testCases: [], testCases: [],
index: 0, index: 0,
showInputTag: true, showInputTag: true,
tableType:"",
}; };
}, },
props: { props: {
@ -631,8 +632,11 @@ export default {
}) })
}, },
async setFormData(testCase) { async setFormData(testCase) {
//testCase.tags = JSON.parse(testCase.tags); try {
testCase.selected = JSON.parse(testCase.testId); testCase.selected = JSON.parse(testCase.testId);
} catch (error) {
testCase.selected = testCase.testId
}
let tmp = {}; let tmp = {};
Object.assign(tmp, testCase); Object.assign(tmp, testCase);
tmp.steps = JSON.parse(testCase.steps); tmp.steps = JSON.parse(testCase.steps);
@ -643,9 +647,8 @@ export default {
Object.assign(this.form, tmp); Object.assign(this.form, tmp);
this.form.module = testCase.nodeId; this.form.module = testCase.nodeId;
this.getFileMetaData(testCase); this.getFileMetaData(testCase);
/* testCase.selected = JSON.parse(testCase.testId);
this.form.selected= testCase.selected*/
await this.loadOptions(this.sysList) await this.loadOptions(this.sysList)
}, },
setTestCaseExtInfo(testCase) { setTestCaseExtInfo(testCase) {
this.testCase = {}; this.testCase = {};
@ -710,11 +713,6 @@ export default {
this.dialogFormVisible = false; this.dialogFormVisible = false;
}, },
saveCase() { saveCase() {
/*
document.getElementById("inputDelay").focus();
*/
// input
this.$refs['caseFrom'].validate((valid) => { this.$refs['caseFrom'].validate((valid) => {
if (valid) { if (valid) {
let param = this.buildParam(); let param = this.buildParam();
@ -722,7 +720,10 @@ export default {
let option = this.getOption(param); let option = this.getOption(param);
this.result = this.$request(option, (response) => { this.result = this.$request(option, (response) => {
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
if (this.operationType == 'add' && this.isCreateContinue) { this.operationType="edit"
this.form.id=response.id;
this.$emit("refreshTestCase",)
/*if (this.operationType == 'add' && this.isCreateContinue) {
this.form.name = ''; this.form.name = '';
this.form.prerequisite = ''; this.form.prerequisite = '';
this.form.steps = [{ this.form.steps = [{
@ -736,9 +737,11 @@ export default {
this.tableData = []; this.tableData = [];
this.$emit("refresh"); this.$emit("refresh");
return; return;
} }*/
this.dialogFormVisible = false; this.tableType='edit';
this.$emit("refresh"); this.$emit("refresh",this.form);
console.log(response.data)
this.form.id=response.data
if (this.type === 'add' || this.type === 'copy') { if (this.type === 'add' || this.type === 'copy') {
param.id = response.data; param.id = response.data;
this.$emit("caseCreate", param); this.$emit("caseCreate", param);
@ -777,11 +780,15 @@ export default {
return param; return param;
}, },
getOption(param) { getOption(param) {
let formData = new FormData(); let type={}
let type = this.type if(this.tableType==='edit'){
if (this.type === 'copy') { type='edit'
}else if(this.type === 'copy'){
type = 'add' type = 'add'
}else{
type=this.type
} }
let formData = new FormData();
let url = '/test/case/' + type; let url = '/test/case/' + type;
this.uploadList.forEach(f => { this.uploadList.forEach(f => {
formData.append("file", f); formData.append("file", f);

View File

@ -305,7 +305,7 @@ export default {
this.$emit('setCondition', this.condition); this.$emit('setCondition', this.condition);
this.condition.filters = {reviewStatus: ["Prepare", "Pass", "UnPass"]}; this.condition.filters = {reviewStatus: ["Prepare", "Pass", "UnPass"]};
this.initTableData(); this.initTableData();
getSystemLabel(this, this.type)
}, },
activated() { activated() {
this.condition.filters = {reviewStatus: ["Prepare", "Pass", "UnPass"]}; this.condition.filters = {reviewStatus: ["Prepare", "Pass", "UnPass"]};
@ -323,7 +323,6 @@ export default {
}, },
methods: { methods: {
customHeader() { customHeader() {
getLabel(this, TEST_CASE_LIST);
this.$refs.headerCustom.open(this.tableLabel) this.$refs.headerCustom.open(this.tableLabel)
}, },
getSelectDataRange() { getSelectDataRange() {
@ -346,6 +345,7 @@ export default {
this.condition.nodeIds = this.selectNodeIds; this.condition.nodeIds = this.selectNodeIds;
} }
getLabel(this, TEST_CASE_LIST); getLabel(this, TEST_CASE_LIST);
this.getData(); this.getData();
}, },
getData() { getData() {

View File

@ -295,7 +295,6 @@ export default {
}, },
methods: { methods: {
inite() { inite() {
getLabel(this, TEST_PLAN_LIST);
this.initTableData() this.initTableData()
}, },
calPassRate(scope) { calPassRate(scope) {
@ -303,7 +302,6 @@ export default {
return Number.parseInt(passRate, 10); return Number.parseInt(passRate, 10);
}, },
customHeader() { customHeader() {
getLabel(this, TEST_PLAN_LIST);
this.$refs.headerCustom.open(this.tableLabel) this.$refs.headerCustom.open(this.tableLabel)
}, },
initTableData() { initTableData() {

View File

@ -304,8 +304,6 @@ export default {
}, },
methods: { methods: {
customHeader() { customHeader() {
getLabel(this, TEST_PLAN_API_CASE);
this.$refs.headerCustom.open(this.tableLabel) this.$refs.headerCustom.open(this.tableLabel)
}, },
getMaintainerOptions() { getMaintainerOptions() {

View File

@ -201,8 +201,6 @@ export default {
}, },
methods: { methods: {
customHeader() { customHeader() {
getLabel(this, TEST_PLAN_SCENARIO_CASE);
this.$refs.headerCustom.open(this.tableLabel) this.$refs.headerCustom.open(this.tableLabel)
}, },
search() { search() {

View File

@ -429,7 +429,6 @@ export default {
}, },
methods: { methods: {
customHeader() { customHeader() {
getLabel(this, TEST_PLAN_FUNCTION_TEST_CASE);
this.$refs.headerCustom.open(this.tableLabel) this.$refs.headerCustom.open(this.tableLabel)
}, },

View File

@ -211,7 +211,6 @@ export default {
}, },
methods: { methods: {
customHeader() { customHeader() {
getLabel(this, TEST_PLAN_LOAD_CASE);
this.$refs.headerCustom.open(this.tableLabel) this.$refs.headerCustom.open(this.tableLabel)
}, },
initTable() { initTable() {

View File

@ -183,7 +183,6 @@ export default {
}, },
methods: { methods: {
customHeader() { customHeader() {
getLabel(this, TEST_CASE_REVIEW_LIST);
this.$refs.headerCustom.open(this.tableLabel) this.$refs.headerCustom.open(this.tableLabel)
}, },

View File

@ -301,7 +301,6 @@ export default {
}, },
methods: { methods: {
customHeader() { customHeader() {
getLabel(this, TEST_CASE_REVIEW_CASE_LIST);
this.$refs.headerCustom.open(this.tableLabel) this.$refs.headerCustom.open(this.tableLabel)
}, },
initTableData() { initTableData() {

View File

@ -115,10 +115,7 @@ export function getLabel(vueObj, type) {
vueObj.result = vueObj.$post('/system/header/info', param, response => { vueObj.result = vueObj.$post('/system/header/info', param, response => {
if (response.data != null) { if (response.data != null) {
vueObj.tableLabel = eval(response.data.props); vueObj.tableLabel = eval(response.data.props);
} }else{
})
}
export function getSystemLabel(vueObj, type) {
let param = {} let param = {}
param.type=type param.type=type
vueObj.result = vueObj.$post('/system/system/header',param, response => { vueObj.result = vueObj.$post('/system/system/header',param, response => {
@ -127,6 +124,8 @@ export function getSystemLabel(vueObj, type) {
} }
}) })
} }
})
}
export function buildBatchParam(vueObj) { export function buildBatchParam(vueObj) {

View File

@ -280,7 +280,7 @@ export default {
none: 'None Organization', none: 'None Organization',
select: 'Select Organization', select: 'Select Organization',
service_integration: 'Service integration', service_integration: 'Service integration',
defect_manage: 'Defect management platform', defect_manage: 'Project management platform',
message_settings: 'Message settings', message_settings: 'Message settings',
message: { message: {
jenkins_task_notification: 'Jenkins task notification', jenkins_task_notification: 'Jenkins task notification',
@ -541,7 +541,10 @@ export default {
threadgroup_at_least_one: 'At least one ThreadGroup is enabled', threadgroup_at_least_one: 'At least one ThreadGroup is enabled',
load_api_automation_jmx: 'Import API automation scenario', load_api_automation_jmx: 'Import API automation scenario',
project_file_exist: "The file already exists in the project, please import it directly", project_file_exist: "The file already exists in the project, please import it directly",
project_file_update_type_error: 'Updated file types must be consistent' project_file_update_type_error: 'Updated file types must be consistent',
report: {
diff: "Compare"
},
}, },
api_test: { api_test: {
creator: "Creator", creator: "Creator",

View File

@ -281,7 +281,7 @@ export default {
select: '选择组织', select: '选择组织',
delete_warning: '删除该组织将同步删除该组织下所有相关工作空间和相关工作空间下的所有项目,以及项目中的所有用例、接口测试、性能测试等,确定要删除吗?', delete_warning: '删除该组织将同步删除该组织下所有相关工作空间和相关工作空间下的所有项目,以及项目中的所有用例、接口测试、性能测试等,确定要删除吗?',
service_integration: '服务集成', service_integration: '服务集成',
defect_manage: '缺陷管理平台', defect_manage: '项目管理平台',
message_settings: '消息设置', message_settings: '消息设置',
message: { message: {
jenkins_task_notification: 'Jenkins接口调用任务通知', jenkins_task_notification: 'Jenkins接口调用任务通知',
@ -438,7 +438,7 @@ export default {
export: '导出', export: '导出',
export_to_ms_format: '导出 MeterSphere 格式', export_to_ms_format: '导出 MeterSphere 格式',
export_to_swagger3_format: '导出 Swagger3.0 格式', export_to_swagger3_format: '导出 Swagger3.0 格式',
compare: '', compare: '报告对比',
generation_error: '报告生成错误, 无法查看, 请检查日志详情!', generation_error: '报告生成错误, 无法查看, 请检查日志详情!',
being_generated: '报告正在生成中...', being_generated: '报告正在生成中...',
delete_confirm: '确认删除报告: ', delete_confirm: '确认删除报告: ',
@ -540,7 +540,10 @@ export default {
threadgroup_at_least_one: '至少启用一个线程组', threadgroup_at_least_one: '至少启用一个线程组',
load_api_automation_jmx: '引用接口自动化场景', load_api_automation_jmx: '引用接口自动化场景',
project_file_exist: "项目中已存在该文件,请直接引用", project_file_exist: "项目中已存在该文件,请直接引用",
project_file_update_type_error: '更新的文件类型必须一致' report: {
diff: "对比"
},
project_file_update_type_error: '更新的文件类型必须一致',
}, },
api_test: { api_test: {
creator: "创建人", creator: "创建人",
@ -1193,7 +1196,7 @@ export default {
batch_delete_case: '批量删除', batch_delete_case: '批量删除',
batch_unlink: '批量取消关联', batch_unlink: '批量取消关联',
project_name: '所属项目', project_name: '所属项目',
status: '评审状态', status: '评审结果',
status_prepare: '未评审', status_prepare: '未评审',
status_pass: '通过', status_pass: '通过',
status_un_pass: '未通过', status_un_pass: '未通过',

View File

@ -281,7 +281,7 @@ export default {
select: '選擇組織', select: '選擇組織',
delete_warning: '刪除該組織將同步刪除該組織下所有相關工作空間和相關工作空間下的所有項目,以及項目中的所有用例、接口測試、性能測試等,確定要刪除嗎?', delete_warning: '刪除該組織將同步刪除該組織下所有相關工作空間和相關工作空間下的所有項目,以及項目中的所有用例、接口測試、性能測試等,確定要刪除嗎?',
service_integration: '服務集成', service_integration: '服務集成',
defect_manage: '缺陷管理平臺', defect_manage: '項目管理平臺',
message_settings: '消息設置', message_settings: '消息設置',
message: { message: {
jenkins_task_notification: 'Jenkins接口調用任務通知', jenkins_task_notification: 'Jenkins接口調用任務通知',
@ -438,7 +438,7 @@ export default {
export: '導出', export: '導出',
export_to_ms_format: '導出 MeterSphere 格式', export_to_ms_format: '導出 MeterSphere 格式',
export_to_swagger3_format: '導出 Swagger3.0 格式', export_to_swagger3_format: '導出 Swagger3.0 格式',
compare: '比較', compare: '報告比較',
generation_error: '報告生成錯誤, 無法查看, 請檢查日誌詳情!', generation_error: '報告生成錯誤, 無法查看, 請檢查日誌詳情!',
being_generated: '報告正在生成中...', being_generated: '報告正在生成中...',
delete_confirm: '確認刪除報告: ', delete_confirm: '確認刪除報告: ',
@ -540,7 +540,10 @@ export default {
threadgroup_at_least_one: '至少啟用一個線程組', threadgroup_at_least_one: '至少啟用一個線程組',
load_api_automation_jmx: '引用接口自動化場景', load_api_automation_jmx: '引用接口自動化場景',
project_file_exist: "項目中已存在該文件,請直接引用", project_file_exist: "項目中已存在該文件,請直接引用",
project_file_update_type_error: '更新的文件類型必須一致' project_file_update_type_error: '更新的文件類型必須一致',
report: {
diff: "對比"
},
}, },
api_test: { api_test: {
creator: "創建人", creator: "創建人",