1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.apache.maven.surefire.api.report;
20
21 import javax.annotation.Nonnull;
22
23 /**
24 * Describes a single entry for a test report
25 *
26 */
27 public interface ReportEntry {
28 /**
29 * The class name of the test
30 *
31 * @return A string with the class name
32 */
33 String getSourceName();
34
35 /**
36 * Human readable {@link #getSourceName() test class}.
37 *
38 * @return source text
39 */
40 String getSourceText();
41
42 /**
43 * The name of the test case
44 *
45 * @return A string describing the test case
46 */
47 String getName();
48
49 /**
50 * Human readable {@link #getName() test case}.
51 *
52 * @return name text
53 */
54 String getNameText();
55
56 /**
57 * The group/category of the testcase
58 *
59 * @return A string
60 */
61 String getGroup();
62
63 /**
64 * The group/category of the testcase
65 *
66 * @return stack trace object
67 */
68 StackTraceWriter getStackTraceWriter();
69
70 /**
71 * Gets the runtime for the item. Optional parameter. If the value is not set, it will be determined within
72 * the reporting subsystem. Some providers like to calculate this value themselves, and it gets the
73 * most accurate value.
74 * @return duration of a test in milliseconds
75 */
76 Integer getElapsed();
77
78 /**
79 * Returns same value as {@link #getElapsed()} and fallbacks to {@code fallback} for <code>null</code> elapsed
80 * timed.
81 *
82 * @param fallback usually 0
83 * @return elapsed time if {@link #getElapsed()} is not null; otherwise returns {@code fallback}
84 */
85 int getElapsed(int fallback);
86
87 /**
88 * A message relating to a non-successful termination.
89 * May be the "message" from an exception or the reason for a test being ignored
90 *
91 * @return A string that explains an anomaly
92 */
93 String getMessage();
94
95 /**
96 * A source name of the test case together with the group or category (if any exists).
97 *
98 * @return A string with the test case name and group/category, or just the name.
99 */
100 String getNameWithGroup();
101
102 /**
103 * A source text of the test case together with the group or category (if any exists).
104 *
105 * @return A string with the test case text and group/category, or just the source text. If no
106 * source text is provided, then this will return null.
107 */
108 String getReportNameWithGroup();
109
110 /**
111 * Run mode.
112 *
113 * @return a normal run, or re-run.
114 */
115 @Nonnull
116 RunMode getRunMode();
117
118 /**
119 * This represents a reference pointing to a literal representation of test description or literal unique id.
120 *
121 * @return id
122 */
123 Long getTestRunId();
124 }