Merge remote-tracking branch 'origin/v1.6' into v1.6
This commit is contained in:
commit
f11e0af0bf
|
@ -11,4 +11,24 @@ public class DeleteAPIReportRequest {
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
private List<String> ids;
|
private List<String> ids;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* isSelectAllDate:选择的数据是否是全部数据(全部数据是不受分页影响的数据)
|
||||||
|
* filters: 数据状态
|
||||||
|
* name:如果是全部数据,那么表格如果历经查询,查询参数是什么
|
||||||
|
* moduleIds: 哪些模块的数据
|
||||||
|
* unSelectIds:是否在页面上有未勾选的数据,有的话他们的ID是哪些。
|
||||||
|
* filters/name/moduleIds/unSeelctIds 只在isSelectAllDate为true时需要。为了让程序能明确批量的范围。
|
||||||
|
*/
|
||||||
|
private boolean isSelectAllDate;
|
||||||
|
|
||||||
|
private List<String> filters;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String projectId;
|
||||||
|
|
||||||
|
private List<String> moduleIds;
|
||||||
|
|
||||||
|
private List<String> unSelectIds;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,4 +28,23 @@ public class RunScenarioRequest {
|
||||||
private String reportUserID;
|
private String reportUserID;
|
||||||
|
|
||||||
private List<String> scenarioIds;
|
private List<String> scenarioIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* isSelectAllDate:选择的数据是否是全部数据(全部数据是不受分页影响的数据)
|
||||||
|
* filters: 数据状态
|
||||||
|
* name:如果是全部数据,那么表格如果历经查询,查询参数是什么
|
||||||
|
* moduleIds: 哪些模块的数据
|
||||||
|
* unSelectIds:是否在页面上有未勾选的数据,有的话他们的ID是哪些。
|
||||||
|
* filters/name/moduleIds/unSeelctIds 只在isSelectAllDate为true时需要。为了让程序能明确批量的范围。
|
||||||
|
*/
|
||||||
|
private boolean isSelectAllDate;
|
||||||
|
|
||||||
|
private List<String> filters;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private List<String> moduleIds;
|
||||||
|
|
||||||
|
private List<String> unSelectIds;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,4 +11,26 @@ public class SaveApiPlanRequest {
|
||||||
private List<String> planIds;
|
private List<String> planIds;
|
||||||
private List<String> apiIds;
|
private List<String> apiIds;
|
||||||
private List<String> scenarioIds;
|
private List<String> scenarioIds;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* isSelectAllDate:选择的数据是否是全部数据(全部数据是不受分页影响的数据)
|
||||||
|
* filters: 数据状态
|
||||||
|
* name:如果是全部数据,那么表格如果历经查询,查询参数是什么
|
||||||
|
* moduleIds: 哪些模块的数据
|
||||||
|
* unSelectIds:是否在页面上有未勾选的数据,有的话他们的ID是哪些。
|
||||||
|
* filters/name/moduleIds/unSeelctIds 只在isSelectAllDate为true时需要。为了让程序能明确批量的范围。
|
||||||
|
*/
|
||||||
|
private boolean isSelectAllDate;
|
||||||
|
|
||||||
|
private List<String> filters;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private List<String> moduleIds;
|
||||||
|
|
||||||
|
private List<String> unSelectIds;
|
||||||
|
|
||||||
|
private String projectId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@ import io.metersphere.base.mapper.ext.ExtTestPlanScenarioCaseMapper;
|
||||||
import io.metersphere.commons.constants.*;
|
import io.metersphere.commons.constants.*;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.utils.DateUtils;
|
import io.metersphere.commons.utils.DateUtils;
|
||||||
import io.metersphere.commons.utils.LogUtil;
|
|
||||||
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.i18n.Translator;
|
import io.metersphere.i18n.Translator;
|
||||||
|
@ -303,13 +302,23 @@ public class ApiAutomationService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String run(RunScenarioRequest request) {
|
public String run(RunScenarioRequest request) {
|
||||||
List<ApiScenarioWithBLOBs> apiScenarios = extApiScenarioMapper.selectIds(request.getScenarioIds());
|
List<ApiScenarioWithBLOBs> apiScenarios = null;
|
||||||
|
List<String> ids = request.getScenarioIds();
|
||||||
|
if (request.isSelectAllDate()) {
|
||||||
|
ids = this.getAllScenarioIdsByFontedSelect(
|
||||||
|
request.getModuleIds(), request.getName(), request.getProjectId(), request.getFilters(), request.getUnSelectIds());
|
||||||
|
}
|
||||||
|
apiScenarios = extApiScenarioMapper.selectIds(ids);
|
||||||
MsTestPlan testPlan = new MsTestPlan();
|
MsTestPlan testPlan = new MsTestPlan();
|
||||||
testPlan.setHashTree(new LinkedList<>());
|
testPlan.setHashTree(new LinkedList<>());
|
||||||
HashTree jmeterHashTree = new ListedHashTree();
|
HashTree jmeterHashTree = new ListedHashTree();
|
||||||
try {
|
try {
|
||||||
boolean isFirst = true;
|
boolean isFirst = true;
|
||||||
for (ApiScenarioWithBLOBs item : apiScenarios) {
|
for (ApiScenarioWithBLOBs item : apiScenarios) {
|
||||||
|
if (item.getStepTotal() == 0) {
|
||||||
|
MSException.throwException(item.getName() + "," + Translator.get("automation_exec_info"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
MsThreadGroup group = new MsThreadGroup();
|
MsThreadGroup group = new MsThreadGroup();
|
||||||
group.setLabel(item.getName());
|
group.setLabel(item.getName());
|
||||||
group.setName(UUID.randomUUID().toString());
|
group.setName(UUID.randomUUID().toString());
|
||||||
|
@ -347,7 +356,7 @@ public class ApiAutomationService {
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
LogUtil.error(ex.getMessage());
|
MSException.throwException(ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
testPlan.toHashTree(jmeterHashTree, testPlan.getHashTree(), new ParameterConfig());
|
testPlan.toHashTree(jmeterHashTree, testPlan.getHashTree(), new ParameterConfig());
|
||||||
|
@ -360,6 +369,27 @@ public class ApiAutomationService {
|
||||||
return request.getId();
|
return request.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取前台查询条件查询的所有(未经分页筛选)数据ID
|
||||||
|
*
|
||||||
|
* @param moduleIds 模块ID_前台查询时所选择的
|
||||||
|
* @param name 搜索条件_名称_前台查询时所输入的
|
||||||
|
* @param projectId 所属项目_前台查询时所在项目
|
||||||
|
* @param filters 过滤集合__前台查询时的过滤条件
|
||||||
|
* @param unSelectIds 未勾选ID_前台没有勾选的ID
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private List<String> getAllScenarioIdsByFontedSelect(List<String> moduleIds, String name, String projectId, List<String> filters, List<String> unSelectIds) {
|
||||||
|
ApiScenarioRequest selectRequest = new ApiScenarioRequest();
|
||||||
|
selectRequest.setModuleIds(moduleIds);
|
||||||
|
selectRequest.setName(name);
|
||||||
|
selectRequest.setProjectId(projectId);
|
||||||
|
selectRequest.setFilters(filters);
|
||||||
|
List<ApiScenarioDTO> list = extApiScenarioMapper.list(selectRequest);
|
||||||
|
List<String> allIds = list.stream().map(ApiScenarioDTO::getId).collect(Collectors.toList());
|
||||||
|
List<String> ids = allIds.stream().filter(id -> !unSelectIds.contains(id)).collect(Collectors.toList());
|
||||||
|
return ids;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 场景测试执行
|
* 场景测试执行
|
||||||
|
@ -401,6 +431,11 @@ public class ApiAutomationService {
|
||||||
if (CollectionUtils.isEmpty(request.getPlanIds())) {
|
if (CollectionUtils.isEmpty(request.getPlanIds())) {
|
||||||
MSException.throwException(Translator.get("plan id is null "));
|
MSException.throwException(Translator.get("plan id is null "));
|
||||||
}
|
}
|
||||||
|
List<String> scenarioIds = request.getScenarioIds();
|
||||||
|
if (request.isSelectAllDate()) {
|
||||||
|
scenarioIds = this.getAllScenarioIdsByFontedSelect(
|
||||||
|
request.getModuleIds(), request.getName(), request.getProjectId(), request.getFilters(), request.getUnSelectIds());
|
||||||
|
}
|
||||||
List<TestPlanDTO> list = extTestPlanMapper.selectByIds(request.getPlanIds());
|
List<TestPlanDTO> list = extTestPlanMapper.selectByIds(request.getPlanIds());
|
||||||
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||||
ExtTestPlanMapper mapper = sqlSession.getMapper(ExtTestPlanMapper.class);
|
ExtTestPlanMapper mapper = sqlSession.getMapper(ExtTestPlanMapper.class);
|
||||||
|
@ -408,8 +443,8 @@ public class ApiAutomationService {
|
||||||
ExtTestPlanApiCaseMapper apiCaseBatchMapper = sqlSession.getMapper(ExtTestPlanApiCaseMapper.class);
|
ExtTestPlanApiCaseMapper apiCaseBatchMapper = sqlSession.getMapper(ExtTestPlanApiCaseMapper.class);
|
||||||
|
|
||||||
for (TestPlanDTO testPlan : list) {
|
for (TestPlanDTO testPlan : list) {
|
||||||
if (request.getScenarioIds() != null) {
|
if (scenarioIds != null) {
|
||||||
for (String scenarioId : request.getScenarioIds()) {
|
for (String scenarioId : scenarioIds) {
|
||||||
TestPlanApiScenario testPlanApiScenario = new TestPlanApiScenario();
|
TestPlanApiScenario testPlanApiScenario = new TestPlanApiScenario();
|
||||||
testPlanApiScenario.setId(UUID.randomUUID().toString());
|
testPlanApiScenario.setId(UUID.randomUUID().toString());
|
||||||
testPlanApiScenario.setApiScenarioId(scenarioId);
|
testPlanApiScenario.setApiScenarioId(scenarioId);
|
||||||
|
|
|
@ -3,9 +3,7 @@ package io.metersphere.api.service;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import io.metersphere.api.dto.DeleteAPIReportRequest;
|
import io.metersphere.api.dto.DeleteAPIReportRequest;
|
||||||
import io.metersphere.api.dto.QueryAPIReportRequest;
|
import io.metersphere.api.dto.QueryAPIReportRequest;
|
||||||
import io.metersphere.api.dto.automation.APIScenarioReportResult;
|
import io.metersphere.api.dto.automation.*;
|
||||||
import io.metersphere.api.dto.automation.ExecuteType;
|
|
||||||
import io.metersphere.api.dto.automation.ScenarioStatus;
|
|
||||||
import io.metersphere.api.dto.datacount.ApiDataCountResult;
|
import io.metersphere.api.dto.datacount.ApiDataCountResult;
|
||||||
import io.metersphere.api.jmeter.ScenarioResult;
|
import io.metersphere.api.jmeter.ScenarioResult;
|
||||||
import io.metersphere.api.jmeter.TestResult;
|
import io.metersphere.api.jmeter.TestResult;
|
||||||
|
@ -19,6 +17,7 @@ import io.metersphere.commons.constants.ApiRunMode;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.utils.DateUtils;
|
import io.metersphere.commons.utils.DateUtils;
|
||||||
import io.metersphere.commons.utils.ServiceUtils;
|
import io.metersphere.commons.utils.ServiceUtils;
|
||||||
|
import io.metersphere.commons.utils.SessionUtils;
|
||||||
import io.metersphere.i18n.Translator;
|
import io.metersphere.i18n.Translator;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -31,6 +30,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@ -208,12 +208,23 @@ public class ApiScenarioReportService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteAPIReportBatch(DeleteAPIReportRequest reportRequest) {
|
public void deleteAPIReportBatch(DeleteAPIReportRequest reportRequest) {
|
||||||
|
List<String> ids = reportRequest.getIds();
|
||||||
|
if (reportRequest.isSelectAllDate()) {
|
||||||
|
QueryAPIReportRequest selectRequest = new QueryAPIReportRequest();
|
||||||
|
selectRequest.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
|
||||||
|
selectRequest.setName(reportRequest.getName());
|
||||||
|
selectRequest.setProjectId(reportRequest.getProjectId());
|
||||||
|
List<APIScenarioReportResult> list = extApiScenarioReportMapper.list(selectRequest);
|
||||||
|
List<String> allIds = list.stream().map(APIScenarioReportResult::getId).collect(Collectors.toList());
|
||||||
|
ids = allIds.stream().filter(id -> !reportRequest.getUnSelectIds().contains(id)).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
ApiScenarioReportDetailExample detailExample = new ApiScenarioReportDetailExample();
|
ApiScenarioReportDetailExample detailExample = new ApiScenarioReportDetailExample();
|
||||||
detailExample.createCriteria().andReportIdIn(reportRequest.getIds());
|
detailExample.createCriteria().andReportIdIn(ids);
|
||||||
apiScenarioReportDetailMapper.deleteByExample(detailExample);
|
apiScenarioReportDetailMapper.deleteByExample(detailExample);
|
||||||
|
|
||||||
ApiScenarioReportExample apiTestReportExample = new ApiScenarioReportExample();
|
ApiScenarioReportExample apiTestReportExample = new ApiScenarioReportExample();
|
||||||
apiTestReportExample.createCriteria().andIdIn(reportRequest.getIds());
|
apiTestReportExample.createCriteria().andIdIn(ids);
|
||||||
apiScenarioReportMapper.deleteByExample(apiTestReportExample);
|
apiScenarioReportMapper.deleteByExample(apiTestReportExample);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -177,6 +177,6 @@ task_notification=Result notification
|
||||||
message_task_already_exists=Task recipient already exists
|
message_task_already_exists=Task recipient already exists
|
||||||
#automation
|
#automation
|
||||||
automation_name_already_exists=the scenario already exists in the project and the module
|
automation_name_already_exists=the scenario already exists in the project and the module
|
||||||
|
automation_exec_info=There are no test steps to execute
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -178,3 +178,4 @@ task_notification=任务通知
|
||||||
message_task_already_exists=任务接收人已经存在
|
message_task_already_exists=任务接收人已经存在
|
||||||
#automation
|
#automation
|
||||||
automation_name_already_exists=同一个项目和模块下,场景名称不能重复
|
automation_name_already_exists=同一个项目和模块下,场景名称不能重复
|
||||||
|
automation_exec_info=没有测试步骤,无法执行
|
|
@ -179,3 +179,4 @@ api_definition_url_not_repeating=接口請求地址已經存在
|
||||||
message_task_already_exists=任務接收人已經存在
|
message_task_already_exists=任務接收人已經存在
|
||||||
#automation
|
#automation
|
||||||
automation_name_already_exists=同一個項目和模塊下,場景名稱不能重複
|
automation_name_already_exists=同一個項目和模塊下,場景名稱不能重複
|
||||||
|
automation_exec_info=沒有測試步驟,無法執行
|
|
@ -7,21 +7,35 @@
|
||||||
:title="$t('api_report.title')"
|
:title="$t('api_report.title')"
|
||||||
:show-create="false"/>
|
:show-create="false"/>
|
||||||
</template>
|
</template>
|
||||||
<el-table border :data="tableData" class="adjust-table table-content" @sort-change="sort"
|
<el-table ref="reportListTable" border :data="tableData" class="adjust-table table-content" @sort-change="sort"
|
||||||
@select-all="handleSelectAll"
|
@select-all="handleSelectAll"
|
||||||
@select="handleSelect"
|
@select="handleSelect"
|
||||||
@filter-change="filter" @row-click="handleView">
|
@filter-change="filter" @row-click="handleView">
|
||||||
<el-table-column
|
<el-table-column
|
||||||
type="selection"/>
|
type="selection"/>
|
||||||
<el-table-column width="40" :resizable="false" align="center">
|
<el-table-column width="40" :resizable="false" align="center">
|
||||||
|
<el-dropdown slot="header" style="width: 14px">
|
||||||
|
<span class="el-dropdown-link" style="width: 14px">
|
||||||
|
<i class="el-icon-arrow-down el-icon--right" style="margin-left: 0px"></i>
|
||||||
|
</span>
|
||||||
|
<el-dropdown-menu slot="dropdown">
|
||||||
|
<el-dropdown-item @click.native.stop="isSelectDataAll(true)">
|
||||||
|
{{ $t('api_test.batch_menus.select_all_data', [total]) }}
|
||||||
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item @click.native.stop="isSelectDataAll(false)">
|
||||||
|
{{ $t('api_test.batch_menus.select_show_data', [tableData.length]) }}
|
||||||
|
</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</el-dropdown>
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<show-more-btn v-tester :is-show="scope.row.showMore" :buttons="buttons" :size="selectRows.size"/>
|
<show-more-btn v-tester :is-show="scope.row.showMore" :buttons="buttons" :size="selectDataCounts"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('commons.name')" width="200" show-overflow-tooltip prop="name">
|
<el-table-column :label="$t('commons.name')" width="200" show-overflow-tooltip prop="name">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column prop="scenarioName" :label="$t('api_test.automation.scenario_name')" width="150" show-overflow-tooltip/>
|
<el-table-column prop="scenarioName" :label="$t('api_test.automation.scenario_name')" width="150"
|
||||||
|
show-overflow-tooltip/>
|
||||||
<el-table-column prop="userName" :label="$t('api_test.creator')" width="150" show-overflow-tooltip/>
|
<el-table-column prop="userName" :label="$t('api_test.creator')" width="150" show-overflow-tooltip/>
|
||||||
<el-table-column prop="createTime" width="250" :label="$t('commons.create_time')" sortable>
|
<el-table-column prop="createTime" width="250" :label="$t('commons.create_time')" sortable>
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
|
@ -55,8 +69,10 @@
|
||||||
</el-card>
|
</el-card>
|
||||||
</ms-main-container>
|
</ms-main-container>
|
||||||
|
|
||||||
<el-drawer :visible.sync="debugVisible" :destroy-on-close="true" direction="ltr" :withHeader="false" :title="$t('test_track.plan_view.test_result')" :modal="false" size="90%">
|
<el-drawer :visible.sync="debugVisible" :destroy-on-close="true" direction="ltr" :withHeader="false"
|
||||||
<ms-api-report-detail :report-id="reportId" :currentProjectId="currentProjectId" :info-db="true" @refresh="search"/>
|
:title="$t('test_track.plan_view.test_result')" :modal="false" size="90%">
|
||||||
|
<ms-api-report-detail :report-id="reportId" :currentProjectId="currentProjectId" :info-db="true"
|
||||||
|
@refresh="search"/>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
</ms-container>
|
</ms-container>
|
||||||
</template>
|
</template>
|
||||||
|
@ -116,6 +132,9 @@ export default {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
selectRows: new Set(),
|
selectRows: new Set(),
|
||||||
|
selectAll: false,
|
||||||
|
unSelection: [],
|
||||||
|
selectDataCounts: 0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -129,12 +148,16 @@ export default {
|
||||||
this.condition.testId = this.testId;
|
this.condition.testId = this.testId;
|
||||||
}
|
}
|
||||||
this.condition.projectId = getCurrentProjectID();
|
this.condition.projectId = getCurrentProjectID();
|
||||||
|
this.selectAll = false;
|
||||||
|
this.unSelection = [];
|
||||||
|
this.selectDataCounts = 0;
|
||||||
let url = "/api/scenario/report/list/" + this.currentPage + "/" + this.pageSize;
|
let url = "/api/scenario/report/list/" + this.currentPage + "/" + this.pageSize;
|
||||||
this.result = this.$post(url, this.condition, response => {
|
this.result = this.$post(url, this.condition, response => {
|
||||||
let data = response.data;
|
let data = response.data;
|
||||||
this.total = data.itemCount;
|
this.total = data.itemCount;
|
||||||
this.tableData = data.listObject;
|
this.tableData = data.listObject;
|
||||||
this.selectRows.clear();
|
this.selectRows.clear();
|
||||||
|
this.unSelection = data.listObject.map(s => s.id);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleSelectionChange(val) {
|
handleSelectionChange(val) {
|
||||||
|
@ -180,6 +203,7 @@ export default {
|
||||||
this.$set(row, "showMore", true);
|
this.$set(row, "showMore", true);
|
||||||
this.selectRows.add(row);
|
this.selectRows.add(row);
|
||||||
}
|
}
|
||||||
|
this.selectRowsCount(this.selectRows)
|
||||||
},
|
},
|
||||||
handleSelectAll(selection) {
|
handleSelectAll(selection) {
|
||||||
if (selection.length > 0) {
|
if (selection.length > 0) {
|
||||||
|
@ -193,6 +217,7 @@ export default {
|
||||||
this.$set(row, "showMore", false);
|
this.$set(row, "showMore", false);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
this.selectRowsCount(this.selectRows)
|
||||||
},
|
},
|
||||||
handleBatchDelete() {
|
handleBatchDelete() {
|
||||||
this.$alert(this.$t('api_report.delete_batch_confirm') + "?", '', {
|
this.$alert(this.$t('api_report.delete_batch_confirm') + "?", '', {
|
||||||
|
@ -200,7 +225,12 @@ export default {
|
||||||
callback: (action) => {
|
callback: (action) => {
|
||||||
if (action === 'confirm') {
|
if (action === 'confirm') {
|
||||||
let ids = Array.from(this.selectRows).map(row => row.id);
|
let ids = Array.from(this.selectRows).map(row => row.id);
|
||||||
this.$post('/api/scenario/report/batch/delete', {ids: ids}, () => {
|
let sendParam = {};
|
||||||
|
sendParam.ids = ids;
|
||||||
|
sendParam.selectAllDate = this.isSelectAllDate;
|
||||||
|
sendParam.unSelectIds = this.unSelection;
|
||||||
|
sendParam = Object.assign(sendParam, this.condition);
|
||||||
|
this.$post('/api/scenario/report/batch/delete', sendParam, () => {
|
||||||
this.selectRows.clear();
|
this.selectRows.clear();
|
||||||
this.$success(this.$t('commons.delete_success'));
|
this.$success(this.$t('commons.delete_success'));
|
||||||
this.search();
|
this.search();
|
||||||
|
@ -210,8 +240,32 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
selectRowsCount(selection) {
|
||||||
|
let selectedIDs = this.getIds(selection);
|
||||||
|
let allIDs = this.tableData.map(s => s.id);
|
||||||
|
this.unSelection = allIDs.filter(function (val) {
|
||||||
|
return selectedIDs.indexOf(val) === -1
|
||||||
|
});
|
||||||
|
if (this.isSelectAllDate) {
|
||||||
|
this.selectDataCounts = this.total - this.unSelection.length;
|
||||||
|
} else {
|
||||||
|
this.selectDataCounts = selection.size;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isSelectDataAll(dataType) {
|
||||||
|
this.isSelectAllDate = dataType;
|
||||||
|
this.selectRowsCount(this.selectRows)
|
||||||
|
//如果已经全选,不需要再操作了
|
||||||
|
if (this.selectRows.size != this.tableData.length) {
|
||||||
|
this.$refs.reportListTable.toggleAllSelection(true);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getIds(rowSets) {
|
||||||
|
let rowArray = Array.from(rowSets)
|
||||||
|
let ids = rowArray.map(s => s.id);
|
||||||
|
return ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
|
|
|
@ -6,11 +6,25 @@
|
||||||
:show-create="false"/>
|
:show-create="false"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<el-table ref="scenarioTable" border :data="tableData" class="adjust-table" @select-all="select" @select="select" v-loading="loading">
|
<el-table ref="scenarioTable" border :data="tableData" class="adjust-table" @select-all="select" @select="select"
|
||||||
<el-table-column type="selection"/>
|
v-loading="loading">
|
||||||
|
<el-table-column type="selection" width="38"/>
|
||||||
<el-table-column width="40" :resizable="false" align="center">
|
<el-table-column width="40" :resizable="false" align="center">
|
||||||
|
<el-dropdown slot="header" style="width: 14px">
|
||||||
|
<span class="el-dropdown-link" style="width: 14px">
|
||||||
|
<i class="el-icon-arrow-down el-icon--right" style="margin-left: 0px"></i>
|
||||||
|
</span>
|
||||||
|
<el-dropdown-menu slot="dropdown">
|
||||||
|
<el-dropdown-item @click.native.stop="isSelectDataAll(true)">
|
||||||
|
{{$t('api_test.batch_menus.select_all_data',[total])}}
|
||||||
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item @click.native.stop="isSelectDataAll(false)">
|
||||||
|
{{$t('api_test.batch_menus.select_show_data',[tableData.length])}}
|
||||||
|
</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</el-dropdown>
|
||||||
<template v-slot:default="{row}">
|
<template v-slot:default="{row}">
|
||||||
<show-more-btn :is-show="isSelect(row)" :buttons="buttons" :size="selection.length"/>
|
<show-more-btn :is-show="isSelect(row)" :buttons="buttons" :size="selectDataCounts"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="num" label="ID"
|
<el-table-column prop="num" label="ID"
|
||||||
|
@ -25,7 +39,6 @@
|
||||||
<ms-tag v-if="scope.row.level == 'P2'" type="success" effect="plain" content="P2"/>
|
<ms-tag v-if="scope.row.level == 'P2'" type="success" effect="plain" content="P2"/>
|
||||||
<ms-tag v-if="scope.row.level == 'P3'" type="danger" effect="plain" content="P3"/>
|
<ms-tag v-if="scope.row.level == 'P3'" type="danger" effect="plain" content="P3"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="tags" :label="$t('api_test.automation.tag')" width="200px">
|
<el-table-column prop="tags" :label="$t('api_test.automation.tag')" width="200px">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
|
@ -43,8 +56,12 @@
|
||||||
<el-table-column prop="stepTotal" :label="$t('api_test.automation.step')" show-overflow-tooltip/>
|
<el-table-column prop="stepTotal" :label="$t('api_test.automation.step')" show-overflow-tooltip/>
|
||||||
<el-table-column prop="lastResult" :label="$t('api_test.automation.last_result')">
|
<el-table-column prop="lastResult" :label="$t('api_test.automation.last_result')">
|
||||||
<template v-slot:default="{row}">
|
<template v-slot:default="{row}">
|
||||||
<el-link type="success" @click="showReport(row)" v-if="row.lastResult === 'Success'">{{ $t('api_test.automation.success') }}</el-link>
|
<el-link type="success" @click="showReport(row)" v-if="row.lastResult === 'Success'">
|
||||||
<el-link type="danger" @click="showReport(row)" v-if="row.lastResult === 'Fail'">{{ $t('api_test.automation.fail') }}</el-link>
|
{{ $t('api_test.automation.success') }}
|
||||||
|
</el-link>
|
||||||
|
<el-link type="danger" @click="showReport(row)" v-if="row.lastResult === 'Fail'">
|
||||||
|
{{ $t('api_test.automation.fail') }}
|
||||||
|
</el-link>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="passRate" :label="$t('api_test.automation.passing_rate')"
|
<el-table-column prop="passRate" :label="$t('api_test.automation.passing_rate')"
|
||||||
|
@ -69,16 +86,17 @@
|
||||||
:total="total"/>
|
:total="total"/>
|
||||||
<div>
|
<div>
|
||||||
<!-- 执行结果 -->
|
<!-- 执行结果 -->
|
||||||
<el-drawer :visible.sync="runVisible" :destroy-on-close="true" direction="ltr" :withHeader="true" :modal="false" size="90%">
|
<el-drawer :visible.sync="runVisible" :destroy-on-close="true" direction="ltr" :withHeader="true" :modal="false"
|
||||||
|
size="90%">
|
||||||
<ms-api-report-detail @refresh="search" :infoDb="infoDb" :report-id="reportId" :currentProjectId="projectId"/>
|
<ms-api-report-detail @refresh="search" :infoDb="infoDb" :report-id="reportId" :currentProjectId="projectId"/>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
<!--测试计划-->
|
<!--测试计划-->
|
||||||
<el-drawer :visible.sync="planVisible" :destroy-on-close="true" direction="ltr" :withHeader="false" :title="$t('test_track.plan_view.test_result')" :modal="false" size="90%">
|
<el-drawer :visible.sync="planVisible" :destroy-on-close="true" direction="ltr" :withHeader="false"
|
||||||
|
:title="$t('test_track.plan_view.test_result')" :modal="false" size="90%">
|
||||||
<ms-test-plan-list @addTestPlan="addTestPlan"/>
|
<ms-test-plan-list @addTestPlan="addTestPlan"/>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -95,7 +113,16 @@
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsApiScenarioList",
|
name: "MsApiScenarioList",
|
||||||
components: {MsTablePagination, MsTableMoreBtn, ShowMoreBtn, MsTableHeader, MsTag, MsApiReportDetail, MsScenarioExtendButtons, MsTestPlanList},
|
components: {
|
||||||
|
MsTablePagination,
|
||||||
|
MsTableMoreBtn,
|
||||||
|
ShowMoreBtn,
|
||||||
|
MsTableHeader,
|
||||||
|
MsTag,
|
||||||
|
MsApiReportDetail,
|
||||||
|
MsScenarioExtendButtons,
|
||||||
|
MsTestPlanList
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
referenced: {
|
referenced: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
@ -121,13 +148,14 @@
|
||||||
reportId: "",
|
reportId: "",
|
||||||
batchReportId: "",
|
batchReportId: "",
|
||||||
content: {},
|
content: {},
|
||||||
selectAll: false,
|
|
||||||
infoDb: false,
|
infoDb: false,
|
||||||
runVisible: false,
|
runVisible: false,
|
||||||
planVisible: false,
|
planVisible: false,
|
||||||
projectId: "",
|
projectId: "",
|
||||||
runData: [],
|
runData: [],
|
||||||
report: {},
|
report: {},
|
||||||
|
selectDataSize: 0,
|
||||||
|
selectAll: false,
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
name: this.$t('api_test.automation.batch_add_plan'), handleClick: this.handleBatchAddCase
|
name: this.$t('api_test.automation.batch_add_plan'), handleClick: this.handleBatchAddCase
|
||||||
|
@ -135,6 +163,9 @@
|
||||||
name: this.$t('api_test.automation.batch_execute'), handleClick: this.handleBatchExecute
|
name: this.$t('api_test.automation.batch_execute'), handleClick: this.handleBatchExecute
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
isSelectAllDate: false,
|
||||||
|
unSelection: [],
|
||||||
|
selectDataCounts: 0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -174,6 +205,10 @@
|
||||||
this.condition.projectId = this.projectId;
|
this.condition.projectId = this.projectId;
|
||||||
}
|
}
|
||||||
this.selection = [];
|
this.selection = [];
|
||||||
|
|
||||||
|
this.selectAll = false;
|
||||||
|
this.unSelection = [];
|
||||||
|
this.selectDataCounts = 0;
|
||||||
let url = "/api/automation/list/" + this.currentPage + "/" + this.pageSize;
|
let url = "/api/automation/list/" + this.currentPage + "/" + this.pageSize;
|
||||||
if (this.condition.projectId) {
|
if (this.condition.projectId) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
@ -187,6 +222,7 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
|
this.unSelection = data.listObject.map(s => s.id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -207,6 +243,12 @@
|
||||||
},
|
},
|
||||||
addTestPlan(plans) {
|
addTestPlan(plans) {
|
||||||
let obj = {planIds: plans, scenarioIds: this.selection};
|
let obj = {planIds: plans, scenarioIds: this.selection};
|
||||||
|
|
||||||
|
obj.projectId = getCurrentProjectID();
|
||||||
|
obj.selectAllDate = this.isSelectAllDate;
|
||||||
|
obj.unSelectIds = this.unSelection;
|
||||||
|
obj = Object.assign(obj, this.condition);
|
||||||
|
|
||||||
this.planVisible = false;
|
this.planVisible = false;
|
||||||
this.$post("/api/automation/scenario/plan", obj, response => {
|
this.$post("/api/automation/scenario/plan", obj, response => {
|
||||||
this.$success(this.$t("commons.save_success"));
|
this.$success(this.$t("commons.save_success"));
|
||||||
|
@ -244,6 +286,10 @@
|
||||||
run.id = getUUID();
|
run.id = getUUID();
|
||||||
run.scenarioIds = scenarioIds;
|
run.scenarioIds = scenarioIds;
|
||||||
run.projectId = getCurrentProjectID();
|
run.projectId = getCurrentProjectID();
|
||||||
|
run.selectAllDate = this.isSelectAllDate;
|
||||||
|
run.unSelectIds = this.unSelection;
|
||||||
|
|
||||||
|
run = Object.assign(run, this.condition);
|
||||||
this.$post(url, run, response => {
|
this.$post(url, run, response => {
|
||||||
let data = response.data;
|
let data = response.data;
|
||||||
this.runVisible = false;
|
this.runVisible = false;
|
||||||
|
@ -252,6 +298,10 @@
|
||||||
},
|
},
|
||||||
select(selection) {
|
select(selection) {
|
||||||
this.selection = selection.map(s => s.id);
|
this.selection = selection.map(s => s.id);
|
||||||
|
|
||||||
|
//统计应当展示选择了多少行
|
||||||
|
this.selectRowsCount(this.selection)
|
||||||
|
|
||||||
this.$emit('selection', selection);
|
this.$emit('selection', selection);
|
||||||
},
|
},
|
||||||
isSelect(row) {
|
isSelect(row) {
|
||||||
|
@ -293,6 +343,28 @@
|
||||||
this.infoDb = true;
|
this.infoDb = true;
|
||||||
this.reportId = row.reportId;
|
this.reportId = row.reportId;
|
||||||
},
|
},
|
||||||
|
//是否选择了全部数据
|
||||||
|
isSelectDataAll(dataType) {
|
||||||
|
this.isSelectAllDate = dataType;
|
||||||
|
this.selectRowsCount(this.selection);
|
||||||
|
//如果已经全选,不需要再操作了
|
||||||
|
if (this.selection.length != this.tableData.length) {
|
||||||
|
this.$refs.scenarioTable.toggleAllSelection(true);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//选择数据数量统计
|
||||||
|
selectRowsCount(selection) {
|
||||||
|
let selectedIDs = selection;
|
||||||
|
let allIDs = this.tableData.map(s => s.id);
|
||||||
|
this.unSelection = allIDs.filter(function (val) {
|
||||||
|
return selectedIDs.indexOf(val) === -1
|
||||||
|
});
|
||||||
|
if (this.isSelectAllDate) {
|
||||||
|
this.selectDataCounts = this.total - this.unSelection.length;
|
||||||
|
} else {
|
||||||
|
this.selectDataCounts = this.selection.length;
|
||||||
|
}
|
||||||
|
},
|
||||||
remove(row) {
|
remove(row) {
|
||||||
if (this.trashEnable) {
|
if (this.trashEnable) {
|
||||||
this.$get('/api/automation/delete/' + row.id, () => {
|
this.$get('/api/automation/delete/' + row.id, () => {
|
||||||
|
@ -322,4 +394,5 @@
|
||||||
/deep/ .el-drawer__header {
|
/deep/ .el-drawer__header {
|
||||||
margin-bottom: 0px;
|
margin-bottom: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -20,11 +20,20 @@
|
||||||
<div>
|
<div>
|
||||||
<el-select size="small" :placeholder="$t('api_test.definition.request.grade_info')" v-model="condition.priority"
|
<el-select size="small" :placeholder="$t('api_test.definition.request.grade_info')" v-model="condition.priority"
|
||||||
:disabled="isCaseEdit"
|
:disabled="isCaseEdit"
|
||||||
class="ms-api-header-select" @change="getApiTest" clearable style="margin-right: 20px">
|
class="ms-api-header-select" @change="getApiTest" clearable>
|
||||||
<el-option v-for="grd in priorities" :key="grd.id" :label="grd.name" :value="grd.id"/>
|
<el-option v-for="grd in priorities" :key="grd.id" :label="grd.name" :value="grd.id"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="3">
|
||||||
|
<div class="ms-api-header-select" style="margin-right: 20px">
|
||||||
|
<el-input size="small" :placeholder="$t('api_test.definition.request.select_case')"
|
||||||
|
:disabled="isCaseEdit"
|
||||||
|
v-model="condition.name" @blur="getApiTest" @keyup.enter.native="getApiTest" />
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
<el-col :span="4">
|
<el-col :span="4">
|
||||||
<div>
|
<div>
|
||||||
<ms-environment-select
|
<ms-environment-select
|
||||||
|
@ -33,13 +42,7 @@
|
||||||
@setEnvironment="setEnvironment"/>
|
@setEnvironment="setEnvironment"/>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="3">
|
|
||||||
<div class="ms-api-header-select">
|
|
||||||
<el-input size="small" :placeholder="$t('api_test.definition.request.select_case')"
|
|
||||||
:disabled="isCaseEdit"
|
|
||||||
v-model="condition.name" @blur="getApiTest" @keyup.enter.native="getApiTest"/>
|
|
||||||
</div>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="2" v-if="!(isReadOnly || isCaseEdit)">
|
<el-col :span="2" v-if="!(isReadOnly || isCaseEdit)">
|
||||||
<el-dropdown size="small" split-button type="primary" class="ms-api-header-select" @click="addCase"
|
<el-dropdown size="small" split-button type="primary" class="ms-api-header-select" @click="addCase"
|
||||||
@command="handleCommand" v-tester>
|
@command="handleCommand" v-tester>
|
||||||
|
@ -171,7 +174,6 @@
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.el-col {
|
.el-col {
|
||||||
height: 32px;
|
height: 32px;
|
||||||
line-height: 32px;
|
line-height: 32px;
|
||||||
|
|
|
@ -364,12 +364,14 @@ export default {
|
||||||
for (let i = 0; i < this.tableData.length; i++) {
|
for (let i = 0; i < this.tableData.length; i++) {
|
||||||
if (this.tableData[i]) {
|
if (this.tableData[i]) {
|
||||||
this.$set(this.tableData[i], "issuesSize", 0);
|
this.$set(this.tableData[i], "issuesSize", 0);
|
||||||
this.$get("/issues/get/" + this.tableData[i].caseId, response => {
|
this.$get("/issues/get/" + this.tableData[i].caseId).then(response => {
|
||||||
let issues = response.data;
|
let issues = response.data.data;
|
||||||
if (this.tableData[i]) {
|
if (this.tableData[i]) {
|
||||||
this.$set(this.tableData[i], "issuesSize", issues.length);
|
this.$set(this.tableData[i], "issuesSize", issues.length);
|
||||||
this.$set(this.tableData[i], "issuesContent", issues);
|
this.$set(this.tableData[i], "issuesContent", issues);
|
||||||
}
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
this.$set(this.tableData[i], "issuesContent", [{title: '获取缺陷失败',description: '获取缺陷失败',platform: '获取缺陷失败' }]);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -489,6 +489,10 @@ export default {
|
||||||
file_exist: "The name already exists in the project",
|
file_exist: "The name already exists in the project",
|
||||||
upload_limit_size: "Upload file size cannot exceed 30MB!",
|
upload_limit_size: "Upload file size cannot exceed 30MB!",
|
||||||
},
|
},
|
||||||
|
batch_menus:{
|
||||||
|
select_all_data: "Select all datas({0})",
|
||||||
|
select_show_data: "Select show datas({0})",
|
||||||
|
},
|
||||||
definition: {
|
definition: {
|
||||||
api_title: "Api test",
|
api_title: "Api test",
|
||||||
api_name: "Api name",
|
api_name: "Api name",
|
||||||
|
|
|
@ -487,6 +487,10 @@ export default {
|
||||||
file_exist: "该项目下已存在该jar包",
|
file_exist: "该项目下已存在该jar包",
|
||||||
upload_limit_size: "上传文件大小不能超过 30MB!",
|
upload_limit_size: "上传文件大小不能超过 30MB!",
|
||||||
},
|
},
|
||||||
|
batch_menus:{
|
||||||
|
select_all_data: "选择所有数据(共{0}条)",
|
||||||
|
select_show_data: "选择可见数据(共{0}条)",
|
||||||
|
},
|
||||||
definition: {
|
definition: {
|
||||||
api_title: "接口列表",
|
api_title: "接口列表",
|
||||||
api_name: "接口名称",
|
api_name: "接口名称",
|
||||||
|
|
|
@ -487,6 +487,10 @@ export default {
|
||||||
file_exist: "該項目下已存在該jar包",
|
file_exist: "該項目下已存在該jar包",
|
||||||
upload_limit_size: "上傳文件大小不能超過 30MB!",
|
upload_limit_size: "上傳文件大小不能超過 30MB!",
|
||||||
},
|
},
|
||||||
|
batch_menus:{
|
||||||
|
select_all_data: "選擇所有數據(共{0}條)",
|
||||||
|
select_show_data: "選擇可見數據(共{0}條)",
|
||||||
|
},
|
||||||
definition: {
|
definition: {
|
||||||
api_title: "接口列表",
|
api_title: "接口列表",
|
||||||
api_name: "接口名稱",
|
api_name: "接口名稱",
|
||||||
|
|
Loading…
Reference in New Issue