From 28f5e8406e388e0fdf7cdab68c3855fdfacea761 Mon Sep 17 00:00:00 2001 From: ZhouYixun <291028775@qq.com> Date: Sat, 27 Aug 2022 23:37:10 +0800 Subject: [PATCH] fix: robot pass rate --- .../sonic/controller/tools/RobotMsgTool.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/sonic-server-controller/src/main/java/org/cloud/sonic/controller/tools/RobotMsgTool.java b/sonic-server-controller/src/main/java/org/cloud/sonic/controller/tools/RobotMsgTool.java index edfd57bc..04600cf8 100644 --- a/sonic-server-controller/src/main/java/org/cloud/sonic/controller/tools/RobotMsgTool.java +++ b/sonic-server-controller/src/main/java/org/cloud/sonic/controller/tools/RobotMsgTool.java @@ -92,11 +92,11 @@ private void signAndSend(String token, String secret, int type, JSONObject jsonO } case RobotType.WeChat: { ResponseEntity 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)) { @@ -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" + @@ -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"); @@ -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" + - "> ###### 通过数:" + passCount + " \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" + + "> ###### 通过数:" + passCount + " \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) { @@ -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); @@ -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"); @@ -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); } @@ -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);