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