harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r576965 [2/2] - in /harmony/enhanced/buildtest/branches/2.0: adaptors/eut/ adaptors/eut33/ tests/eut/ tests/eut/summary-reporter/ tests/eut/summary-reporter/src/ tests/eut/summary-reporter/src/org/ tests/eut/summary-reporter/src/org/apache/...
Date Tue, 18 Sep 2007 16:09:30 GMT
Added: harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTSuiteInfo.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTSuiteInfo.java?rev=576965&view=auto
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTSuiteInfo.java
(added)
+++ harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTSuiteInfo.java
Tue Sep 18 09:09:29 2007
@@ -0,0 +1,177 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.harmony.eut.reporter;
+import java.util.ArrayList;
+import java.io.File;
+
+/**
+ * Keeps the information about EUT test suite - it is initialized during EUT
+ * status collecting and used while summary report generating.
+ */
+final class EUTSuiteInfo {
+
+    /** 
+     * A test suite name taken from eut*.suite.properties file or detected
+     * from output.txt or XML report (configuration issue case).
+     */
+    String name;
+
+    /** 
+     * A suite html report file name is taken from output.txt.
+     */
+    String html_report_file_name;
+
+    /** 
+     * Shows if the suite was run - get it from output.txt.
+     */
+    boolean wasRun;
+
+    /**
+     * Shows if the suite was crashed, it true if the suite was run but no
+     * valid XML report was generated.
+     * 
+     * It is set to true when 'wasRun' field is set to true while parsing
+     * output.txt, after that if the valid XML report is parsed then this
+     * property is set to false.  
+     */
+    boolean isCrashed;
+
+    /** 
+     * Shows if the suite is available for platform the program is run on.
+     * Like org.eclipse.jdt.core.tests.eval.TestAll is available for Windows
+     * only.
+     */
+    boolean isAvailable;
+
+    /**
+     * The tests number for the suite is taken from eut*.suite.properties file
+     * or detected from XML report (configuration issue case).
+     */
+    int tests_total;
+
+    /**
+     * The number of passed tests in this suite - it is calculated based on
+     * values from XML report.
+     */
+    int tests_reported_passed;
+
+    /**
+     * The number of expected failures / errors which really happen in this
+     * suite - calculating while 'testsuite' tag processing in XML report. 
+     * This value is used to get the total tests number for Relative Summary,
+     * i.e. the total tests number must be decreased on this value.
+     */
+    int tests_expected_failures_errors;
+
+    /**
+     * The number of tests ended with error - the value is taken from
+     * 'testsuite' tag in XML report.
+     */
+    int tests_reported_end_with_error;
+
+    /**
+     * The number of tests ended with failure - the value is taken from
+     * 'testsuite' tag in XML report.
+     */
+    int tests_reported_end_with_failure;
+
+    /**
+     * The number of unexpected errors for this suite - it is derived from
+     * error information ('error' tag) in XML report and corrresponded EFL
+     * file.
+     */
+    int tests_unexpected_end_with_error;
+
+    /**
+     * The number of unexpected failures for this suite - it is derived from
+     * failure information ('failure' tag) in XML report and corrresponded
+     * EFL file.
+     */
+    int tests_unexpected_end_with_failure;
+
+    /**
+     * Keeps the list of tests ended with unexpected error/failure. 
+     */
+    ArrayList<EUTTestInfo> unexpectedErrorFailureTests;
+} // end of class 'EUTSuiteInfo' definition
+
+/**
+ * Keeps the information about particular test of EUT test suite - it is
+ * initialized during EUT status collecting, only tests whith unexpected
+ * failure/error are stored and used while summary report generating.
+ */
+final class EUTTestInfo {
+    static final int TEST_PASSED = 0;
+    static final int TEST_FAILURE = 1;
+    static final int TEST_ERROR = 2;
+
+    /** 
+     * Keeps the test status extracted from XML report - it is TEST_PASSED if
+     * the 'testcase' tag does not have a child 'error' or 'failure' tag.
+     */
+    int testStatus = TEST_PASSED;
+
+    /**
+     * Keeps the class name of the test extracted from XML report.
+     */
+    String testClass;
+
+    /**
+     * Keeps the test method name extracted from XML report.
+     */
+    String testName;
+
+    /**
+     * Keeps the test error/failure message extract from 'error'/'failure' tag
+     * in XML report.
+     */
+    String testIssueMessage;
+
+    /**
+     * Keeps the test error/failure content (stack trace in most of the cases)
+     * extracted from 'error'/'failure' tag in XML report.
+     */
+    StringBuffer testIssueContent;
+
+    /**
+     * A helper method converting the testStatus to string.
+     */
+    String getStatusString() {
+        switch (testStatus) {
+            case TEST_PASSED: return "PASSED"; 
+            case TEST_FAILURE: return "FAILURE"; 
+            default: return "ERROR"; 
+        }
+    }
+} // end of class 'EUTTestInfo' definition
+
+/**
+ * Keeps the pack of summary data to pass it to report emitters to avoid too
+ * long list of method arguments.
+ */
+final class EUTSummaryInfo {
+    EUTSuiteInfo ss; // Summary Suite
+    int tests_run_total = 0; // need for Relative Summary
+    int tests_crashed_total = 0;
+    int suites_crashed_total = 0;
+    ArrayList<EUTSuiteInfo> crashed_suites;
+    String eut_version;
+    String os, ws, arch;
+    String tested_vm_ags;
+    File testedJavaVersionLog;
+    File runningJavaVersionLog;
+} // end of class 'EUTSummaryInfo' definition

