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 javax.annotation.Nonnull;
23  
24  /**
25   * Describes a single entry for a test report
26   *
27   */
28  public interface ReportEntry
29  {
30      /**
31       * The class name of the test
32       *
33       * @return A string with the class name
34       */
35      String getSourceName();
36  
37      /**
38       * Human readable {@link #getSourceName() test class}.
39       *
40       * @return source text
41       */
42      String getSourceText();
43  
44      /**
45       * The name of the test case
46       *
47       * @return A string describing the test case
48       */
49      String getName();
50  
51      /**
52       * Human readable {@link #getName() test case}.
53       *
54       * @return name text
55       */
56      String getNameText();
57  
58      /**
59       * The group/category of the testcase
60       *
61       * @return A string
62       */
63      String getGroup();
64  
65      /**
66       * The group/category of the testcase
67       *
68       * @return stack trace object
69       */
70      StackTraceWriter getStackTraceWriter();
71  
72      /**
73       * Gets the runtime for the item. Optional parameter. If the value is not set, it will be determined within
74       * the reporting subsystem. Some providers like to calculate this value themselves, and it gets the
75       * most accurate value.
76       * @return duration of a test in milli seconds
77       */
78      Integer getElapsed();
79  
80      /**
81       * Returns same value as {@link #getElapsed()} and fallbacks to {@code fallback} for <code>null</code> elapsed
82       * timed.
83       *
84       * @param fallback usually 0
85       * @return elapsed time if {@link #getElapsed()} is not null; otherwise returns {@code fallback}
86       */
87      int getElapsed( int fallback );
88  
89  
90      /**
91       * A message relating to a non-successful termination.
92       * May be the "message" from an exception or the reason for a test being ignored
93       *
94       * @return A string that explains an anomaly
95       */
96      String getMessage();
97  
98      /**
99       * A source name of the test case together with the group or category (if any exists).
100      *
101      * @return A string with the test case name and group/category, or just the name.
102      */
103     String getNameWithGroup();
104 
105     /**
106      * A source text of the test case together with the group or category (if any exists).
107      *
108      * @return A string with the test case text and group/category, or just the source text. If no
109      * source text is provided, then this will return null.
110      */
111     String getReportNameWithGroup();
112 
113     /**
114      * Run mode.
115      *
116      * @return a normal run, or re-run.
117      */
118     @Nonnull
119     RunMode getRunMode();
120 
121     /**
122      * This represents a reference pointing to a literal representation of test description or literal unique id.
123      *
124      * @return id
125      */
126     Long getTestRunId();
127 }