View Javadoc
1   package org.apache.maven.surefire.api.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  import org.apache.maven.surefire.api.provider.SurefireProvider;
23  
24  /**
25   * Used by providers to report results.
26   * Using this interface integrates the providers together into a common reporting infrastructure.
27   * <br>
28   * An instance of a reporter is not guaranteed to be thread-safe and concurrent test frameworks
29   * must request an instance of a reporter per-thread from the ReporterFactory.
30   */
31  public interface RunListener
32  {
33      /**
34       * Indicates the start of a given test-set
35       *
36       * @param report the report entry describing the testset
37       * @throws ReporterException When reporting fails
38       */
39      void testSetStarting( TestSetReportEntry report );
40  
41      /**
42       * Indicates end of a given test-set
43       *
44       * @param report the report entry describing the testset
45       * @throws ReporterException When reporting fails
46       */
47      void testSetCompleted( TestSetReportEntry report );
48  
49      /**
50       * Event fired when a test is about to start
51       *
52       * @param report The report entry to log for
53       */
54      void testStarting( ReportEntry report );
55  
56      /**
57       * Event fired when a test ended successfully
58       *
59       * @param report The report entry to log for
60       */
61      void testSucceeded( ReportEntry report );
62  
63      /**
64       * Event fired when a test assumption failure was encountered.
65       * An assumption failure indicates that the test is not relevant
66       *
67       * @param report The report entry to log for
68       */
69      void testAssumptionFailure( ReportEntry report );
70  
71      /**
72       * Event fired when a test ended with an error (non anticipated problem)
73       *
74       * @param report The report entry to log for
75       */
76      void testError( ReportEntry report );
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       */
83      void testFailed( ReportEntry report );
84  
85      /**
86       * Event fired when a test is skipped
87       *
88       * @param report The report entry to log for
89       */
90      void testSkipped( ReportEntry report );
91  
92      /**
93       * Event fired skipping an execution of remaining test-set in other fork(s); or does nothing if no forks.
94       * The method is called by {@link SurefireProvider}.<p>
95       * (The event is fired after the Nth test failed to signal skipping the rest of test-set.)
96       */
97      void testExecutionSkippedByUser();
98  
99      /**
100      * Marks the listener with run mode, e.g. normal run or re-run.
101      *
102      * @param currentRunMode    set current run
103      * @return previous run mode; never returns null
104      * @throws NullPointerException if <code>currentRunMode</code> is null
105      */
106     RunMode markAs( RunMode currentRunMode );
107 }