From 18c79d55c253544056171364ffad04bf664265a3 Mon Sep 17 00:00:00 2001 From: Nandhukumar Date: Thu, 18 Jul 2024 17:16:33 +0530 Subject: [PATCH] MOSIP-34310 Signed-off-by: Nandhukumar --- .../apirig/report/EmailableReport.java | 48 ++++++++++++------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/apitest-commons/src/main/java/io/mosip/testrig/apirig/report/EmailableReport.java b/apitest-commons/src/main/java/io/mosip/testrig/apirig/report/EmailableReport.java index 5820daa44c..c11e7a98d3 100644 --- a/apitest-commons/src/main/java/io/mosip/testrig/apirig/report/EmailableReport.java +++ b/apitest-commons/src/main/java/io/mosip/testrig/apirig/report/EmailableReport.java @@ -31,6 +31,7 @@ import org.testng.log4testng.Logger; import org.testng.xml.XmlSuite; +import io.mosip.testrig.apirig.dto.TestCaseDTO; import io.mosip.testrig.apirig.utils.AdminTestUtil; import io.mosip.testrig.apirig.utils.ConfigManager; import io.mosip.testrig.apirig.utils.GlobalConstants; @@ -293,7 +294,7 @@ protected void writeSuiteSummary() { if (ConfigManager.reportIgnoredTestCases()) { writer.print("# Ignored"); } - writer.print("Time (ms)"); + writer.print("Execution Time (ms)"); // writer.print("Included Groups"); // writer.print("Excluded Groups"); writer.print(GlobalConstants.TR); @@ -427,10 +428,9 @@ protected void writeScenarioSummary() { writer.print(""); writer.print(""); writer.print(""); -// writer.print(""); - writer.print(""); -// writer.print(""); - writer.print(""); + writer.print(""); + writer.print(""); + writer.print(""); writer.print(GlobalConstants.TR); writer.print(""); @@ -477,6 +477,20 @@ protected void writeScenarioSummary() { writer.print(GlobalConstants.TABLE); } + + private String getTestCaseDescription(ITestResult result) { + Object[] parameters = result.getParameters(); + if (parameters != null && parameters.length > 0 && parameters[0] instanceof TestCaseDTO) { + TestCaseDTO testCase = (TestCaseDTO) parameters[0]; + System.out.println("Test Case Name: " + testCase.getDescription()); + if (testCase.getDescription() == null) + return ""; + else + return testCase.getDescription(); + } + + return ""; + } /** * Writes the scenario summary for the results of a given state for a single @@ -505,6 +519,7 @@ private int writeScenarioSummary(String description, List classResu assert resultsCount > 0; ITestResult firstResult = results.iterator().next(); + String testCaseDescription = getTestCaseDescription(firstResult); String methodName = Utils.escapeHtml(firstResult.getMethod().getMethodName()); long start = firstResult.getStartMillis(); long duration = firstResult.getEndMillis() - start; @@ -514,18 +529,19 @@ private int writeScenarioSummary(String description, List classResu } buffer.append("") - .append(""); + .append(methodName).append("").append("") + .append(""); - scenarioIndex++; - - for (int i = 1; i < resultsCount; i++) { - buffer.append("") - .append(""); - scenarioIndex++; - } + scenarioIndex++; + + for (int i = 1; i < resultsCount; i++) { + buffer.append("") + .append(""); + scenarioIndex++; + } scenariosPerClass += resultsCount; methodIndex++;
ClassMethodStartTime (ms)Test CaseTest Case DescriptionExecution Time (ms)
") - .append(methodName).append("") - .append(duration).append("
") + .append(testCaseDescription).append("") + .append(duration).append("
").append(methodName).append("
").append(methodName).append("