From 585f47c49b33b643404d148f60e9dfd68d2abddf Mon Sep 17 00:00:00 2001 From: Osanda Deshan Date: Wed, 16 Feb 2022 13:54:38 +0530 Subject: [PATCH 1/2] Updated smtp and mailapi to support new TLS version | Updated Gauge Java language runner | Code refactored --- pom.xml | 100 ++++++++--------- .../java/com/maxsoft/greporter/Constants.java | 3 + .../maxsoft/greporter/JsonReportReader.java | 101 ++++++++---------- .../com/maxsoft/greporter/chart/BarChart.java | 8 +- .../com/maxsoft/greporter/chart/PieChart.java | 11 +- .../greporter/email/EmailProcessor.java | 101 ++++++++---------- .../greporter/email/EmailTemplate.java | 48 +++++---- 7 files changed, 174 insertions(+), 198 deletions(-) diff --git a/pom.xml b/pom.xml index 298114b..af8c304 100644 --- a/pom.xml +++ b/pom.xml @@ -6,13 +6,57 @@ com.maxsoft.greporter maxsoft-greporter - 1.0.7 + 1.0.8 + + + + + org.codehaus.mojo + exec-maven-plugin + 3.0.0 + + + + java + + + + + com.maxsoft.greporter.email.EmailSender + + + + com.thoughtworks.gauge.maven + gauge-maven-plugin + 1.4.3 + + + org.apache.maven.plugins + maven-jar-plugin + 3.2.0 + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 8 + 8 + + + + com.thoughtworks.gauge gauge-java - 0.7.13 + 0.7.15 org.knowm.xchart @@ -27,12 +71,12 @@ com.sun.mail smtp - 1.4.4 + 2.0.1 com.sun.mail mailapi - 1.4.4 + 2.0.1 org.testng @@ -51,54 +95,10 @@ 1.1.1 - - + + src/main/java dev - - - - org.codehaus.mojo - exec-maven-plugin - 3.0.0 - - - - java - - - - - com.maxsoft.greporter.email.EmailSender - - - - com.thoughtworks.gauge.maven - gauge-maven-plugin - 1.4.3 - - - org.apache.maven.plugins - maven-jar-plugin - 3.2.0 - - - org.apache.maven.plugins - maven-surefire-plugin - 2.22.2 - - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.1 - - 8 - 8 - - - - - diff --git a/src/main/java/com/maxsoft/greporter/Constants.java b/src/main/java/com/maxsoft/greporter/Constants.java index 1c3100c..398665e 100644 --- a/src/main/java/com/maxsoft/greporter/Constants.java +++ b/src/main/java/com/maxsoft/greporter/Constants.java @@ -13,6 +13,7 @@ public class Constants { + // Directory and File Path Constants public static final String CURRENT_DIRECTORY = System.getProperty("user.dir"); public static final String FILE_SEPARATOR = File.separator; public static final String PIE_CHART_PROPERTY_FILE_PATH = CURRENT_DIRECTORY + FILE_SEPARATOR + "env" @@ -23,6 +24,8 @@ public class Constants { + FILE_SEPARATOR + "email" + FILE_SEPARATOR + "email.properties"; public static final String JSON_FILE_PATH = System.getProperty("user.dir") + FILE_SEPARATOR + "reports" + FILE_SEPARATOR + "json-report" + FILE_SEPARATOR + "result.json"; + + // Color Code Constants public static final String GREEN = "green"; public static final String RED = "red"; public static final String GRAY = "#43433D"; diff --git a/src/main/java/com/maxsoft/greporter/JsonReportReader.java b/src/main/java/com/maxsoft/greporter/JsonReportReader.java index 758e705..2c30d06 100644 --- a/src/main/java/com/maxsoft/greporter/JsonReportReader.java +++ b/src/main/java/com/maxsoft/greporter/JsonReportReader.java @@ -30,6 +30,12 @@ public class JsonReportReader { private static final DecimalFormat decimalFormat = new DecimalFormat(".##"); + private static final List passedScenarioCountList = new ArrayList<>(); + private static final List failedScenarioCountList = new ArrayList<>(); + private static final List skippedScenarioCountList = new ArrayList<>(); + private static final List passedScenariosPercentageList = new ArrayList<>(); + private static final List failedScenariosPercentageList = new ArrayList<>(); + private static final List skippedScenariosPercentageList = new ArrayList<>(); public static String getProjectName() { return getJsonAttributeValueAsString("$.projectName"); @@ -135,93 +141,70 @@ public static List getSpecHeadingList() { return specHeadingList; } - public static List getPassedScenarioCountList() { - List passedScenarioCountList = new ArrayList<>(); - + public static void setScenarioExecutionStatusAsCounts() { for (Object object : getSpecResultsAsJsonArray()) { - JSONObject jsonObject1 = (JSONObject) object; - String passedScenarioCount = jsonObject1.get("passedScenarioCount").toString(); + JSONObject jsonObject = (JSONObject) object; + + String passedScenarioCount = jsonObject.get("passedScenarioCount").toString(); + String failedScenarioCount = jsonObject.get("failedScenarioCount").toString(); + String skippedScenarioCount = jsonObject.get("skippedScenarioCount").toString(); + passedScenarioCountList.add(passedScenarioCount); + failedScenarioCountList.add(failedScenarioCount); + skippedScenarioCountList.add(skippedScenarioCount); } - return passedScenarioCountList; } - public static List getPassedScenarioPercentageList() { - List passedScenariosPercentageList = new ArrayList<>(); - - for (Object object : getSpecResultsAsJsonArray()) { - JSONObject jsonObject1 = (JSONObject) object; - int passedScenarioCount = Integer.parseInt(jsonObject1.get("passedScenarioCount").toString()); - int failedScenarioCount = Integer.parseInt(jsonObject1.get("failedScenarioCount").toString()); - int skippedScenarioCount = Integer.parseInt(jsonObject1.get("skippedScenarioCount").toString()); - int totalScenarioCount = passedScenarioCount + failedScenarioCount + skippedScenarioCount; - double passedScenariosPercentage = 0; - if (totalScenarioCount != 0) { - passedScenariosPercentage = Double.parseDouble(decimalFormat - .format((double) (passedScenarioCount * 100) / (double) totalScenarioCount)); - } - passedScenariosPercentageList.add(passedScenariosPercentage + "%"); - } - return passedScenariosPercentageList; + public static List getPassedScenarioCountList() { + return passedScenarioCountList; } public static List getFailedScenarioCountList() { - List failedScenarioCountList = new ArrayList<>(); - - for (Object object : getSpecResultsAsJsonArray()) { - JSONObject jsonObject1 = (JSONObject) object; - String failedScenarioCount = jsonObject1.get("failedScenarioCount").toString(); - failedScenarioCountList.add(failedScenarioCount); - } return failedScenarioCountList; } - public static List getFailedScenarioPercentageList() { - List failedScenariosPercentageList = new ArrayList<>(); - - for (Object object : getSpecResultsAsJsonArray()) { - JSONObject jsonObject1 = (JSONObject) object; - int passedScenarioCount = Integer.parseInt(jsonObject1.get("passedScenarioCount").toString()); - int failedScenarioCount = Integer.parseInt(jsonObject1.get("failedScenarioCount").toString()); - int skippedScenarioCount = Integer.parseInt(jsonObject1.get("skippedScenarioCount").toString()); - int totalScenarioCount = passedScenarioCount + failedScenarioCount + skippedScenarioCount; - double failedScenariosPercentage = 0; - if (totalScenarioCount != 0) { - failedScenariosPercentage = Double.parseDouble(decimalFormat - .format((double) (failedScenarioCount * 100) / (double) totalScenarioCount)); - } - failedScenariosPercentageList.add(failedScenariosPercentage + "%"); - } - return failedScenariosPercentageList; - } - public static List getSkippedScenarioCountList() { - List skippedScenarioCountList = new ArrayList<>(); - - for (Object object : getSpecResultsAsJsonArray()) { - JSONObject jsonObject1 = (JSONObject) object; - String skippedScenarioCount = jsonObject1.get("skippedScenarioCount").toString(); - skippedScenarioCountList.add(skippedScenarioCount); - } return skippedScenarioCountList; } - public static List getSkippedScenarioPercentageList() { - List skippedScenariosPercentageList = new ArrayList<>(); - + public static void setScenarioExecutionStatusAsPercentages() { for (Object object : getSpecResultsAsJsonArray()) { JSONObject jsonObject = (JSONObject) object; + int passedScenarioCount = Integer.parseInt(jsonObject.get("passedScenarioCount").toString()); int failedScenarioCount = Integer.parseInt(jsonObject.get("failedScenarioCount").toString()); int skippedScenarioCount = Integer.parseInt(jsonObject.get("skippedScenarioCount").toString()); + int totalScenarioCount = passedScenarioCount + failedScenarioCount + skippedScenarioCount; + + double passedScenariosPercentage = 0; + double failedScenariosPercentage = 0; double skippedScenariosPercentage = 0; + if (totalScenarioCount != 0) { + passedScenariosPercentage = Double.parseDouble(decimalFormat + .format((double) (passedScenarioCount * 100) / (double) totalScenarioCount)); + failedScenariosPercentage = Double.parseDouble(decimalFormat + .format((double) (failedScenarioCount * 100) / (double) totalScenarioCount)); skippedScenariosPercentage = Double.parseDouble(decimalFormat .format((double) (skippedScenarioCount * 100) / (double) totalScenarioCount)); } + + passedScenariosPercentageList.add(passedScenariosPercentage + "%"); + failedScenariosPercentageList.add(failedScenariosPercentage + "%"); skippedScenariosPercentageList.add(skippedScenariosPercentage + "%"); } + } + + public static List getPassedScenarioPercentageList() { + return passedScenariosPercentageList; + } + + public static List getFailedScenarioPercentageList() { + return failedScenariosPercentageList; + } + + public static List getSkippedScenarioPercentageList() { return skippedScenariosPercentageList; } diff --git a/src/main/java/com/maxsoft/greporter/chart/BarChart.java b/src/main/java/com/maxsoft/greporter/chart/BarChart.java index e7750ea..bc06017 100644 --- a/src/main/java/com/maxsoft/greporter/chart/BarChart.java +++ b/src/main/java/com/maxsoft/greporter/chart/BarChart.java @@ -21,10 +21,10 @@ import java.io.File; import java.io.IOException; -import static com.maxsoft.greporter.util.PropertyReader.read; import static com.maxsoft.greporter.Constants.BAR_CHART_PROPERTY_FILE_PATH; import static com.maxsoft.greporter.Constants.FILE_SEPARATOR; import static com.maxsoft.greporter.JsonReportReader.*; +import static com.maxsoft.greporter.util.PropertyReader.read; /* Project Name : MaxSoft GReporter @@ -60,6 +60,7 @@ public static void save() { final DefaultCategoryDataset dataset = new DefaultCategoryDataset(); int iterator = getSpecHeadingList().size(); + setScenarioExecutionStatusAsCounts(); for (int i = 0; i < iterator; i++) { dataset.addValue(Integer.valueOf(getFailedScenarioCountList().get(i)), FAILED, getSpecHeadingList().get(i)); @@ -84,8 +85,6 @@ public static void save() { chartPanel.setBackground(Color.WHITE); barChart.getPlot().setBackgroundPaint(LIGHT_GRAY); -// barChart.setBorderVisible(true); -// barChart.setBorderPaint(Color.BLACK); ((AbstractRenderer) plot.getRenderer()).setBaseLegendShape(new Rectangle(20, 20)); LegendTitle legend = barChart.getLegend(); Font labelFont = new Font("SansSerif", Font.BOLD, 14); @@ -116,7 +115,8 @@ public static void save() { // Save it, if the pi-chart directory is not there create it File directory = new File(barChartDir); if (!directory.exists()) { - directory.mkdirs(); + boolean isBarChartDirectoryCreated = directory.mkdirs(); + System.out.println("Is bar chart directory created: " + isBarChartDirectoryCreated); } File BarChart = new File(getSavedBarChartImagePath()); diff --git a/src/main/java/com/maxsoft/greporter/chart/PieChart.java b/src/main/java/com/maxsoft/greporter/chart/PieChart.java index 50ab0c2..f80c270 100644 --- a/src/main/java/com/maxsoft/greporter/chart/PieChart.java +++ b/src/main/java/com/maxsoft/greporter/chart/PieChart.java @@ -9,8 +9,8 @@ import java.io.File; import java.io.IOException; -import static com.maxsoft.greporter.util.PropertyReader.read; import static com.maxsoft.greporter.Constants.*; +import static com.maxsoft.greporter.util.PropertyReader.read; /* * Project Name : MaxSoft GReporter @@ -60,22 +60,17 @@ public static void save(int passedCount, int failedCount, int skippedCount) { chart.addSeries("Passed", passedCount).setFillColor(GREEN); chart.addSeries("Skipped", skippedCount).setFillColor(DARK_GRAY); - // Show it - //new SwingWrapper(chart).displayChart(); - // Save it, if the pi-chart directory is not there create it File directory = new File(pieChartDir); if (!directory.exists()) { - directory.mkdirs(); + boolean isPieChartDirectoryCreated = directory.mkdirs(); + System.out.println("Is pie chart directory created: " + isPieChartDirectoryCreated); } try { BitmapEncoder.saveBitmap(chart, imageDir, BitmapEncoder.BitmapFormat.PNG); } catch (IOException e) { e.printStackTrace(); } - - // or save it in high-res - //BitmapEncoder.saveBitmapWithDPI(chart, filePath, BitmapEncoder.BitmapFormat.PNG, 300); } public static String getSavedPieChartImageName() { diff --git a/src/main/java/com/maxsoft/greporter/email/EmailProcessor.java b/src/main/java/com/maxsoft/greporter/email/EmailProcessor.java index 8b33bfd..a6264b4 100644 --- a/src/main/java/com/maxsoft/greporter/email/EmailProcessor.java +++ b/src/main/java/com/maxsoft/greporter/email/EmailProcessor.java @@ -2,17 +2,15 @@ import com.maxsoft.greporter.chart.BarChart; import com.maxsoft.greporter.chart.PieChart; -import org.json.simple.parser.ParseException; - -import javax.activation.DataHandler; -import javax.activation.DataSource; -import javax.activation.FileDataSource; -import javax.mail.*; -import javax.mail.internet.InternetAddress; -import javax.mail.internet.MimeBodyPart; -import javax.mail.internet.MimeMessage; -import javax.mail.internet.MimeMultipart; -import java.io.IOException; +import jakarta.activation.DataHandler; +import jakarta.activation.DataSource; +import jakarta.activation.FileDataSource; +import jakarta.mail.*; +import jakarta.mail.internet.InternetAddress; +import jakarta.mail.internet.MimeBodyPart; +import jakarta.mail.internet.MimeMessage; +import jakarta.mail.internet.MimeMultipart; + import java.security.InvalidParameterException; import java.util.Properties; @@ -59,7 +57,7 @@ public static void triggerEmail() { props.put("mail.smtp.port", senderEmailSmtpPort); Session session = Session.getInstance(props, - new javax.mail.Authenticator() { + new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(senderEmailAddress, senderEmailPassword); } @@ -69,20 +67,20 @@ protected PasswordAuthentication getPasswordAuthentication() { // Create a default MimeMessage object. Message message = new MimeMessage(session); - // Set From: header field of the header. + // Set From: Header field of the header. message.setFrom(new InternetAddress(senderEmailAddress)); - // Set To: header field of the header. + // Set To: Header field of the header. message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(recipientsEmailAddresses)); - // Set Subject: header field + // Set Subject: Header field message.setSubject(emailSubject); // This mail has 2 parts, the BODY and the embedded image MimeMultipart multipart = new MimeMultipart("related"); - // first part (the html) + // First part (The html) BodyPart messageBodyPart = new MimeBodyPart(); String htmlText = "

Test Execution Status: " + "" + getExecutionStatus() @@ -90,10 +88,11 @@ protected PasswordAuthentication getPasswordAuthentication() { + emailBodyTitleHeadingSize + ">" + "
" + emailBody + "


" + getExecutionResults(); messageBodyPart.setContent(htmlText, "text/html"); - // add it + + // Add the HTMl to the multipart multipart.addBodyPart(messageBodyPart); - // second part (the pie chart) + // Second part (The pie chart) messageBodyPart = new MimeBodyPart(); PieChart.save(getPassedScenariosCount(), getFailedScenariosCount(), getSkippedScenariosCount()); DataSource fds = new FileDataSource( @@ -103,10 +102,10 @@ protected PasswordAuthentication getPasswordAuthentication() { messageBodyPart.setHeader("Content-ID", ""); messageBodyPart.setFileName(PieChart.getSavedPieChartImageName()); - // add pie chart to the multipart + // Add pie chart to the multipart multipart.addBodyPart(messageBodyPart); - // third part (the bar chart) + // Third part (The bar chart) messageBodyPart = new MimeBodyPart(); BarChart.save(); DataSource fds2 = new FileDataSource( @@ -116,14 +115,14 @@ protected PasswordAuthentication getPasswordAuthentication() { messageBodyPart.setHeader("Content-ID", ""); messageBodyPart.setFileName(BarChart.getSavedBarChartImageName()); - // add bar chart to the multipart + // Add bar chart to the multipart multipart.addBodyPart(messageBodyPart); - // put everything together + // Put everything together message.setContent(multipart); + // Send message Transport.send(message); - System.out.println("Sent message successfully...."); } catch (MessagingException e) { @@ -137,37 +136,31 @@ protected PasswordAuthentication getPasswordAuthentication() { } private static String getExecutionResults() { - String executionResults = null; - try { - executionResults = EmailTemplate.get() - .replaceAll("#projectName", getProjectName()) - .replaceAll("#timestamp", getTimestamp()) - .replaceAll("#environment", getEnvironment()) - .replaceAll("#executionTime", milliSecondsToTime(getExecutionTime())) - .replaceAll("#executionStatus", getExecutionStatus()) - .replaceAll("#executionColor", getExecutionStatusColor()) - .replaceAll("#successRate", getPassedScenariosPercentage() + "%") - .replaceAll("#failRate", getFailedScenariosPercentage() + "%") - - .replaceAll("#totalScenariosCount", String.valueOf(getTotalScenariosCount())) - .replaceAll("#passedScenariosCount", String.valueOf(getPassedScenariosCount())) - .replaceAll("#passedScenarioPercentage", getPassedScenariosPercentage() + "%") - .replaceAll("#failedScenariosCount", String.valueOf(getFailedScenariosCount())) - .replaceAll("#failedScenarioPercentage", getFailedScenariosPercentage() + "%") - .replaceAll("#skippedScenariosCount", String.valueOf(getSkippedScenariosCount())) - .replaceAll("#skippedScenarioPercentage", getSkippedScenariosPercentage() + "%") - - .replaceAll("#totalSpecsCount", String.valueOf(getTotalSpecsCount())) - .replaceAll("#passedSpecsCount", String.valueOf(getPassedSpecsCount())) - .replaceAll("#passedSpecsPercentage", getPassedSpecsPercentage() + "%") - .replaceAll("#failedSpecsCount", String.valueOf(getFailedSpecsCount())) - .replaceAll("#failedSpecsPercentage", getFailedSpecsPercentage() + "%") - .replaceAll("#skippedSpecsCount", String.valueOf(getSkippedSpecsCount())) - .replaceAll("#skippedSpecsPercentage", getSkippedSpecsPercentage() + "%"); - } catch (IOException | ParseException e) { - e.printStackTrace(); - } - return executionResults; + return EmailTemplate.getTemplate() + .replaceAll("#projectName", getProjectName()) + .replaceAll("#timestamp", getTimestamp()) + .replaceAll("#environment", getEnvironment()) + .replaceAll("#executionTime", milliSecondsToTime(getExecutionTime())) + .replaceAll("#executionStatus", getExecutionStatus()) + .replaceAll("#executionColor", getExecutionStatusColor()) + .replaceAll("#successRate", getPassedScenariosPercentage() + "%") + .replaceAll("#failRate", getFailedScenariosPercentage() + "%") + + .replaceAll("#totalScenariosCount", String.valueOf(getTotalScenariosCount())) + .replaceAll("#passedScenariosCount", String.valueOf(getPassedScenariosCount())) + .replaceAll("#passedScenarioPercentage", getPassedScenariosPercentage() + "%") + .replaceAll("#failedScenariosCount", String.valueOf(getFailedScenariosCount())) + .replaceAll("#failedScenarioPercentage", getFailedScenariosPercentage() + "%") + .replaceAll("#skippedScenariosCount", String.valueOf(getSkippedScenariosCount())) + .replaceAll("#skippedScenarioPercentage", getSkippedScenariosPercentage() + "%") + + .replaceAll("#totalSpecsCount", String.valueOf(getTotalSpecsCount())) + .replaceAll("#passedSpecsCount", String.valueOf(getPassedSpecsCount())) + .replaceAll("#passedSpecsPercentage", getPassedSpecsPercentage() + "%") + .replaceAll("#failedSpecsCount", String.valueOf(getFailedSpecsCount())) + .replaceAll("#failedSpecsPercentage", getFailedSpecsPercentage() + "%") + .replaceAll("#skippedSpecsCount", String.valueOf(getSkippedSpecsCount())) + .replaceAll("#skippedSpecsPercentage", getSkippedSpecsPercentage() + "%"); } private static void setEmailConfigurations() { diff --git a/src/main/java/com/maxsoft/greporter/email/EmailTemplate.java b/src/main/java/com/maxsoft/greporter/email/EmailTemplate.java index a5d8457..dadcfc2 100644 --- a/src/main/java/com/maxsoft/greporter/email/EmailTemplate.java +++ b/src/main/java/com/maxsoft/greporter/email/EmailTemplate.java @@ -1,9 +1,5 @@ package com.maxsoft.greporter.email; -import org.json.simple.parser.ParseException; - -import java.io.IOException; - import static com.maxsoft.greporter.Constants.*; import static com.maxsoft.greporter.JsonReportReader.*; @@ -18,7 +14,7 @@ public class EmailTemplate { - public static String get() throws IOException, ParseException { + public static String getTemplate() { String template = "" + " " + " " + @@ -75,19 +71,19 @@ public static String get() throws IOException, ParseException { " " + " " + " " + - " Passed Scenarios" + - " #passedScenariosCount" + - " #passedScenarioPercentage" + + " Passed Scenarios" + + " #passedScenariosCount" + + " #passedScenarioPercentage" + " " + " " + - " Failed Scenarios" + - " #failedScenariosCount" + - " #failedScenarioPercentage" + + " Failed Scenarios" + + " #failedScenariosCount" + + " #failedScenarioPercentage" + " " + " " + - " Skipped Scenarios" + - " #skippedScenariosCount" + - " #skippedScenarioPercentage" + + " Skipped Scenarios" + + " #skippedScenariosCount" + + " #skippedScenarioPercentage" + " " + " " + " \"Pie


" + @@ -108,19 +104,19 @@ public static String get() throws IOException, ParseException { " " + " " + " " + - " Passed Specifications" + - " #passedSpecsCount" + - " #passedSpecsPercentage" + + " Passed Specifications" + + " #passedSpecsCount" + + " #passedSpecsPercentage" + " " + " " + - " Failed Specifications" + - " #failedSpecsCount" + - " #failedSpecsPercentage" + + " Failed Specifications" + + " #failedSpecsCount" + + " #failedSpecsPercentage" + " " + " " + - " Skipped Specifications" + - " #skippedSpecsCount" + - " #skippedSpecsPercentage" + + " Skipped Specifications" + + " #skippedSpecsCount" + + " #skippedSpecsPercentage" + " " + " " + "

"; @@ -157,6 +153,8 @@ public static String getRegressionTestSummary() { " "; int iterator = getSpecHeadingList().size(); + setScenarioExecutionStatusAsCounts(); + setScenarioExecutionStatusAsPercentages(); String specHeadingColor; String totalScenariosColor; @@ -165,6 +163,7 @@ public static String getRegressionTestSummary() { String skippedScenariosColor; for (int i = 0; i < iterator; i++) { + int totalScenariosOfSpec = Integer.parseInt(getPassedScenarioCountList().get(i)) + Integer.parseInt(getFailedScenarioCountList().get(i)) + Integer.parseInt(getSkippedScenarioCountList().get(i)); @@ -175,18 +174,21 @@ public static String getRegressionTestSummary() { passedScenariosColor = GREEN; failedScenariosColor = GREEN; skippedScenariosColor = GREEN; + } else if (totalScenariosOfSpec == Integer.parseInt(getFailedScenarioCountList().get(i))) { specHeadingColor = RED; totalScenariosColor = RED; passedScenariosColor = RED; failedScenariosColor = RED; skippedScenariosColor = RED; + } else if (totalScenariosOfSpec == Integer.parseInt(getSkippedScenarioCountList().get(i))) { specHeadingColor = GRAY; totalScenariosColor = GRAY; passedScenariosColor = GRAY; failedScenariosColor = GRAY; skippedScenariosColor = GRAY; + } else { specHeadingColor = BLACK; totalScenariosColor = BLACK; From 4389a373266f1d96179f712bcd9a85a74b4fe8a6 Mon Sep 17 00:00:00 2001 From: Osanda Deshan Date: Wed, 16 Feb 2022 14:01:23 +0530 Subject: [PATCH 2/2] Updated POM version and ReadMe --- ReadMe.md | 63 +++++++++++++++++++++++++++---------------------------- pom.xml | 2 +- 2 files changed, 32 insertions(+), 33 deletions(-) diff --git a/ReadMe.md b/ReadMe.md index 6931e7b..67b7879 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1,5 +1,4 @@ # MaxSoft GReporter -
## Introduction In testing perspective, the test execution report is a vital document where the stakeholders can get an idea of the project health. @@ -9,7 +8,6 @@ Gauge is proving a detailed test execution report with all the error messages an But anyhow, QA should manually send the test execution report to the stakeholders by mentioning the number of scenarios executed, passed count, failed count and skipped count. Also in a regression cycle, QA has to send those counts as module wise figures. Further, QA needs to embed pie charts and bar charts to that report to represents the test execution data in a high readable manner. MaxSoft GReporter is an automated solution for this issue. It acts as a Java plugin for gauge to send the test execution summary to a defined audience. -

## Technologies/Frameworks used - Java @@ -22,65 +20,72 @@ MaxSoft GReporter is an automated solution for this issue. It acts as a Java plu - MailAPI - TestNG - Apache Maven -
## Supported Platforms - Windows - Linux - Mac OS -
## Supported Languages - Java -
## Advantages - Automated emails for test execution summary with graphical representations. -
## Pre Requisites 1. Java 2. Maven -
## How to Install Gauge Core - **On Windows** -1. Install Chocolatey by executing the following command. \ +1. Install Chocolatey by executing the following command. + ` @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString(‘https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"` -2. Install Gauge by executing the following command. \ +2. Install Gauge by executing the following command. + `choco install gauge` **On MacOS** -1. Update Homebrew. \ +1. Update Homebrew. + `brew update` -2. Install Gauge using Homebrew. \ +2. Install Gauge using Homebrew. + `brew install gauge` **On Linux** -1. First, add Gauge’s GPG key with this command. \ +1. First, add Gauge’s GPG key with this command. + `sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-keys 023EDB0B` -2. Then add Gauge to the repository list using this command. \ +2. Then add Gauge to the repository list using this command. + `echo deb https://dl.bintray.com/gauge/gauge-deb nightly main | sudo tee -a /etc/apt/sources.list` -3. Finally, install Gauge using these commands. \ -`sudo apt-get update` \ +3. Finally, install Gauge using these commands. + +`sudo apt-get update` `sudo apt-get install gauge` -
## How to Install Gauge Plugins -1. Open Command Prompt and execute following commands. \ -`gauge install java` \ -`gauge install html-report` \ -`gauge install json-report` \ -`gauge install xml-report` \ -`gauge install spectacle` \ +1. Open Command Prompt and execute following commands. + +`gauge install java` + +`gauge install html-report` + +`gauge install json-report` + +`gauge install xml-report` + +`gauge install spectacle` + `gauge install flash` -2. You can check the installation using the following command. \ +2. You can check the installation using the following command. + `gauge -v` If the installation is success, it will output like this: @@ -96,11 +101,9 @@ MaxSoft GReporter is an automated solution for this issue. It acts as a Java plu spectacle () xml-report () ``` -
## MaxSoft GReporter Tutorials - [MaxSoft GReporter](https://medium.com/greporter/maxsoft-email-client-for-gauge-8ae8af8ad32f) -
## How to use MaxSoft GReporter? 1. Clone this gauge project into your computer @@ -111,22 +114,18 @@ MaxSoft GReporter is an automated solution for this issue. It acts as a Java plu 6. Change the properties and Save it 7. Open **"barchart.properties"** file (`\env\chart\barchart.properties`) from notepad 8. Change the properties and Save it -9. Double click on **"TestRunner.bat"** which is in the root directory +9. Double-click on **"TestRunner.bat"** which is in the root directory 10. After the execution is completed, GReporter will push an email to the given audience including the test execution summary ![GReporter v1.0.3](https://i.imgur.com/xEovMLC.png) -
## How to build MaxSoft GReporter JAR File? 1. Open the command prompt 2. Navigate to the directory of the project (`cd `) 3. Execute this command `mvn clean install -DskipTests` -
## License MIT License [MaxSoft GReporter](https://medium.com/greporter) is released under [MIT License](https://opensource.org/licenses/MIT) -
- ## Copyright -Copyright 2021 MaxSoft. +Copyright 2022 MaxSoft. diff --git a/pom.xml b/pom.xml index af8c304..4bbfbd1 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.maxsoft.greporter maxsoft-greporter - 1.0.8 + 1.1.0