1 package org.codehaus.mojo.dashboard.report.plugin.beans;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import java.util.Date;
20
21
22
23
24
25
26 public class SurefireReportBean extends AbstractReportBean
27 {
28
29
30
31 private int nbTests;
32
33
34
35 private int nbErrors;
36
37
38
39 private int nbFailures;
40
41
42
43 private int nbSkipped;
44
45
46
47 private double sucessRate;
48
49
50
51 private double elapsedTime;
52
53
54
55 private static final int PCENT = 100;
56
57
58
59
60 public SurefireReportBean()
61 {
62 }
63
64
65
66
67 public SurefireReportBean( Date dateGeneration )
68 {
69 super( dateGeneration );
70 }
71
72
73
74
75 public double getElapsedTime()
76 {
77 return elapsedTime;
78 }
79
80
81
82
83 public void setElapsedTime( double elapsedTime )
84 {
85 this.elapsedTime = elapsedTime;
86 }
87
88
89
90
91 public int getNbErrors()
92 {
93 return nbErrors;
94 }
95
96
97
98
99 public void setNbErrors( int nbErrors )
100 {
101 this.nbErrors = nbErrors;
102 }
103
104
105
106
107 public int getNbFailures()
108 {
109 return nbFailures;
110 }
111
112
113
114
115 public void setNbFailures( int nbFailures )
116 {
117 this.nbFailures = nbFailures;
118 }
119
120
121
122
123 public int getNbSkipped()
124 {
125 return nbSkipped;
126 }
127
128
129
130
131 public void setNbSkipped( int nbSkipped )
132 {
133 this.nbSkipped = nbSkipped;
134 }
135
136
137
138
139 public int getNbTests()
140 {
141 return nbTests;
142 }
143
144
145
146
147 public void setNbTests( int nbTests )
148 {
149 this.nbTests = nbTests;
150 }
151
152
153
154
155 public double getSucessRate()
156 {
157 return sucessRate;
158 }
159
160
161
162
163 public void setSucessRate( double sucessRate )
164 {
165 this.sucessRate = sucessRate;
166 }
167
168
169
170
171 public void merge( IDashBoardReportBean dashboardReport )
172 {
173 if ( dashboardReport != null && dashboardReport instanceof SurefireReportBean )
174 {
175 this.nbTests = this.nbTests + ( (SurefireReportBean) dashboardReport ).getNbTests();
176
177 this.nbErrors = this.nbErrors + ( (SurefireReportBean) dashboardReport ).getNbErrors();
178
179 this.nbFailures = this.nbFailures + ( (SurefireReportBean) dashboardReport ).getNbFailures();
180
181 this.nbSkipped = this.nbSkipped + ( (SurefireReportBean) dashboardReport ).getNbSkipped();
182
183 this.elapsedTime = this.elapsedTime + ( (SurefireReportBean) dashboardReport ).getElapsedTime();
184
185 if ( this.nbTests == 0 )
186 {
187 this.sucessRate = 0D;
188 }
189 else
190 {
191 double success = (double) ( this.nbTests - this.nbErrors - this.nbFailures - this.nbSkipped );
192 this.sucessRate = ( success / (double) this.nbTests ) * PCENT;
193 }
194 }
195 }
196 }