Merge branch 'v1.6' of https://github.com/metersphere/metersphere into v1.6
This commit is contained in:
commit
a09c4e3b04
|
@ -83,10 +83,7 @@ public class MsScenario extends MsTestElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 场景变量
|
// 场景变量
|
||||||
if (CollectionUtils.isNotEmpty(this.getVariables())) {
|
tree.add(arguments(config));
|
||||||
tree.add(arguments(config));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||||
for (MsTestElement el : hashTree) {
|
for (MsTestElement el : hashTree) {
|
||||||
el.toHashTree(tree, el.getHashTree(), config);
|
el.toHashTree(tree, el.getHashTree(), config);
|
||||||
|
@ -101,9 +98,11 @@ public class MsScenario extends MsTestElement {
|
||||||
arguments.setName(name + "Variables");
|
arguments.setName(name + "Variables");
|
||||||
arguments.setProperty(TestElement.TEST_CLASS, Arguments.class.getName());
|
arguments.setProperty(TestElement.TEST_CLASS, Arguments.class.getName());
|
||||||
arguments.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("ArgumentsPanel"));
|
arguments.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("ArgumentsPanel"));
|
||||||
variables.stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).forEach(keyValue ->
|
if (CollectionUtils.isNotEmpty(this.getVariables())) {
|
||||||
arguments.addArgument(keyValue.getName(), keyValue.getValue(), "=")
|
variables.stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).forEach(keyValue ->
|
||||||
);
|
arguments.addArgument(keyValue.getName(), keyValue.getValue(), "=")
|
||||||
|
);
|
||||||
|
}
|
||||||
if (config != null && config.getConfig() != null && config.getConfig().getCommonConfig() != null
|
if (config != null && config.getConfig() != null && config.getConfig().getCommonConfig() != null
|
||||||
&& CollectionUtils.isNotEmpty(config.getConfig().getCommonConfig().getVariables())) {
|
&& CollectionUtils.isNotEmpty(config.getConfig().getCommonConfig().getVariables())) {
|
||||||
config.getConfig().getCommonConfig().getVariables().stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).forEach(keyValue ->
|
config.getConfig().getCommonConfig().getVariables().stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).forEach(keyValue ->
|
||||||
|
|
|
@ -43,4 +43,8 @@ public class ScenarioResult {
|
||||||
public void addPassAssertions(int count) {
|
public void addPassAssertions(int count) {
|
||||||
this.passAssertions += count;
|
this.passAssertions += count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getTotal() {
|
||||||
|
return error + success;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,4 +38,5 @@ public class TestResult {
|
||||||
this.passAssertions += count;
|
this.passAssertions += count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ 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;
|
||||||
|
@ -260,14 +261,14 @@ public class ApiAutomationService {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createAPIScenarioReportResult(String id, String scenarioId, String scenarioName, String triggerMode, String execType, String projectId, String userID) {
|
private void createScenarioReport(String id, String scenarioId, String scenarioName, String triggerMode, String execType, String projectId, String userID) {
|
||||||
APIScenarioReportResult report = new APIScenarioReportResult();
|
APIScenarioReportResult report = new APIScenarioReportResult();
|
||||||
report.setId(id);
|
report.setId(id);
|
||||||
report.setTestId(id);
|
report.setTestId(id);
|
||||||
if (StringUtils.isNotEmpty(scenarioName)) {
|
if (StringUtils.isNotEmpty(scenarioName)) {
|
||||||
report.setName(scenarioName);
|
report.setName(scenarioName);
|
||||||
} else {
|
} else {
|
||||||
report.setName("零时调试名称");
|
report.setName("场景调试");
|
||||||
}
|
}
|
||||||
report.setCreateTime(System.currentTimeMillis());
|
report.setCreateTime(System.currentTimeMillis());
|
||||||
report.setUpdateTime(System.currentTimeMillis());
|
report.setUpdateTime(System.currentTimeMillis());
|
||||||
|
@ -295,25 +296,23 @@ public class ApiAutomationService {
|
||||||
List<ApiScenarioWithBLOBs> apiScenarios = extApiScenarioMapper.selectIds(request.getScenarioIds());
|
List<ApiScenarioWithBLOBs> apiScenarios = extApiScenarioMapper.selectIds(request.getScenarioIds());
|
||||||
MsTestPlan testPlan = new MsTestPlan();
|
MsTestPlan testPlan = new MsTestPlan();
|
||||||
testPlan.setHashTree(new LinkedList<>());
|
testPlan.setHashTree(new LinkedList<>());
|
||||||
HashTree jmeterTestPlanHashTree = new ListedHashTree();
|
HashTree jmeterHashTree = new ListedHashTree();
|
||||||
String projectID = request.getProjectId();
|
try {
|
||||||
boolean isOne = true;
|
boolean isFirst = true;
|
||||||
for (ApiScenarioWithBLOBs item : apiScenarios) {
|
for (ApiScenarioWithBLOBs item : apiScenarios) {
|
||||||
MsThreadGroup group = new MsThreadGroup();
|
MsThreadGroup group = new MsThreadGroup();
|
||||||
group.setLabel(item.getName());
|
group.setLabel(item.getName());
|
||||||
// 批量执行的结果直接存储为报告
|
|
||||||
if (isOne) {
|
|
||||||
group.setName(request.getId());
|
|
||||||
isOne = false;
|
|
||||||
} else {
|
|
||||||
group.setName(UUID.randomUUID().toString());
|
group.setName(UUID.randomUUID().toString());
|
||||||
}
|
// 批量执行的结果直接存储为报告
|
||||||
projectID = item.getProjectId();
|
if (isFirst) {
|
||||||
try {
|
group.setName(request.getId());
|
||||||
|
isFirst = false;
|
||||||
|
}
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
JSONObject element = JSON.parseObject(item.getScenarioDefinition());
|
JSONObject element = JSON.parseObject(item.getScenarioDefinition());
|
||||||
MsScenario scenario = JSONObject.parseObject(item.getScenarioDefinition(), MsScenario.class);
|
MsScenario scenario = JSONObject.parseObject(item.getScenarioDefinition(), MsScenario.class);
|
||||||
|
|
||||||
// 多态JSON普通转换会丢失内容,需要通过 ObjectMapper 获取
|
// 多态JSON普通转换会丢失内容,需要通过 ObjectMapper 获取
|
||||||
if (element != null && StringUtils.isNotEmpty(element.getString("hashTree"))) {
|
if (element != null && StringUtils.isNotEmpty(element.getString("hashTree"))) {
|
||||||
LinkedList<MsTestElement> elements = mapper.readValue(element.getString("hashTree"),
|
LinkedList<MsTestElement> elements = mapper.readValue(element.getString("hashTree"),
|
||||||
|
@ -331,22 +330,23 @@ public class ApiAutomationService {
|
||||||
LinkedList<MsTestElement> scenarios = new LinkedList<>();
|
LinkedList<MsTestElement> scenarios = new LinkedList<>();
|
||||||
scenarios.add(scenario);
|
scenarios.add(scenario);
|
||||||
// 创建场景报告
|
// 创建场景报告
|
||||||
createAPIScenarioReportResult(group.getName(), item.getId(), item.getName(), request.getTriggerMode() == null ? ReportTriggerMode.MANUAL.name() : request.getTriggerMode(),
|
createScenarioReport(group.getName(), item.getId(), item.getName(), request.getTriggerMode() == null ? ReportTriggerMode.MANUAL.name() : request.getTriggerMode(),
|
||||||
request.getExecuteType(), projectID, request.getReportUserID());
|
request.getExecuteType(), item.getProjectId(), request.getReportUserID());
|
||||||
group.setHashTree(scenarios);
|
group.setHashTree(scenarios);
|
||||||
testPlan.getHashTree().add(group);
|
testPlan.getHashTree().add(group);
|
||||||
} catch (Exception ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
LogUtil.error(ex.getMessage());
|
||||||
}
|
}
|
||||||
testPlan.toHashTree(jmeterTestPlanHashTree, testPlan.getHashTree(), new ParameterConfig());
|
testPlan.toHashTree(jmeterHashTree, testPlan.getHashTree(), new ParameterConfig());
|
||||||
|
|
||||||
String runMode = ApiRunMode.SCENARIO.name();
|
String runMode = ApiRunMode.SCENARIO.name();
|
||||||
if (StringUtils.isNotBlank(request.getRunMode()) && StringUtils.equals(request.getRunMode(), ApiRunMode.SCENARIO_PLAN.name())) {
|
if (StringUtils.isNotBlank(request.getRunMode()) && StringUtils.equals(request.getRunMode(), ApiRunMode.SCENARIO_PLAN.name())) {
|
||||||
runMode = ApiRunMode.SCENARIO_PLAN.name();
|
runMode = ApiRunMode.SCENARIO_PLAN.name();
|
||||||
}
|
}
|
||||||
// 调用执行方法
|
// 调用执行方法
|
||||||
jMeterService.runDefinition(request.getId(), jmeterTestPlanHashTree, request.getReportId(), runMode);
|
jMeterService.runDefinition(request.getId(), jmeterHashTree, request.getReportId(), runMode);
|
||||||
return request.getId();
|
return request.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,7 +371,7 @@ public class ApiAutomationService {
|
||||||
HashTree hashTree = request.getTestElement().generateHashTree(config);
|
HashTree hashTree = request.getTestElement().generateHashTree(config);
|
||||||
// 调用执行方法
|
// 调用执行方法
|
||||||
jMeterService.runDefinition(request.getId(), hashTree, request.getReportId(), ApiRunMode.SCENARIO.name());
|
jMeterService.runDefinition(request.getId(), hashTree, request.getReportId(), ApiRunMode.SCENARIO.name());
|
||||||
createAPIScenarioReportResult(request.getId(), request.getScenarioId(), request.getScenarioName(), ReportTriggerMode.MANUAL.name(), request.getExecuteType(), request.getProjectId(),
|
createScenarioReport(request.getId(), request.getScenarioId(), request.getScenarioName(), ReportTriggerMode.MANUAL.name(), request.getExecuteType(), request.getProjectId(),
|
||||||
SessionUtils.getUserId());
|
SessionUtils.getUserId());
|
||||||
return request.getId();
|
return request.getId();
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,8 @@ public class ApiScenarioReportService {
|
||||||
report.setId(test.getId());
|
report.setId(test.getId());
|
||||||
report.setProjectId(test.getProjectId());
|
report.setProjectId(test.getProjectId());
|
||||||
report.setName(test.getName());
|
report.setName(test.getName());
|
||||||
|
report.setScenarioName(test.getScenarioName());
|
||||||
|
report.setScenarioId(test.getScenarioId());
|
||||||
report.setTriggerMode(test.getTriggerMode());
|
report.setTriggerMode(test.getTriggerMode());
|
||||||
report.setDescription(test.getDescription());
|
report.setDescription(test.getDescription());
|
||||||
report.setCreateTime(System.currentTimeMillis());
|
report.setCreateTime(System.currentTimeMillis());
|
||||||
|
@ -103,18 +105,18 @@ public class ApiScenarioReportService {
|
||||||
report.setStatus(test.getStatus());
|
report.setStatus(test.getStatus());
|
||||||
report.setUserId(test.getUserId());
|
report.setUserId(test.getUserId());
|
||||||
report.setExecuteType(test.getExecuteType());
|
report.setExecuteType(test.getExecuteType());
|
||||||
apiScenarioReportMapper.updateByPrimaryKey(report);
|
apiScenarioReportMapper.updateByPrimaryKeySelective(report);
|
||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TestResult createTestResult(TestResult result) {
|
private TestResult createTestResult(String testId, ScenarioResult scenarioResult) {
|
||||||
TestResult testResult = new TestResult();
|
TestResult testResult = new TestResult();
|
||||||
testResult.setTestId(result.getTestId());
|
testResult.setTestId(testId);
|
||||||
testResult.setTotal(result.getTotal());
|
testResult.setTotal(scenarioResult.getTotal());
|
||||||
testResult.setError(result.getError());
|
testResult.setError(scenarioResult.getError());
|
||||||
testResult.setPassAssertions(result.getPassAssertions());
|
testResult.setPassAssertions(scenarioResult.getPassAssertions());
|
||||||
testResult.setSuccess(result.getSuccess());
|
testResult.setSuccess(scenarioResult.getSuccess());
|
||||||
testResult.setTotalAssertions(result.getTotalAssertions());
|
testResult.setTotalAssertions(scenarioResult.getTotalAssertions());
|
||||||
return testResult;
|
return testResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +134,7 @@ public class ApiScenarioReportService {
|
||||||
ApiScenarioReport report = editReport(scenarioResult);
|
ApiScenarioReport report = editReport(scenarioResult);
|
||||||
// 报告详情内容
|
// 报告详情内容
|
||||||
ApiScenarioReportDetail detail = new ApiScenarioReportDetail();
|
ApiScenarioReportDetail detail = new ApiScenarioReportDetail();
|
||||||
TestResult newResult = createTestResult(result);
|
TestResult newResult = createTestResult(result.getTestId(), scenarioResult);
|
||||||
List<ScenarioResult> scenarioResults = new ArrayList();
|
List<ScenarioResult> scenarioResults = new ArrayList();
|
||||||
scenarioResult.setName(report.getScenarioName());
|
scenarioResult.setName(report.getScenarioName());
|
||||||
scenarioResults.add(scenarioResult);
|
scenarioResults.add(scenarioResult);
|
||||||
|
@ -152,10 +154,9 @@ public class ApiScenarioReportService {
|
||||||
for (ScenarioResult item : result.getScenarios()) {
|
for (ScenarioResult item : result.getScenarios()) {
|
||||||
// 更新报告状态
|
// 更新报告状态
|
||||||
ApiScenarioReport report = editReport(item);
|
ApiScenarioReport report = editReport(item);
|
||||||
|
|
||||||
// 报告详情内容
|
// 报告详情内容
|
||||||
ApiScenarioReportDetail detail = new ApiScenarioReportDetail();
|
ApiScenarioReportDetail detail = new ApiScenarioReportDetail();
|
||||||
TestResult newResult = createTestResult(result);
|
TestResult newResult = createTestResult(result.getTestId(), item);
|
||||||
List<ScenarioResult> scenarioResults = new ArrayList();
|
List<ScenarioResult> scenarioResults = new ArrayList();
|
||||||
item.setName(report.getScenarioName());
|
item.setName(report.getScenarioName());
|
||||||
scenarioResults.add(item);
|
scenarioResults.add(item);
|
||||||
|
|
|
@ -181,7 +181,7 @@
|
||||||
INNER JOIN (
|
INNER JOIN (
|
||||||
SELECT acitem.`name`,acitem.id FROM api_scenario acitem INNER JOIN `schedule` sc ON acitem.id = sc.resource_id
|
SELECT acitem.`name`,acitem.id FROM api_scenario acitem INNER JOIN `schedule` sc ON acitem.id = sc.resource_id
|
||||||
) ac on ar.scenario_id = ac.id
|
) ac on ar.scenario_id = ac.id
|
||||||
WHERE acr.project_id = #{projectId} AND ar.create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp}
|
WHERE acr.project_id = #{projectId} AND ar.trigger_mode = 'SCHEDULE' AND ar.create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="countByProjectIdGroupByExecuteResult" resultType="io.metersphere.api.dto.datacount.ApiDataCountResult">
|
<select id="countByProjectIdGroupByExecuteResult" resultType="io.metersphere.api.dto.datacount.ApiDataCountResult">
|
||||||
|
@ -191,7 +191,7 @@
|
||||||
INNER JOIN (
|
INNER JOIN (
|
||||||
SELECT acitem.`name`,acitem.id FROM api_scenario acitem INNER JOIN `schedule` sc ON acitem.id = sc.resource_id
|
SELECT acitem.`name`,acitem.id FROM api_scenario acitem INNER JOIN `schedule` sc ON acitem.id = sc.resource_id
|
||||||
) ac on ar.scenario_id = ac.id
|
) ac on ar.scenario_id = ac.id
|
||||||
WHERE acr.project_id = #{projectId}
|
WHERE acr.project_id = #{projectId} AND ar.trigger_mode = 'SCHEDULE'
|
||||||
GROUP BY groupField;
|
GROUP BY groupField;
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -159,7 +159,7 @@
|
||||||
INNER JOIN api_test_report testReport ON testReportDetail.report_id = testReport.id
|
INNER JOIN api_test_report testReport ON testReportDetail.report_id = testReport.id
|
||||||
WHERE sch.resource_id IN (
|
WHERE sch.resource_id IN (
|
||||||
SELECT id FROM api_test WHERE project_id = #{projectId,jdbcType=VARCHAR}
|
SELECT id FROM api_test WHERE project_id = #{projectId,jdbcType=VARCHAR}
|
||||||
)
|
) AND testReport.trigger_mode = 'SCHEDULE'
|
||||||
GROUP BY groupField;
|
GROUP BY groupField;
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
@ -170,6 +170,6 @@
|
||||||
WHERE sch.resource_id IN (
|
WHERE sch.resource_id IN (
|
||||||
SELECT id FROM api_test WHERE project_id = #{projectId,jdbcType=VARCHAR}
|
SELECT id FROM api_test WHERE project_id = #{projectId,jdbcType=VARCHAR}
|
||||||
)
|
)
|
||||||
AND testReport.create_time BETWEEN #{startTime} and #{endTime}
|
AND testReport.trigger_mode = 'SCHEDULE' AND testReport.create_time BETWEEN #{startTime} and #{endTime}
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -46,9 +46,11 @@
|
||||||
<select id="countTaskByProjectIdAndCreateTimeRange" resultType="java.lang.Long">
|
<select id="countTaskByProjectIdAndCreateTimeRange" resultType="java.lang.Long">
|
||||||
SELECT COUNT(id) AS countNumber FROM `schedule`
|
SELECT COUNT(id) AS countNumber FROM `schedule`
|
||||||
WHERE resource_id IN (
|
WHERE resource_id IN (
|
||||||
SELECT id FROM api_test WHERE project_id = #{projectId,jdbcType=VARCHAR} AND status != 'Trash'
|
SELECT atest.id FROM api_test atest
|
||||||
|
WHERE atest.project_id = #{projectId,jdbcType=VARCHAR} AND atest.status != 'Trash'
|
||||||
UNION
|
UNION
|
||||||
SELECT id FROM api_scenario WHERE project_id = #{projectId,jdbcType=VARCHAR} AND status != 'Trash'
|
SELECT scene.id FROM api_scenario scene
|
||||||
|
WHERE scene.project_id = #{projectId,jdbcType=VARCHAR} AND scene.status != 'Trash'
|
||||||
)
|
)
|
||||||
AND create_time BETWEEN #{startTime} and #{endTime}
|
AND create_time BETWEEN #{startTime} and #{endTime}
|
||||||
</select>
|
</select>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<ms-container v-loading="loading">
|
<ms-container v-loading="loading">
|
||||||
<ms-main-container>
|
<ms-main-container>
|
||||||
<el-card>
|
<el-card>
|
||||||
<section class="report-container">
|
<section class="report-container" v-if="this.report.testId">
|
||||||
|
|
||||||
<ms-api-report-view-header :debug="debug" :report="report" @reportExport="handleExport" @reportSave="handleSave"/>
|
<ms-api-report-view-header :debug="debug" :report="report" @reportExport="handleExport" @reportSave="handleSave"/>
|
||||||
|
|
||||||
|
|
|
@ -127,10 +127,12 @@
|
||||||
if (this.request.id && this.request.referenced === 'REF') {
|
if (this.request.id && this.request.referenced === 'REF') {
|
||||||
let requestResult = this.request.requestResult;
|
let requestResult = this.request.requestResult;
|
||||||
let url = this.request.refType && this.request.refType === 'CASE' ? "/api/testcase/get/" : "/api/definition/get/";
|
let url = this.request.refType && this.request.refType === 'CASE' ? "/api/testcase/get/" : "/api/definition/get/";
|
||||||
|
let enable = this.request.enable;
|
||||||
this.$get(url + this.request.id, response => {
|
this.$get(url + this.request.id, response => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
Object.assign(this.request, JSON.parse(response.data.request));
|
Object.assign(this.request, JSON.parse(response.data.request));
|
||||||
this.request.name = response.data.name;
|
this.request.name = response.data.name;
|
||||||
|
this.request.enable = enable;
|
||||||
if (response.data.path && response.data.path != null) {
|
if (response.data.path && response.data.path != null) {
|
||||||
this.request.path = response.data.path;
|
this.request.path = response.data.path;
|
||||||
this.request.url = response.data.path;
|
this.request.url = response.data.path;
|
||||||
|
|
|
@ -111,7 +111,6 @@
|
||||||
condition: {},
|
condition: {},
|
||||||
currentScenario: {},
|
currentScenario: {},
|
||||||
schedule: {},
|
schedule: {},
|
||||||
selectAll: false,
|
|
||||||
selection: [],
|
selection: [],
|
||||||
tableData: [],
|
tableData: [],
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
|
@ -120,6 +119,7 @@
|
||||||
reportId: "",
|
reportId: "",
|
||||||
batchReportId: "",
|
batchReportId: "",
|
||||||
content: {},
|
content: {},
|
||||||
|
selectAll: false,
|
||||||
infoDb: false,
|
infoDb: false,
|
||||||
runVisible: false,
|
runVisible: false,
|
||||||
planVisible: false,
|
planVisible: false,
|
||||||
|
@ -248,9 +248,6 @@
|
||||||
this.batchReportId = run.id;
|
this.batchReportId = run.id;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
selectAllChange() {
|
|
||||||
this.handleCommand("table");
|
|
||||||
},
|
|
||||||
select(selection) {
|
select(selection) {
|
||||||
this.selection = selection.map(s => s.id);
|
this.selection = selection.map(s => s.id);
|
||||||
this.$emit('selection', selection);
|
this.$emit('selection', selection);
|
||||||
|
|
|
@ -396,16 +396,16 @@
|
||||||
this.addComponent('ConstantTimer')
|
this.addComponent('ConstantTimer')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// title: this.$t('api_test.automation.external_import'),
|
title: this.$t('api_test.definition.request.assertions_rule'),
|
||||||
// show: this.showButton("OT_IMPORT"),
|
show: this.showButton("Assertions"),
|
||||||
// titleColor: "#409EFF",
|
titleColor: "#A30014",
|
||||||
// titleBgColor: "#EEF5FE",
|
titleBgColor: "#F7E6E9",
|
||||||
// icon: "next_plan",
|
icon: "next_plan",
|
||||||
// click: () => {
|
click: () => {
|
||||||
// this.addComponent('OT_IMPORT')
|
this.addComponent('Assertions')
|
||||||
// }
|
}
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
title: this.$t('api_test.automation.customize_req'),
|
title: this.$t('api_test.automation.customize_req'),
|
||||||
show: this.showButton("CustomizeReq"),
|
show: this.showButton("CustomizeReq"),
|
||||||
|
@ -452,7 +452,7 @@
|
||||||
},
|
},
|
||||||
outsideClick(e) {
|
outsideClick(e) {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
this.operatingElements = ELEMENTS.get("ALL");
|
this.showAll();
|
||||||
},
|
},
|
||||||
addComponent(type) {
|
addComponent(type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -594,7 +594,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
pushApiOrCase(data, refType, referenced) {
|
pushApiOrCase(data, refType, referenced) {
|
||||||
data.forEach(item => {
|
data.forEach(item => {
|
||||||
this.setApiParameter(item, refType, referenced);
|
this.setApiParameter(item, refType, referenced);
|
||||||
});
|
});
|
||||||
|
@ -885,6 +885,7 @@
|
||||||
height: calc(100vh - 196px);
|
height: calc(100vh - 196px);
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ms-scenario-input {
|
.ms-scenario-input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<el-dialog class="api-relevance" :title="'接口导入'"
|
<el-dialog class="api-relevance" :title="'接口导入'"
|
||||||
:visible.sync="dialogVisible"
|
:visible.sync="dialogVisible"
|
||||||
width="60%"
|
width="70%"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
top="50px">
|
top="50px">
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<el-dialog class="api-relevance" :title="'场景导入'"
|
<el-dialog class="api-relevance" :title="'场景导入'"
|
||||||
:visible.sync="dialogVisible"
|
:visible.sync="dialogVisible"
|
||||||
width="60%"
|
width="70%"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
top="50px">
|
top="50px">
|
||||||
|
|
||||||
|
|
|
@ -1,77 +1,77 @@
|
||||||
<template>
|
<template>
|
||||||
<api-list-container
|
<api-list-container
|
||||||
:is-api-list-enable="isApiListEnable"
|
:is-api-list-enable="isApiListEnable"
|
||||||
@isApiListEnableChange="isApiListEnableChange">
|
@isApiListEnableChange="isApiListEnableChange">
|
||||||
|
|
||||||
<el-input placeholder="搜索" @blur="initTable" class="search-input" size="small" @keyup.enter.native="initTable" v-model="condition.name"/>
|
<el-input placeholder="搜索" @blur="initTable" class="search-input" size="small" @keyup.enter.native="initTable" v-model="condition.name"/>
|
||||||
|
|
||||||
<el-table v-loading="result.loading"
|
<el-table v-loading="result.loading"
|
||||||
border
|
border
|
||||||
:data="tableData" row-key="id" class="test-content adjust-table"
|
:data="tableData" row-key="id" class="test-content adjust-table"
|
||||||
@select-all="handleSelectAll"
|
@select-all="handleSelectAll"
|
||||||
@select="handleSelect">
|
@select="handleSelect">
|
||||||
<el-table-column type="selection"/>
|
<el-table-column type="selection"/>
|
||||||
|
|
||||||
<el-table-column prop="name" :label="$t('api_test.definition.api_name')" show-overflow-tooltip/>
|
<el-table-column prop="name" :label="$t('api_test.definition.api_name')" show-overflow-tooltip/>
|
||||||
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="status"
|
prop="status"
|
||||||
column-key="api_status"
|
column-key="api_status"
|
||||||
:label="$t('api_test.definition.api_status')"
|
:label="$t('api_test.definition.api_status')"
|
||||||
show-overflow-tooltip>
|
show-overflow-tooltip>
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<ms-tag v-if="scope.row.status == 'Prepare'" type="info" effect="plain" :content="$t('test_track.plan.plan_status_prepare')"/>
|
<ms-tag v-if="scope.row.status == 'Prepare'" type="info" effect="plain" :content="$t('test_track.plan.plan_status_prepare')"/>
|
||||||
<ms-tag v-if="scope.row.status == 'Underway'" type="warning" effect="plain" :content="$t('test_track.plan.plan_status_running')"/>
|
<ms-tag v-if="scope.row.status == 'Underway'" type="warning" effect="plain" :content="$t('test_track.plan.plan_status_running')"/>
|
||||||
<ms-tag v-if="scope.row.status == 'Completed'" type="success" effect="plain" :content="$t('test_track.plan.plan_status_completed')"/>
|
<ms-tag v-if="scope.row.status == 'Completed'" type="success" effect="plain" :content="$t('test_track.plan.plan_status_completed')"/>
|
||||||
<ms-tag v-if="scope.row.status == 'Trash'" type="danger" effect="plain" content="废弃"/>
|
<ms-tag v-if="scope.row.status == 'Trash'" type="danger" effect="plain" content="废弃"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="method"
|
prop="method"
|
||||||
:label="$t('api_test.definition.api_type')"
|
:label="$t('api_test.definition.api_type')"
|
||||||
show-overflow-tooltip>
|
show-overflow-tooltip>
|
||||||
<template v-slot:default="scope" class="request-method">
|
<template v-slot:default="scope" class="request-method">
|
||||||
<el-tag size="mini" :style="{'background-color': getColor(scope.row.method), border: getColor(true, scope.row.method)}" class="api-el-tag">
|
<el-tag size="mini" :style="{'background-color': getColor(scope.row.method), border: getColor(true, scope.row.method)}" class="api-el-tag">
|
||||||
{{ scope.row.method}}
|
{{ scope.row.method}}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="path"
|
prop="path"
|
||||||
:label="$t('api_test.definition.api_path')"
|
:label="$t('api_test.definition.api_path')"
|
||||||
show-overflow-tooltip/>
|
show-overflow-tooltip/>
|
||||||
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="userName"
|
prop="userName"
|
||||||
:label="$t('api_test.definition.api_principal')"
|
:label="$t('api_test.definition.api_principal')"
|
||||||
show-overflow-tooltip/>
|
show-overflow-tooltip/>
|
||||||
|
|
||||||
<el-table-column width="160" :label="$t('api_test.definition.api_last_time')" prop="updateTime">
|
<el-table-column width="160" :label="$t('api_test.definition.api_last_time')" prop="updateTime">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="caseTotal"
|
prop="caseTotal"
|
||||||
:label="$t('api_test.definition.api_case_number')"
|
:label="$t('api_test.definition.api_case_number')"
|
||||||
show-overflow-tooltip/>
|
show-overflow-tooltip/>
|
||||||
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="caseStatus"
|
prop="caseStatus"
|
||||||
:label="$t('api_test.definition.api_case_status')"
|
:label="$t('api_test.definition.api_case_status')"
|
||||||
show-overflow-tooltip/>
|
show-overflow-tooltip/>
|
||||||
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="casePassingRate"
|
prop="casePassingRate"
|
||||||
:label="$t('api_test.definition.api_case_passing_rate')"
|
:label="$t('api_test.definition.api_case_passing_rate')"
|
||||||
show-overflow-tooltip/>
|
show-overflow-tooltip/>
|
||||||
</el-table>
|
</el-table>
|
||||||
<ms-table-pagination :change="initTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
<ms-table-pagination :change="initTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||||
:total="total"/>
|
:total="total"/>
|
||||||
</api-list-container>
|
</api-list-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -164,9 +164,7 @@
|
||||||
this.initTable();
|
this.initTable();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {},
|
||||||
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
isApiListEnableChange(data) {
|
isApiListEnableChange(data) {
|
||||||
this.$emit('isApiListEnableChange', data);
|
this.$emit('isApiListEnableChange', data);
|
||||||
|
@ -185,6 +183,7 @@
|
||||||
if (this.currentProtocol != null) {
|
if (this.currentProtocol != null) {
|
||||||
this.condition.protocol = this.currentProtocol;
|
this.condition.protocol = this.currentProtocol;
|
||||||
}
|
}
|
||||||
|
this.condition.projectId = getCurrentProjectID();
|
||||||
this.result = this.$post("/api/definition/list/" + this.currentPage + "/" + this.pageSize, this.condition, response => {
|
this.result = this.$post("/api/definition/list/" + this.currentPage + "/" + this.pageSize, this.condition, response => {
|
||||||
this.total = response.data.itemCount;
|
this.total = response.data.itemCount;
|
||||||
this.tableData = response.data.listObject;
|
this.tableData = response.data.listObject;
|
||||||
|
|
|
@ -161,7 +161,6 @@
|
||||||
this.condition.protocol = this.currentProtocol;
|
this.condition.protocol = this.currentProtocol;
|
||||||
}
|
}
|
||||||
this.condition.projectId = getCurrentProjectID();
|
this.condition.projectId = getCurrentProjectID();
|
||||||
|
|
||||||
this.result = this.$post("/api/testcase/list/" + this.currentPage + "/" + this.pageSize, this.condition, response => {
|
this.result = this.$post("/api/testcase/list/" + this.currentPage + "/" + this.pageSize, this.condition, response => {
|
||||||
this.total = response.data.itemCount;
|
this.total = response.data.itemCount;
|
||||||
this.tableData = response.data.listObject;
|
this.tableData = response.data.listObject;
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
import MsApiAssertionText from "./ApiAssertionText";
|
import MsApiAssertionText from "./ApiAssertionText";
|
||||||
import MsApiAssertionRegex from "./ApiAssertionRegex";
|
import MsApiAssertionRegex from "./ApiAssertionRegex";
|
||||||
import MsApiAssertionDuration from "./ApiAssertionDuration";
|
import MsApiAssertionDuration from "./ApiAssertionDuration";
|
||||||
import {ASSERTION_TYPE, Assertions, JSONPath, Scenario} from "../../model/ApiTestModel";
|
import {ASSERTION_TYPE, JSONPath, Scenario} from "../../model/ApiTestModel";
|
||||||
import MsApiAssertionsEdit from "./ApiAssertionsEdit";
|
import MsApiAssertionsEdit from "./ApiAssertionsEdit";
|
||||||
import MsApiAssertionJsonPath from "./ApiAssertionJsonPath";
|
import MsApiAssertionJsonPath from "./ApiAssertionJsonPath";
|
||||||
import MsApiAssertionJsr223 from "./ApiAssertionJsr223";
|
import MsApiAssertionJsr223 from "./ApiAssertionJsr223";
|
||||||
|
|
|
@ -2,14 +2,22 @@
|
||||||
<ms-container>
|
<ms-container>
|
||||||
<el-header height="0">
|
<el-header height="0">
|
||||||
<div style="float: right">
|
<div style="float: right">
|
||||||
<div v-if="dateType==='1'">
|
<div v-if="tipsType==='1'">
|
||||||
🤔️天凉了,保温杯买了吗?
|
🤔️天凉了,保温杯买了吗?
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="dateType==='2'">
|
<div v-else-if="tipsType==='2'">
|
||||||
😔觉得MeterSphere不好用就来 <el-link href="https://github.com/metersphere/metersphere/issues" target="_blank" style="color: black" type="primary">https://github.com/metersphere/metersphere/issues</el-link> 吐个槽吧!
|
😔觉得MeterSphere不好用就来
|
||||||
|
<el-link href="https://github.com/metersphere/metersphere/issues" target="_blank" style="color: black"
|
||||||
|
type="primary">https://github.com/metersphere/metersphere/issues
|
||||||
|
</el-link>
|
||||||
|
吐个槽吧!
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="dateType==='3'">
|
<div v-else-if="tipsType==='3'">
|
||||||
😄觉得MeterSphere好用就来 <el-link href="https://github.com/metersphere/metersphere" target="_blank" style="color: black" type="primary">https://github.com/metersphere/metersphere</el-link> 点个star吧!
|
😄觉得MeterSphere好用就来
|
||||||
|
<el-link href="https://github.com/metersphere/metersphere" target="_blank" style="color: black"
|
||||||
|
type="primary">https://github.com/metersphere/metersphere
|
||||||
|
</el-link>
|
||||||
|
点个star吧!
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
😊 MeterSphere温馨提醒 —— 多喝热水哟!
|
😊 MeterSphere温馨提醒 —— 多喝热水哟!
|
||||||
|
@ -19,25 +27,25 @@
|
||||||
<ms-main-container v-loading="result.loading">
|
<ms-main-container v-loading="result.loading">
|
||||||
<el-row :gutter="0"></el-row>
|
<el-row :gutter="0"></el-row>
|
||||||
<el-row :gutter="10">
|
<el-row :gutter="10">
|
||||||
<el-col :span="6" >
|
<el-col :span="6">
|
||||||
<ms-api-info-card :api-count-data="apiCountData"/>
|
<ms-api-info-card :api-count-data="apiCountData"/>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="6" >
|
<el-col :span="6">
|
||||||
<ms-test-case-info-card :test-case-count-data="testCaseCountData"/>
|
<ms-test-case-info-card :test-case-count-data="testCaseCountData"/>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="6" >
|
<el-col :span="6">
|
||||||
<ms-scene-info-card :scene-count-data="sceneCountData"/>
|
<ms-scene-info-card :scene-count-data="sceneCountData"/>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="6" >
|
<el-col :span="6">
|
||||||
<ms-schedule-task-info-card :schedule-task-count-data="scheduleTaskCountData"/>
|
<ms-schedule-task-info-card :schedule-task-count-data="scheduleTaskCountData"/>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-row :gutter="10" >
|
<el-row :gutter="10">
|
||||||
<el-col :span="12" >
|
<el-col :span="12">
|
||||||
<ms-failure-test-case-list/>
|
<ms-failure-test-case-list/>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" >
|
<el-col :span="12">
|
||||||
<ms-running-task-list/>
|
<ms-running-task-list/>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
@ -48,7 +56,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MsContainer from "@/business/components/common/components/MsContainer";
|
import MsContainer from "@/business/components/common/components/MsContainer";
|
||||||
import MsMainContainer from "@/business/components/common/components/MsMainContainer";
|
import MsMainContainer from "@/business/components/common/components/MsMainContainer";
|
||||||
import MsApiInfoCard from "./components/ApiInfoCard";
|
import MsApiInfoCard from "./components/ApiInfoCard";
|
||||||
import MsSceneInfoCard from "./components/SceneInfoCard";
|
import MsSceneInfoCard from "./components/SceneInfoCard";
|
||||||
import MsScheduleTaskInfoCard from "./components/ScheduleTaskInfoCard";
|
import MsScheduleTaskInfoCard from "./components/ScheduleTaskInfoCard";
|
||||||
|
@ -63,56 +71,49 @@ export default {
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
MsApiInfoCard, MsSceneInfoCard, MsScheduleTaskInfoCard, MsTestCaseInfoCard,
|
MsApiInfoCard, MsSceneInfoCard, MsScheduleTaskInfoCard, MsTestCaseInfoCard,
|
||||||
MsFailureTestCaseList,MsRunningTaskList,
|
MsFailureTestCaseList, MsRunningTaskList,
|
||||||
MsMainContainer, MsContainer
|
MsMainContainer, MsContainer
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
values: [],
|
values: [],
|
||||||
apiCountData:{},
|
apiCountData: {},
|
||||||
sceneCountData:{},
|
sceneCountData: {},
|
||||||
testCaseCountData:{},
|
testCaseCountData: {},
|
||||||
scheduleTaskCountData:{},
|
scheduleTaskCountData: {},
|
||||||
dateType:"1",
|
tipsType: "1",
|
||||||
result: {},
|
result: {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
activated() {
|
activated() {
|
||||||
this.search();
|
this.search();
|
||||||
this.checkDateType();
|
this.checkTipsType();
|
||||||
},
|
},
|
||||||
// mounted() {
|
|
||||||
// this.getValues();
|
|
||||||
// },
|
|
||||||
created() {
|
created() {
|
||||||
// this.search();
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
checkDateType(){
|
checkTipsType() {
|
||||||
var random = Math.floor(Math.random() * (4 - 1 + 1))+1;
|
var random = Math.floor(Math.random() * (4 - 1 + 1)) + 1;
|
||||||
this.dateType = random +"";
|
this.tipsType = random + "";
|
||||||
},
|
|
||||||
openNewPage(herf){
|
|
||||||
window.open(herf, '_blank');
|
|
||||||
},
|
},
|
||||||
|
|
||||||
search() {
|
search() {
|
||||||
let selectProjectId = getCurrentProjectID();
|
let selectProjectId = getCurrentProjectID();
|
||||||
this.$get("/api/apiCount/"+selectProjectId, response => {
|
|
||||||
|
this.$get("/api/apiCount/" + selectProjectId, response => {
|
||||||
this.apiCountData = response.data;
|
this.apiCountData = response.data;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$get("/api/testSceneInfoCount/"+selectProjectId, response => {
|
this.$get("/api/testSceneInfoCount/" + selectProjectId, response => {
|
||||||
this.sceneCountData = response.data;
|
this.sceneCountData = response.data;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$get("/api/testCaseInfoCount/"+selectProjectId, response => {
|
this.$get("/api/testCaseInfoCount/" + selectProjectId, response => {
|
||||||
this.testCaseCountData = response.data;
|
this.testCaseCountData = response.data;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.$get("/api/scheduleTaskInfoCount/" + selectProjectId, response => {
|
||||||
// let workSpaceID = getCurrentWorkspaceId();
|
|
||||||
this.$get("/api/scheduleTaskInfoCount/"+selectProjectId, response => {
|
|
||||||
this.scheduleTaskCountData = response.data;
|
this.scheduleTaskCountData = response.data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue