View Javadoc

1   package org.apache.maven.continuum.reports.surefire;
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 java.util.ArrayList;
23  import java.util.List;
24  
25  /**
26   * @author <a href="mailto:olamy@apache.org">olamy</a>
27   * @version $Id: ReportTest.java 1372267 2012-08-13 05:47:30Z brett $
28   * @since 12 nov. 07
29   */
30  public class ReportTest
31  {
32      private String id;
33  
34      private String name;
35  
36      private int tests;
37  
38      private int errors;
39  
40      private int failures;
41  
42      private float elapsedTime;
43  
44      private List children;
45  
46      public String getName()
47      {
48          return name;
49      }
50  
51      public void setName( String name )
52      {
53          this.name = name;
54      }
55  
56      public int getTests()
57      {
58          return tests;
59      }
60  
61      public void setTests( int tests )
62      {
63          this.tests = tests;
64      }
65  
66      public int getErrors()
67      {
68          return errors;
69      }
70  
71      public void setErrors( int errors )
72      {
73          this.errors = errors;
74      }
75  
76      public int getFailures()
77      {
78          return failures;
79      }
80  
81      public void setFailures( int failures )
82      {
83          this.failures = failures;
84      }
85  
86      public float getSuccessRate()
87      {
88          float percentage;
89          if ( tests == 0 )
90          {
91              percentage = 0;
92          }
93          else
94          {
95              percentage = ( (float) ( tests - errors - failures ) / (float) tests ) * 100;
96          }
97  
98          return percentage;
99      }
100 
101     public float getElapsedTime()
102     {
103         return elapsedTime;
104     }
105 
106     public void setElapsedTime( float elapsedTime )
107     {
108         this.elapsedTime = elapsedTime;
109     }
110 
111     public List getChildren()
112     {
113         if ( children == null )
114         {
115             children = new ArrayList();
116         }
117 
118         return children;
119     }
120 
121     public void setChildren( List children )
122     {
123         this.children = children;
124     }
125 
126     public String getId()
127     {
128         return id;
129     }
130 
131     public void setId( String id )
132     {
133         this.id = id;
134     }
135 }