Index: summary-reporter/src/org/apache/harmony/eut/reporter/EUTReporter.java =================================================================== --- summary-reporter/src/org/apache/harmony/eut/reporter/EUTReporter.java (revision 586010) +++ summary-reporter/src/org/apache/harmony/eut/reporter/EUTReporter.java (working copy) @@ -89,6 +89,12 @@ String fractionStr = String.valueOf((int) Math.round((passrate - (double) aliquot) * 100.0)); + // fractionStr may become 100 for the real pass rate like 99.9971% - + // need to do incorrect rounding in such a case to avoid 100% reporting + if (fractionStr.equals("100")) { + return "99.99%"; + } + if (fractionStr.length() != 2) { fractionStr = "0" + fractionStr; } Index: summary-reporter/src/org/apache/harmony/eut/reporter/EUTSuiteInfo.java =================================================================== --- summary-reporter/src/org/apache/harmony/eut/reporter/EUTSuiteInfo.java (revision 586010) +++ summary-reporter/src/org/apache/harmony/eut/reporter/EUTSuiteInfo.java (working copy) @@ -112,6 +112,21 @@ * Keeps the list of tests ended with unexpected error/failure. */ ArrayList unexpectedErrorFailureTests; + + /** + * Keeps the suite global error /failure message extract from + * 'error'/'failure' tag in XML report (like 'Can not find plugin" error. + */ + String suiteIssueMessage; + + /** + * Keeps the suite error/failure content extracted from 'error'/'failure' + * tag in XML report. + * + * This field null value indicates one more state of suite (it was run, it + * does not crash, still no testcases were run due to suite error). + */ + StringBuffer suiteIssueContent; } // end of class 'EUTSuiteInfo' definition /** Index: summary-reporter/src/org/apache/harmony/eut/reporter/EUTTXTReportEmitter.java =================================================================== --- summary-reporter/src/org/apache/harmony/eut/reporter/EUTTXTReportEmitter.java (revision 586010) +++ summary-reporter/src/org/apache/harmony/eut/reporter/EUTTXTReportEmitter.java (working copy) @@ -50,7 +50,8 @@ out.println("Total run tests : " + esi.tests_run_total); out.println("Relative passrate : " + EUTReporter.makePassrateString( esi.ss.tests_reported_passed, esi.tests_run_total)); - out.println("Unexpected crashes : " + esi.suites_unexpected_crashed.size()); + out.println("Unexpected crashes : " + + esi.suites_unexpected_crashed.size()); out.println("Unexpected errors : " + esi.ss.tests_unexpected_end_with_error); out.println("Unexpected failures : " @@ -62,7 +63,7 @@ EUTTestInfo.TEST_ERROR); emitErrorFailureResults(esi.ss.tests_unexpected_end_with_failure, EUTTestInfo.TEST_FAILURE); - } + } private static void addFileToOutput(File log) throws Exception { BufferedReader in = new BufferedReader(new FileReader(log)); @@ -111,6 +112,15 @@ continue; } + if (si.suiteIssueContent != null && + issuesType == EUTTestInfo.TEST_ERROR) { + String testsStr = si.tests_total == 1 ? " test)" : " tests)"; + out.println(); + out.println(si.name + " (" + si.tests_total + testsStr); + out.println(si.suiteIssueMessage); + out.println(si.suiteIssueContent.toString().trim()); + } + for (int j = 0; j < si.unexpectedErrorFailureTests.size(); j++) { EUTTestInfo ti = si.unexpectedErrorFailureTests.get(j); Index: summary-reporter/src/org/apache/harmony/eut/reporter/EUTStatusCollector.java =================================================================== --- summary-reporter/src/org/apache/harmony/eut/reporter/EUTStatusCollector.java (revision 586010) +++ summary-reporter/src/org/apache/harmony/eut/reporter/EUTStatusCollector.java (working copy) @@ -30,6 +30,11 @@ import java.util.Properties; /** + * Parses information from XML report and does not claculate any statistics. + * + * For example, total number of tests / errors / failures in the suite is taken + * from <testsuite> tag, this is not summarised data taken from + * <testcase> tag. */ final class EUTStatusCollector extends DefaultHandler { @@ -107,6 +112,10 @@ /** * Called by parser when new XML tag is found. + * + * Note that <error> tag may happen inside <testsuite> one + * without <testcase> parent tag. For example the thw whote suite can + * not be run due to related plugin can not be found. */ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { @@ -124,10 +133,26 @@ } if (qName.equals("error") || qName.equals("failure")) { - processedTest.testStatus = qName.equals("error") ? - EUTTestInfo.TEST_ERROR : EUTTestInfo.TEST_FAILURE; - processedTest.testIssueMessage = attributes.getValue("message"); - processedTest.testIssueContent = new StringBuffer(); + if (processedTest != null) { + processedTest.testStatus = qName.equals("error") ? + EUTTestInfo.TEST_ERROR : EUTTestInfo.TEST_FAILURE; + processedTest.testIssueMessage = attributes.getValue("message"); + processedTest.testIssueContent = new StringBuffer(); + } else if (processedSuite != null) { + + // there is a error preventing testsuite running - so all of + // its tests are considered as ended with unexpected error + if (EUTReporter.eflList.indexOf(processedSuite.name) != -1) { + processedSuite.tests_expected_failures_errors += + processedSuite.tests_total; + } else { + processedSuite.tests_unexpected_end_with_error += + processedSuite.tests_total; + processedSuite.suiteIssueMessage = + attributes.getValue("message"); + processedSuite.suiteIssueContent = new StringBuffer(); + } + } return; } } @@ -162,12 +187,14 @@ // remove passed test from EFL to calculate passrate correctly EUTReporter.eflList.remove(eflIndex); } + processedTest = null; return; } // expected failure/error situation if (eflIndex != -1) { processedSuite.tests_expected_failures_errors++; + processedTest = null; return; } @@ -186,6 +213,9 @@ throws SAXException { if (processedTest != null && processedTest.testIssueContent != null) { processedTest.testIssueContent.append(ch, start, length); + } else if (processedSuite != null && + processedSuite.suiteIssueContent != null) { + processedSuite.suiteIssueContent.append(ch, start, length); } }