Propchange: harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTSuiteInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTTXTReportEmitter.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTTXTReportEmitter.java?rev=576965&view=auto
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTTXTReportEmitter.java
(added)
+++ harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTTXTReportEmitter.java
Tue Sep 18 09:09:29 2007
@@ -0,0 +1,126 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.harmony.eut.reporter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.BufferedReader;
+import java.io.PrintWriter;
+
+/**
+ * Emits the summary and issues information in txt format. 
+ */
+final class EUTTXTReportEmitter {
+
+    /** Keeps the output stream to write the index.htm data into. */
+    private static PrintWriter out;
+
+    /** Emits EUT issues information into specified output. */
+    static void emitTXTReport(PrintWriter out, EUTSummaryInfo esi)
+            throws Exception {
+        EUTTXTReportEmitter.out = out;
+        out.println("================================================");
+        out.println("Eclipse Unit Tests " + esi.eut_version + " on " 
+                + esi.os + " " + esi.ws + " " + esi.arch);
+        out.println("================================================");
+        out.println("Tested JRE information:");
+        addFileToOutput(esi.testedJavaVersionLog);
+        out.println();
+        out.println("JRE options: " + esi.tested_vm_ags);
+        out.println("================================================");
+        out.println("Runner JRE information:");
+        addFileToOutput(esi.runningJavaVersionLog);
+        out.println("================================================");
+
+        // print the summary results
+        out.println();
+        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_crashed_total);
+        out.println("Unexpected errors   : "
+                + esi.ss.tests_unexpected_end_with_error);
+        out.println("Unexpected failures : "
+                + esi.ss.tests_unexpected_end_with_failure);
+
+        // print detailed reports
+        emitCrashesResults(esi);
+        emitErrorFailureResults(esi.ss.tests_unexpected_end_with_error,
+                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));
+        String line = in.readLine();
+
+        while (line != null) {
+            out.println(line);
+            line = in.readLine();
+        }
+        in.close();
+    }
+
+    private static void emitCrashesResults(EUTSummaryInfo esi) {
+        if (esi.crashed_suites.size() == 0) {
+            return;
+        }
+        out.println();
+        out.println("================================================");
+        out.println("Unexpected crashes  : " + esi.suites_crashed_total);
+
+        for (int i = 0; i < esi.crashed_suites.size(); i++) {
+            EUTSuiteInfo si = esi.crashed_suites.get(i);
+            out.println(si.name + "(" + si.tests_total + ")");
+        }
+    }
+
+    private static void emitErrorFailureResults(int issuesNum,
+            int issuesType) {
+        if (issuesNum == 0) {
+            return;
+        }
+        out.println();
+        out.println("================================================");
+
+        if (issuesType == EUTTestInfo.TEST_ERROR) {
+            out.println("Unexpected errors   : " + issuesNum);
+        } else {
+            out.println("Unexpected failures : " + issuesNum);
+        }
+
+        for (int i = 0; i < EUTReporter.suiteList.size(); i++) {
+            EUTSuiteInfo si = EUTReporter.suiteList.get(i);
+
+            if (!si.wasRun || si.isCrashed) {
+                continue;
+            }
+
+            for (int j = 0; j < si.unexpectedErrorFailureTests.size(); j++) {
+                EUTTestInfo ti = si.unexpectedErrorFailureTests.get(j);
+
+                if (ti.testStatus != issuesType) {
+                    continue;
+                }
+                out.println();
+                out.println(ti.testClass + ti.testName);
+                out.println(ti.testIssueMessage);
+                out.println(ti.testIssueContent.toString().trim());
+            }
+        }
+    }
+} // end of class 'EUTTXTReportEmitter' definition

Propchange: harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTTXTReportEmitter.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message