Skip to content

Commit

Permalink
Merge pull request #1531 from nandhu-kumar/develop
Browse files Browse the repository at this point in the history
MOSIP-34310
  • Loading branch information
lsivanand authored Jul 18, 2024
2 parents d087771 + 4f4fdf8 commit 85e9e27
Showing 1 changed file with 32 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -293,7 +294,7 @@ protected void writeSuiteSummary() {
if (ConfigManager.reportIgnoredTestCases()) {
writer.print("<th># Ignored</th>");
}
writer.print("<th>Time (ms)</th>");
writer.print("<th>Execution Time (ms)</th>");
// writer.print("<th>Included Groups</th>");
// writer.print("<th>Excluded Groups</th>");
writer.print(GlobalConstants.TR);
Expand Down Expand Up @@ -427,10 +428,9 @@ protected void writeScenarioSummary() {
writer.print("<table id='summary'>");
writer.print("<thead>");
writer.print("<tr>");
// writer.print("<th>Class</th>");
writer.print("<th>Method</th>");
// writer.print("<th>Start</th>");
writer.print("<th>Time (ms)</th>");
writer.print("<th>Test Case</th>");
writer.print("<th>Test Case Description</th>");
writer.print("<th>Execution Time (ms)</th>");
writer.print(GlobalConstants.TR);
writer.print("</thead>");

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -505,6 +519,7 @@ private int writeScenarioSummary(String description, List<ClassResult> 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;
Expand All @@ -514,18 +529,19 @@ private int writeScenarioSummary(String description, List<ClassResult> classResu

}
buffer.append("<td style=\"text-align:center;\"><a href=\"#m").append(scenarioIndex).append("\">")
.append(methodName).append("</a></td>")
.append("<td style=\"text-align:center;\" rowspan=\"").append(resultsCount).append("\">")
.append(duration).append("</td></tr>");
.append(methodName).append("</a></td>").append("<td style=\"text-align:center;\">")
.append(testCaseDescription).append("</td>")
.append("<td style=\"text-align:center;\" rowspan=\"").append(resultsCount).append("\">")
.append(duration).append("</td></tr>");

scenarioIndex++;
for (int i = 1; i < resultsCount; i++) {
buffer.append("<tr class=\"").append(cssClass).append("\">")
.append("<td style=\"text-align:center;\"><a href=\"#m").append(scenarioIndex)
.append("\">").append(methodName).append("</a></td></tr>");
scenarioIndex++;
}
scenarioIndex++;

for (int i = 1; i < resultsCount; i++) {
buffer.append("<tr class=\"").append(cssClass).append("\">")
.append("<td style=\"text-align:center;\"><a href=\"#m").append(scenarioIndex)
.append("\">").append(methodName).append("</a></td></tr>");
scenarioIndex++;
}

scenariosPerClass += resultsCount;
methodIndex++;
Expand Down

0 comments on commit 85e9e27

Please sign in to comment.