ITestNGMethod[] methods = sr.getTestContext().getAllTestMethods();
methodCount += Utils.calculateInvokedMethodCount(methods);
// Collect testClasses
for (ITestNGMethod tm : methods) {
ITestClass tc = tm.getTestClass();
m_classes.put(tc.getRealClass().getName(), tc);
}
}
String name = "Results for " + suite.getName();
tableOfContents
.append("<html>\n")
.append("<head>\n")
.append("<title>" + name + "</title>\n")
.append(HtmlHelper.getCssString())
.append("</head>\n")
;
tableOfContents
.append("<body>\n")
.append("<h3><p align=\"center\">" + makeTitle(suite) + "</p></h3>\n")
.append("<table border='1' width='100%'>\n")
.append("<tr valign='top'>\n")
.append("<td>")
.append(suiteResults.size()).append(" ").append(pluralize(suiteResults.size(), "test"))
.append("</td>\n")
.append("<td>")
.append("<a target='mainFrame' href='").append(CLASSES).append("'>")
.append(m_classes.size() + " " + pluralize(m_classes.size(), "class"))
.append("</a>")
.append("</td>\n")
.append("<td>" + methodCount + " " + pluralize(methodCount, "method") + ":<br/>\n")
.append(" <a target='mainFrame' href='").append(METHODS_CHRONOLOGICAL).append("'>").append("chronological</a><br/>\n")
.append(" <a target='mainFrame' href='").append(METHODS_ALPHABETICAL).append("\'>").append("alphabetical</a><br/>\n")
.append(" <a target='mainFrame' href='").append(METHODS_NOT_RUN).append("'>not run (" + suite.getExcludedMethods().size() + ")</a>")
.append("</td>\n")
.append("</tr>\n")
.append("<tr>\n")
.append("<td><a target='mainFrame' href='").append(GROUPS).append("'>").append(groupCount + pluralize(groupCount, " group") + "</a></td>\n")
.append("<td><a target='mainFrame' href='").append(REPORTER_OUTPUT).append("'>reporter output</a></td>\n")
.append("<td><a target='mainFrame' href='").append(TESTNG_XML).append("'>testng.xml</a></td>\n")
.append("</tr>")
.append("</table>");
//
// Generate results for individual tests
//
// Order the results so we can show the failures first, then the skip and
// finally the successes
Map<String, ISuiteResult> redResults = new HashMap<String, ISuiteResult>();
Map<String, ISuiteResult> yellowResults = new HashMap<String, ISuiteResult>();
Map<String, ISuiteResult> greenResults = new HashMap<String, ISuiteResult>();
for (String suiteName : suiteResults.keySet()) {
ISuiteResult sr = suiteResults.get(suiteName);
ITestContext tc = sr.getTestContext();
int failed = tc.getFailedTests().size();
int skipped = tc.getSkippedTests().size();
int passed = tc.getPassedTests().size();
if (failed > 0) {
redResults.put(suiteName, sr);
}
else if (skipped > 0) {