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 * Event fired when a test ended with an error (non anticipated problem)
68 *
69 * @param report The report entry to log for
70 */
71 void testError( ReportEntry report );
72
73 /**
74 * Event fired when a test ended with a failure (anticipated problem)
75 *
76 * @param report The report entry to log for
77 */
78 void testFailed( ReportEntry report );
79
80
81 void testSkipped( ReportEntry report );
82
83 /**
84 * Event fired when a test ended with an error (non anticipated problem)
85 *
86 * @param report The report entry to log for
87 * @param stdOut standard output from the test case
88 * @param stdErr error output from the test case
89 */
90 void testError( ReportEntry report, String stdOut, String stdErr );
91
92 /**
93 * Event fired when a test ended with a failure (anticipated problem)
94 *
95 * @param report The report entry to log for
96 * @param stdOut standard output from the test case
97 * @param stdErr error output from the test case
98 */
99 void testFailed( ReportEntry report, String stdOut, String stdErr );
100
101 /**
102 * Writes a message that will be displayed in all free-text format reporters.
103 * These messages will be output regardless, as opposed to #writeDetailMessage,
104 * which is controlled by reportFormat.
105 *
106 * @param message The message to write.
107 */
108 void writeMessage( String message );
109
110 /**
111 * Writes a detailed message that will not necessarily be displayed in all channels.
112 * This is controlled by reportFormat attribute on the plugin.
113 *
114 * @param message The message to write
115 */
116 void writeDetailMessage( String message );
117
118 /**
119 * Restores the instance of the reporter, making the instance re-usable for a subsequent run in the
120 * same thread.
121 */
122 void reset();
123
124 void writeFooter( String footer );
125 }