1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany |
---|
2 | // |
---|
3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
---|
4 | // you may not use this file except in compliance with the License. |
---|
5 | // You may obtain a copy of the License at |
---|
6 | // |
---|
7 | // http://www.apache.org/licenses/LICENSE-2.0 |
---|
8 | // |
---|
9 | // Unless required by applicable law or agreed to in writing, software |
---|
10 | // distributed under the License is distributed on an "AS IS" BASIS, |
---|
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
12 | // See the License for the specific language governing permissions and |
---|
13 | // limitations under the License. |
---|
14 | |
---|
15 | package de.ugoe.cs.autoquest.usability; |
---|
16 | |
---|
17 | import static de.ugoe.cs.autoquest.usability.UsabilitySmellDescription.COMMON_TASK_RATE; |
---|
18 | |
---|
19 | import org.junit.Before; |
---|
20 | import org.junit.Test; |
---|
21 | |
---|
22 | import de.ugoe.cs.autoquest.usability.UsabilitySmell; |
---|
23 | |
---|
24 | /** |
---|
25 | * |
---|
26 | */ |
---|
27 | public class CommonTaskRateRuleTest extends AbstractUsabilityEvaluationTC { |
---|
28 | |
---|
29 | /** |
---|
30 | * |
---|
31 | */ |
---|
32 | @Before |
---|
33 | public void setUp() { |
---|
34 | //UsabilitySmellIntensity.defaultCoverageQuantile = 0; |
---|
35 | } |
---|
36 | |
---|
37 | /** |
---|
38 | * |
---|
39 | */ |
---|
40 | @Test |
---|
41 | public void testNoTaskCoverage_01() { |
---|
42 | CommonTaskRateRule rule = new CommonTaskRateRule(); |
---|
43 | |
---|
44 | // ===== check ===== |
---|
45 | String spec = |
---|
46 | "UserSession {" + |
---|
47 | " Interaction elem1 {}" + |
---|
48 | " Interaction elem2 {}" + |
---|
49 | "}"; |
---|
50 | |
---|
51 | // no smell expected, as there are too few recorded actions |
---|
52 | UsabilitySmell[] expectedSmells = new UsabilitySmell[] { }; |
---|
53 | |
---|
54 | assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec))); |
---|
55 | } |
---|
56 | |
---|
57 | /** |
---|
58 | * |
---|
59 | */ |
---|
60 | @Test |
---|
61 | public void testNoTaskCoverage_02() { |
---|
62 | CommonTaskRateRule rule = new CommonTaskRateRule(); |
---|
63 | |
---|
64 | // ===== check ===== |
---|
65 | String spec = |
---|
66 | "UserSession {" + |
---|
67 | " Interaction elem1 {}" + |
---|
68 | " Interaction elem2 {}" + |
---|
69 | " Interaction elem3 {}" + |
---|
70 | " Interaction elem4 {}" + |
---|
71 | " Interaction elem5 {}" + |
---|
72 | " Interaction elem6 {}" + |
---|
73 | " Interaction elem7 {}" + |
---|
74 | " Interaction elem8 {}" + |
---|
75 | " Interaction elem9 {}" + |
---|
76 | " Interaction elem10 {}" + |
---|
77 | "}"; |
---|
78 | |
---|
79 | // smell expected, as for each action a different root node exists |
---|
80 | UsabilitySmell[] expectedSmells = new UsabilitySmell[] |
---|
81 | { new UsabilitySmell(UsabilitySmellIntensity.getIntensity(0), COMMON_TASK_RATE) }; |
---|
82 | |
---|
83 | assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec))); |
---|
84 | } |
---|
85 | |
---|
86 | /** |
---|
87 | * |
---|
88 | */ |
---|
89 | @Test |
---|
90 | public void testBadTaskCoverage_01() { |
---|
91 | CommonTaskRateRule rule = new CommonTaskRateRule(); |
---|
92 | |
---|
93 | // ===== check ===== |
---|
94 | String spec = |
---|
95 | "UserSession {" + |
---|
96 | " Iteration it1 {" + |
---|
97 | " Interaction elem1 {}" + |
---|
98 | " }" + |
---|
99 | " Iteration it2 {" + |
---|
100 | " Interaction elem2 {}" + |
---|
101 | " }" + |
---|
102 | " Iteration it3 {" + |
---|
103 | " Interaction elem3 {}" + |
---|
104 | " }" + |
---|
105 | " Iteration it4 {" + |
---|
106 | " Interaction elem4 {}" + |
---|
107 | " }" + |
---|
108 | " Iteration it5 {" + |
---|
109 | " Interaction elem5 {}" + |
---|
110 | " }" + |
---|
111 | " Iteration it6 {" + |
---|
112 | " Interaction elem6 {}" + |
---|
113 | " }" + |
---|
114 | " Iteration it7 {" + |
---|
115 | " Interaction elem7 {}" + |
---|
116 | " }" + |
---|
117 | " Iteration it8 {" + |
---|
118 | " Interaction elem8 {}" + |
---|
119 | " }" + |
---|
120 | " Iteration it9 {" + |
---|
121 | " Interaction elem9 {}" + |
---|
122 | " }" + |
---|
123 | " Iteration it10 {" + |
---|
124 | " Interaction elem10 {}" + |
---|
125 | " }" + |
---|
126 | "}"; |
---|
127 | |
---|
128 | // smell expected, as for each action a different root node exists |
---|
129 | UsabilitySmell[] expectedSmells = new UsabilitySmell[] |
---|
130 | { new UsabilitySmell(UsabilitySmellIntensity.getIntensity(0), COMMON_TASK_RATE) }; |
---|
131 | |
---|
132 | assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec))); |
---|
133 | } |
---|
134 | |
---|
135 | /** |
---|
136 | * |
---|
137 | */ |
---|
138 | @Test |
---|
139 | public void testBadTaskCoverage_02() { |
---|
140 | CommonTaskRateRule rule = new CommonTaskRateRule(); |
---|
141 | |
---|
142 | // ===== check ===== |
---|
143 | String spec = |
---|
144 | "UserSession {" + |
---|
145 | " Sequence seq1 {" + |
---|
146 | " Interaction elem1 {}" + |
---|
147 | " Interaction elem2 {}" + |
---|
148 | " }" + |
---|
149 | " Iteration it3 {" + |
---|
150 | " Interaction elem3 {}" + |
---|
151 | " }" + |
---|
152 | " Iteration it4 {" + |
---|
153 | " Interaction elem4 {}" + |
---|
154 | " }" + |
---|
155 | " Iteration it5 {" + |
---|
156 | " Interaction elem5 {}" + |
---|
157 | " }" + |
---|
158 | " Iteration it6 {" + |
---|
159 | " Interaction elem6 {}" + |
---|
160 | " }" + |
---|
161 | " Iteration it7 {" + |
---|
162 | " Interaction elem7 {}" + |
---|
163 | " }" + |
---|
164 | " Iteration it8 {" + |
---|
165 | " Interaction elem8 {}" + |
---|
166 | " }" + |
---|
167 | " Iteration it9 {" + |
---|
168 | " Interaction elem9 {}" + |
---|
169 | " }" + |
---|
170 | " Iteration it10 {" + |
---|
171 | " Interaction elem10 {}" + |
---|
172 | " }" + |
---|
173 | "}"; |
---|
174 | |
---|
175 | // smell expected, as for many actions a different root node exists |
---|
176 | UsabilitySmell[] expectedSmells = new UsabilitySmell[] |
---|
177 | { new UsabilitySmell(UsabilitySmellIntensity.getIntensity(0), COMMON_TASK_RATE) }; |
---|
178 | |
---|
179 | assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec))); |
---|
180 | } |
---|
181 | |
---|
182 | /** |
---|
183 | * |
---|
184 | */ |
---|
185 | @Test |
---|
186 | public void testBadTaskCoverage_03() { |
---|
187 | CommonTaskRateRule rule = new CommonTaskRateRule(); |
---|
188 | |
---|
189 | // ===== check ===== |
---|
190 | String spec = |
---|
191 | "UserSession {" + |
---|
192 | " Iteration it1 {" + |
---|
193 | " Interaction elem1 {}" + |
---|
194 | " }" + |
---|
195 | " Sequence seq1 {" + |
---|
196 | " Interaction elem2 {}" + |
---|
197 | " Interaction elem3 {}" + |
---|
198 | " }" + |
---|
199 | " Iteration it4 {" + |
---|
200 | " Interaction elem4 {}" + |
---|
201 | " }" + |
---|
202 | " Iteration it5 {" + |
---|
203 | " Interaction elem5 {}" + |
---|
204 | " }" + |
---|
205 | " Iteration it6 {" + |
---|
206 | " Interaction elem6 {}" + |
---|
207 | " }" + |
---|
208 | " Iteration it7 {" + |
---|
209 | " Interaction elem7 {}" + |
---|
210 | " }" + |
---|
211 | " Iteration it8 {" + |
---|
212 | " Interaction elem8 {}" + |
---|
213 | " }" + |
---|
214 | " Iteration it9 {" + |
---|
215 | " Interaction elem9 {}" + |
---|
216 | " }" + |
---|
217 | " Iteration it10 {" + |
---|
218 | " Interaction elem10 {}" + |
---|
219 | " }" + |
---|
220 | "}"; |
---|
221 | |
---|
222 | // smell expected, as for many actions a different root node exists |
---|
223 | UsabilitySmell[] expectedSmells = new UsabilitySmell[] |
---|
224 | { new UsabilitySmell(UsabilitySmellIntensity.getIntensity(0), COMMON_TASK_RATE) }; |
---|
225 | |
---|
226 | assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec))); |
---|
227 | } |
---|
228 | |
---|
229 | /** |
---|
230 | * |
---|
231 | */ |
---|
232 | @Test |
---|
233 | public void testPerfectTaskCoverage_01() { |
---|
234 | CommonTaskRateRule rule = new CommonTaskRateRule(); |
---|
235 | |
---|
236 | // ===== check ===== |
---|
237 | String spec = |
---|
238 | "UserSession {" + |
---|
239 | " Sequence {" + |
---|
240 | " Interaction elem1 {}" + |
---|
241 | " Interaction elem2 {}" + |
---|
242 | " Interaction elem3 {}" + |
---|
243 | " Interaction elem4 {}" + |
---|
244 | " Interaction elem5 {}" + |
---|
245 | " Interaction elem6 {}" + |
---|
246 | " Interaction elem7 {}" + |
---|
247 | " Interaction elem8 {}" + |
---|
248 | " Interaction elem9 {}" + |
---|
249 | " Interaction elem10 {}" + |
---|
250 | " }" + |
---|
251 | "}"; |
---|
252 | |
---|
253 | UsabilitySmell[] expectedSmells = new UsabilitySmell[] { }; |
---|
254 | |
---|
255 | assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec))); |
---|
256 | } |
---|
257 | |
---|
258 | /** |
---|
259 | * |
---|
260 | */ |
---|
261 | @Test |
---|
262 | public void testPerfectTaskCoverage_02() { |
---|
263 | CommonTaskRateRule rule = new CommonTaskRateRule(); |
---|
264 | |
---|
265 | // ===== check ===== |
---|
266 | String spec = |
---|
267 | "UserSession {" + |
---|
268 | " Sequence {" + |
---|
269 | " Interaction elem1 {}" + |
---|
270 | " Interaction elem2 {}" + |
---|
271 | " Interaction elem3 {}" + |
---|
272 | " Interaction elem4 {}" + |
---|
273 | " Interaction elem5 {}" + |
---|
274 | " Interaction elem6 {}" + |
---|
275 | " Interaction elem7 {}" + |
---|
276 | " Interaction elem8 {}" + |
---|
277 | " Interaction elem9 {}" + |
---|
278 | " Interaction elem10 {}" + |
---|
279 | " Interaction elem11 {}" + |
---|
280 | " Interaction elem12 {}" + |
---|
281 | " Interaction elem13 {}" + |
---|
282 | " }" + |
---|
283 | "}"; |
---|
284 | |
---|
285 | UsabilitySmell[] expectedSmells = new UsabilitySmell[] { }; |
---|
286 | |
---|
287 | assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec))); |
---|
288 | } |
---|
289 | |
---|
290 | } |
---|