View Javadoc

1   package org.apache.maven.surefire.report;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  /**
23   * Persists reports somewhere
24   * <p/>
25   * An instance of a reporter is not guaranteed to be thread-safe and concurrent test frameworks
26   * must request an instance of a reporter per-thread from the ReporterFactory.
27   */
28  public interface Reporter
29  {
30      /**
31       * Indicates the start of a given test-set
32       *
33       * @param report the report entry describing the testset
34       * @throws org.apache.maven.surefire.report.ReporterException
35       *          When reporting fails
36       */
37      void testSetStarting( ReportEntry report )
38          throws ReporterException;
39  
40      /**
41       * Indicates end of a given test-set
42       *
43       * @param report the report entry describing the testset
44       * @throws org.apache.maven.surefire.report.ReporterException
45       *          When reporting fails
46       */
47      void testSetCompleted( ReportEntry report )
48          throws ReporterException;
49  
50      // Tests
51  
52      /**
53       * Event fired when a test is about to start
54       *
55       * @param report The report entry to log for
56       */
57      void testStarting( ReportEntry report );
58  
59      /**
60       * Event fired when a test ended successfully
61       *
62       * @param report The report entry to log for
63       */
64      void testSucceeded( ReportEntry report );
65  
66  
67      void testSkipped( ReportEntry report );
68  
69      /**
70       * Event fired when a test ended with an error (non anticipated problem)
71       *
72       * @param report The report entry to log for
73       * @param stdOut standard output from the test case
74       * @param stdErr error output from the test case
75       */
76      void testError( ReportEntry report, String stdOut, String stdErr );
77  
78      /**
79       * Event fired when a test ended with a failure (anticipated problem)
80       *
81       * @param report The report entry to log for
82       * @param stdOut standard output from the test case
83       * @param stdErr error output from the test case
84       */
85      void testFailed( ReportEntry report, String stdOut, String stdErr );
86  
87      /**
88       * Writes a message that will be displayed in all free-text format reporters.
89       * These messages will be output regardless, as opposed to #writeDetailMessage,
90       * which is controlled by reportFormat.
91       *
92       * @param message The message to write.
93       */
94      void writeMessage( String message );
95  
96      void writeMessage( byte[] b, int off, int len );
97  
98      /**
99       * Restores the instance of the reporter, making the instance re-usable for a subsequent run in the
100      * same thread.
101      */
102     void reset();
103 }