Skip to content

Commit

Permalink
fix: robot pass rate
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhouYixun committed Aug 27, 2022
1 parent 82a8885 commit 28f5e84
Showing 1 changed file with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ private void signAndSend(String token, String secret, int type, JSONObject jsonO
}
case RobotType.WeChat: {
ResponseEntity<JSONObject> responseEntity =
restTemplate.postForEntity(token , jsonObject, JSONObject.class);
restTemplate.postForEntity(token, jsonObject, JSONObject.class);
logger.info("robot result: " + responseEntity.getBody());
}

break;
break;
case RobotType.FeiShu: {

if (!StringUtils.isEmpty(secret)) {
Expand Down Expand Up @@ -161,7 +161,7 @@ public void sendResultFinishReport(String token, String secret, String suiteName
if (type == RobotType.WeChat) {
jsonObject.put("msgtype", "markdown");
JSONObject markdown = new JSONObject();
markdown.put("content", "**测试套件: " + suiteName + " 运行完毕!**\n" +
markdown.put("content", "**测试套件: " + suiteName + " 运行完毕!**\n" +
"通过数:" + pass + " \n" +
"异常数:" + warn + " \n" +
"失败数:" + fail + "\n" +
Expand Down Expand Up @@ -267,7 +267,7 @@ public void sendDayReportMessage(String token, String secret, int projectId, Str
"> ###### 异常数:" + warnColorString + " \n" +
"> ###### 失败数:" + failColorString + " \n" +
"> ###### 测试通过率:" + (total > 0 ?
new BigDecimal((float) passCount / total).setScale(2, RoundingMode.HALF_UP).doubleValue() : 0) + "% \n" +
new BigDecimal((float) passCount / total).setScale(2, RoundingMode.HALF_UP).doubleValue() * 100 : 0) + "% \n" +
"> ###### 详细统计:[点击查看](" + clientHost + "/Home/" + projectId + ")");
markdown.put("title", "Sonic云真机测试平台日报");
jsonObject.put("msgtype", "markdown");
Expand All @@ -290,14 +290,14 @@ public void sendDayReportMessage(String token, String secret, int projectId, Str
jsonObject.put("msgtype", "markdown");
JSONObject markdown = new JSONObject();
markdown.put("content", "### Sonic云真机测试平台日报 \n" +
"> ###### 项目:" + projectName + " \n" +
"> ###### 时间:" + yesterday + " ~ " + today + " \n" +
"> ###### 通过数:<font color=\"info\">" + passCount + "</font> \n" +
"> ###### 异常数:" + warnColorString + " \n" +
"> ###### 失败数:" + failColorString + " \n" +
"> ###### 测试通过率:" + (total > 0 ?
new BigDecimal((float) passCount / total).setScale(2, RoundingMode.HALF_UP).doubleValue() : 0) + "% \n" +
"> ###### 详细统计:[点击查看](" + clientHost + "/Home/" + projectId + ")");
"> ###### 项目:" + projectName + " \n" +
"> ###### 时间:" + yesterday + " ~ " + today + " \n" +
"> ###### 通过数:<font color=\"info\">" + passCount + "</font> \n" +
"> ###### 异常数:" + warnColorString + " \n" +
"> ###### 失败数:" + failColorString + " \n" +
"> ###### 测试通过率:" + (total > 0 ?
new BigDecimal((float) passCount / total).setScale(2, RoundingMode.HALF_UP).doubleValue() * 100 : 0) + "% \n" +
"> ###### 详细统计:[点击查看](" + clientHost + "/Home/" + projectId + ")");
jsonObject.put("markdown", markdown);
}
if (type == RobotType.FeiShu) {
Expand All @@ -317,7 +317,7 @@ public void sendDayReportMessage(String token, String secret, int projectId, Str
"异常数:" + warnCount + " \n" +
"失败数:" + failCount + " \n" +
"测试通过率:" + (total > 0 ?
new BigDecimal((float) passCount / total).setScale(2, RoundingMode.HALF_UP).doubleValue() : 0) + "% \n" +
new BigDecimal((float) passCount / total).setScale(2, RoundingMode.HALF_UP).doubleValue() * 100 : 0) + "% \n" +
"详细统计:[点击查看](" + clientHost + "/Home/" + projectId + ")");
elementList.add(element);
card.put("elements", elementList);
Expand Down Expand Up @@ -413,7 +413,7 @@ public void sendWeekReportMessage(String token, String secret, int projectId, St
"> ###### 异常数:" + warnColorString + " \n" +
"> ###### 失败数:" + failColorString + " \n" +
"> ###### 测试通过率:" + (total > 0 ?
new BigDecimal((float) passCount / total).setScale(2, RoundingMode.HALF_UP).doubleValue() : 0) + "% \n" +
new BigDecimal((float) passCount / total).setScale(2, RoundingMode.HALF_UP).doubleValue() * 100 : 0) + "% \n" +
"> ###### 详细统计:[点击查看](" + clientHost + "/Home/" + projectId + ")");
markdown.put("title", "Sonic云真机测试平台周报");
jsonObject.put("msgtype", "markdown");
Expand Down Expand Up @@ -443,7 +443,7 @@ public void sendWeekReportMessage(String token, String secret, int projectId, St
"> ###### 异常数:" + warnColorString + " \n" +
"> ###### 失败数:" + failColorString + " \n" +
"> ###### 测试通过率:" + (total > 0 ?
new BigDecimal((float) passCount / total).setScale(2, RoundingMode.HALF_UP).doubleValue() : 0) + "% \n" +
new BigDecimal((float) passCount / total).setScale(2, RoundingMode.HALF_UP).doubleValue() * 100 : 0) + "% \n" +
"> ###### 详细统计:[点击查看](" + clientHost + "/Home/" + projectId + ")");
jsonObject.put("markdown", markdown);
}
Expand All @@ -466,7 +466,7 @@ public void sendWeekReportMessage(String token, String secret, int projectId, St
"异常数:" + warnCount + " \n" +
"失败数:" + failCount + " \n" +
"测试通过率:" + (total > 0 ?
new BigDecimal((float) passCount / total).setScale(2, RoundingMode.HALF_UP).doubleValue() : 0) + "% \n" +
new BigDecimal((float) passCount / total).setScale(2, RoundingMode.HALF_UP).doubleValue() * 100 : 0) + "% \n" +
"详细统计:[点击查看](" + clientHost + "/Home/" + projectId + ")");
elementList.add(element);
card.put("elements", elementList);
Expand Down

0 comments on commit 28f5e84

Please sign in to comment.