Merge branch 'master' of https://github.com/metersphere/metersphere
This commit is contained in:
commit
b1d95c8d55
|
@ -188,11 +188,11 @@ public class ApiDataCountDTO {
|
|||
for (ApiDataCountResult countResult : allExecuteResult) {
|
||||
if("Success".equals(countResult.getGroupField())){
|
||||
this.successCount+= countResult.getCountNumber();
|
||||
}else if("Error".equals(countResult.getGroupField())){
|
||||
this.executedCount+= countResult.getCountNumber();
|
||||
}else if("Error".equals(countResult.getGroupField())||"Fail".equals(countResult.getGroupField())){
|
||||
this.failedCount+= countResult.getCountNumber();
|
||||
this.executedCount+= countResult.getCountNumber();
|
||||
}
|
||||
|
||||
this.executedCount+= countResult.getCountNumber();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -179,28 +179,31 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
|
|||
testResult.setTestId(testId);
|
||||
ApiScenarioReport scenarioReport = apiScenarioReportService.complete(testResult, this.runMode);
|
||||
|
||||
|
||||
report = new ApiTestReport();
|
||||
report.setStatus(scenarioReport.getStatus());
|
||||
report.setId(scenarioReport.getId());
|
||||
report.setTriggerMode(scenarioReport.getTriggerMode());
|
||||
report.setName(scenarioReport.getName());
|
||||
|
||||
|
||||
SystemParameterService systemParameterService = CommonBeanFactory.getBean(SystemParameterService.class);
|
||||
assert systemParameterService != null;
|
||||
BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo();
|
||||
reportUrl = baseSystemConfigDTO.getUrl() + "/#/api/automation/report";
|
||||
|
||||
|
||||
String scenaName = scenarioReport.getName();
|
||||
if(scenaName==null){
|
||||
String scenaName = scenarioReport.getName();
|
||||
if (scenaName == null) {
|
||||
scenaName = "";
|
||||
}else {
|
||||
scenaName = scenaName.split("-")[0];
|
||||
} else {
|
||||
String[] sceneNameArr = scenaName.split("-");
|
||||
if (sceneNameArr.length >= 4) {
|
||||
String endStr = "-" + sceneNameArr[sceneNameArr.length - 3] + "-" + sceneNameArr[sceneNameArr.length - 2] + "-" + sceneNameArr[sceneNameArr.length - 1];
|
||||
scenaName = scenaName.split(endStr)[0];
|
||||
} else {
|
||||
scenaName = scenaName.split("-")[0];
|
||||
}
|
||||
}
|
||||
|
||||
String scenarioID = apiScenarioReportService.getApiScenarioId(scenaName,scenarioReport.getProjectId());
|
||||
String scenarioID = apiScenarioReportService.getApiScenarioId(scenaName, scenarioReport.getProjectId());
|
||||
testResult.setTestId(scenarioID);
|
||||
} else {
|
||||
apiTestService.changeStatus(testId, APITestStatus.Completed);
|
||||
|
@ -224,14 +227,14 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
|
|||
}
|
||||
}
|
||||
try {
|
||||
sendTask(report,reportUrl, testResult);
|
||||
sendTask(report, reportUrl, testResult);
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void sendTask(ApiTestReport report,String reportUrl, TestResult testResult) {
|
||||
private static void sendTask(ApiTestReport report, String reportUrl, TestResult testResult) {
|
||||
SystemParameterService systemParameterService = CommonBeanFactory.getBean(SystemParameterService.class);
|
||||
NoticeSendService noticeSendService = CommonBeanFactory.getBean(NoticeSendService.class);
|
||||
assert systemParameterService != null;
|
||||
|
@ -239,7 +242,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
|
|||
|
||||
BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo();
|
||||
String url = reportUrl;
|
||||
if(StringUtils.isEmpty(url)){
|
||||
if (StringUtils.isEmpty(url)) {
|
||||
url = baseSystemConfigDTO.getUrl() + "/#/api/report/view/" + report.getId();
|
||||
}
|
||||
String successContext = "";
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
SELECT scene.`name` AS caseName,apiScene.testPlanName AS testPlan,count(report.id) AS failureTimes,'scenario' AS caseType
|
||||
FROM api_scenario_report report
|
||||
INNER JOIN api_scenario_report_detail reportDetail ON report.id = reportDetail.report_id
|
||||
INNER JOIN api_scenario scene ON reportDetail.content like concat('%"', scene.`name`,'"%')
|
||||
INNER JOIN api_scenario scene ON report.scenario_id = scene.id
|
||||
LEFT JOIN
|
||||
(
|
||||
SELECT
|
||||
|
|
|
@ -179,8 +179,8 @@
|
|||
SELECT count(acr.report_id) AS countNumber FROM api_scenario_report_detail acr
|
||||
INNER JOIN api_scenario_report ar ON ar.id = acr.report_id
|
||||
INNER JOIN (
|
||||
SELECT acitem.`name` FROM api_scenario acitem INNER JOIN `schedule` sc ON acitem.id = sc.resource_id
|
||||
) ac on acr.content like CONCAT('%"', ac.`name`,'"%')
|
||||
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
|
||||
WHERE acr.project_id = #{projectId} AND ar.create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp}
|
||||
</select>
|
||||
|
||||
|
@ -189,8 +189,8 @@
|
|||
FROM api_scenario_report_detail acr
|
||||
INNER JOIN api_scenario_report ar ON ar.id = acr.report_id
|
||||
INNER JOIN (
|
||||
SELECT acitem.`name` FROM api_scenario acitem INNER JOIN `schedule` sc ON acitem.id = sc.resource_id
|
||||
) ac on acr.content like CONCAT('%"', ac.`name`,'"%')
|
||||
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
|
||||
WHERE acr.project_id = #{projectId}
|
||||
</select>
|
||||
</mapper>
|
|
@ -38,17 +38,17 @@
|
|||
|
||||
<select id="countTaskByProjectId" resultType="java.lang.Long">
|
||||
SELECT COUNT(id) AS countNumber FROM `schedule` WHERE resource_id IN (
|
||||
SELECT id FROM api_test WHERE project_id = #{0,jdbcType=VARCHAR}
|
||||
SELECT id FROM api_test WHERE project_id = #{0,jdbcType=VARCHAR} AND status != 'Trash'
|
||||
UNION
|
||||
SELECT id FROM api_scenario WHERE project_id = #{0,jdbcType=VARCHAR}
|
||||
SELECT id FROM api_scenario WHERE project_id = #{0,jdbcType=VARCHAR} AND status != 'Trash'
|
||||
)
|
||||
</select>
|
||||
<select id="countTaskByProjectIdAndCreateTimeRange" resultType="java.lang.Long">
|
||||
SELECT COUNT(id) AS countNumber FROM `schedule`
|
||||
WHERE 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 status != 'Trash'
|
||||
UNION
|
||||
SELECT id FROM api_scenario WHERE project_id = #{projectId,jdbcType=VARCHAR}
|
||||
SELECT id FROM api_scenario WHERE project_id = #{projectId,jdbcType=VARCHAR} AND status != 'Trash'
|
||||
)
|
||||
AND create_time BETWEEN #{startTime} and #{endTime}
|
||||
</select>
|
||||
|
@ -61,8 +61,8 @@
|
|||
UNION
|
||||
SELECT apiScene.`name` AS scenario,sch.id AS taskID,sch.`value` AS rule,sch.`enable` AS `taskStatus`,u.`name` AS creator,sch.update_time AS updateTime
|
||||
FROM api_scenario apiScene
|
||||
INNER JOIN `schedule` sch ON apiScene.id = sch.resource_id
|
||||
INNER JOIN `user` u ON u.id = sch.user_id
|
||||
INNER JOIN `schedule` sch ON apiScene.id = sch.resource_id
|
||||
INNER JOIN `user` u ON u.id = sch.user_id
|
||||
WHERE sch.`enable` = true AND apiScene.project_id = #{0,jdbcType=VARCHAR}
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue