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  /**
23   * Describes a single entry for a test report
24   *
25   */
26  public interface ReportEntry
27  {
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 milli seconds
75       */
76      Integer getElapsed();
77  
78      /**
79       * Returns same value as {@link #getElapsed()} and fallbacks to {@code fallback} for <tt>null</tt> elapsed timed.
80       *
81       * @param fallback usually 0
82       * @return elapsed time if {@link #getElapsed()} is not null; otherwise returns {@code fallback}
83       */
84      int getElapsed( int fallback );
85  
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.
106      */
107     String getReportNameWithGroup();
108 }