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.UsabilityDefectDescription.INEFFICIENT_ACTIONS; |
---|
18 | import static de.ugoe.cs.autoquest.usability.UsabilityDefectSeverity.HIGH; |
---|
19 | import static de.ugoe.cs.autoquest.usability.UsabilityDefectSeverity.INFO; |
---|
20 | import static de.ugoe.cs.autoquest.usability.UsabilityDefectSeverity.LOW; |
---|
21 | import static de.ugoe.cs.autoquest.usability.UsabilityDefectSeverity.MEDIUM; |
---|
22 | |
---|
23 | import org.junit.Before; |
---|
24 | import org.junit.Test; |
---|
25 | |
---|
26 | import de.ugoe.cs.autoquest.usability.UsabilityDefect; |
---|
27 | |
---|
28 | /** |
---|
29 | * |
---|
30 | */ |
---|
31 | public class RequiredInefficientActionsRuleTest extends AbstractUsabilityEvaluationTC { |
---|
32 | |
---|
33 | /** |
---|
34 | * |
---|
35 | */ |
---|
36 | @Before |
---|
37 | public void setUp() { |
---|
38 | UsabilityDefectSeverity.defaultCoverageQuantile = 0; |
---|
39 | } |
---|
40 | |
---|
41 | /** |
---|
42 | * |
---|
43 | */ |
---|
44 | @Test |
---|
45 | public void testWithNormalScroll_01() { |
---|
46 | RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule(); |
---|
47 | |
---|
48 | // ===== check ===== |
---|
49 | String spec = |
---|
50 | "UserSession {" + |
---|
51 | " Scroll body {}" + |
---|
52 | " Interaction elem1 {}" + |
---|
53 | "}"; |
---|
54 | |
---|
55 | // no defect expected, as interactions do not form tasks |
---|
56 | UsabilityDefect[] expectedDefects = new UsabilityDefect[] { }; |
---|
57 | |
---|
58 | assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec))); |
---|
59 | |
---|
60 | } |
---|
61 | |
---|
62 | /** |
---|
63 | * |
---|
64 | */ |
---|
65 | @Test |
---|
66 | public void testWithNormalScroll_02() { |
---|
67 | RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule(); |
---|
68 | |
---|
69 | // ===== check ===== |
---|
70 | String spec = |
---|
71 | "UserSession {" + |
---|
72 | " Scroll body {}" + |
---|
73 | " Interaction elem1 {}" + |
---|
74 | " Scroll body {}" + |
---|
75 | " Interaction elem1 {}" + |
---|
76 | "}"; |
---|
77 | |
---|
78 | // no defect expected, as interactions do not form tasks |
---|
79 | UsabilityDefect[] expectedDefects = new UsabilityDefect[] { }; |
---|
80 | |
---|
81 | assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec))); |
---|
82 | |
---|
83 | } |
---|
84 | |
---|
85 | /** |
---|
86 | * |
---|
87 | */ |
---|
88 | @Test |
---|
89 | public void testWithNormalScroll_03() { |
---|
90 | RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule(); |
---|
91 | |
---|
92 | // ===== check ===== |
---|
93 | String spec = |
---|
94 | "UserSession {" + |
---|
95 | " Sequence {" + |
---|
96 | " Scroll body {}" + |
---|
97 | " Interaction elem1 {}" + |
---|
98 | " }" + |
---|
99 | "}"; |
---|
100 | |
---|
101 | UsabilityDefect[] expectedDefects = new UsabilityDefect[] |
---|
102 | { new UsabilityDefect(HIGH, INEFFICIENT_ACTIONS) }; |
---|
103 | |
---|
104 | assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec))); |
---|
105 | |
---|
106 | } |
---|
107 | |
---|
108 | /** |
---|
109 | * |
---|
110 | */ |
---|
111 | @Test |
---|
112 | public void testWithNormalScroll_04() { |
---|
113 | RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule(); |
---|
114 | |
---|
115 | // ===== check ===== |
---|
116 | String spec = |
---|
117 | "UserSession {" + |
---|
118 | " Sequence {" + |
---|
119 | " Interaction elem1 {}" + |
---|
120 | " Scroll body {}" + |
---|
121 | " }" + |
---|
122 | "}"; |
---|
123 | |
---|
124 | UsabilityDefect[] expectedDefects = new UsabilityDefect[] |
---|
125 | { new UsabilityDefect(HIGH, INEFFICIENT_ACTIONS) }; |
---|
126 | |
---|
127 | assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec))); |
---|
128 | |
---|
129 | } |
---|
130 | |
---|
131 | /** |
---|
132 | * |
---|
133 | */ |
---|
134 | @Test |
---|
135 | public void testWithNormalScroll_05() { |
---|
136 | RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule(); |
---|
137 | |
---|
138 | // ===== check ===== |
---|
139 | String spec = |
---|
140 | "UserSession {" + |
---|
141 | " Sequence seq1 {" + |
---|
142 | " Scroll body {}" + |
---|
143 | " Interaction elem1 {}" + |
---|
144 | " }" + |
---|
145 | " Sequence seq1 {" + |
---|
146 | " Scroll body {}" + |
---|
147 | " Interaction elem1 {}" + |
---|
148 | " }" + |
---|
149 | "}"; |
---|
150 | |
---|
151 | UsabilityDefect[] expectedDefects = new UsabilityDefect[] |
---|
152 | { new UsabilityDefect(HIGH, INEFFICIENT_ACTIONS) }; |
---|
153 | |
---|
154 | assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec))); |
---|
155 | |
---|
156 | } |
---|
157 | |
---|
158 | /** |
---|
159 | * |
---|
160 | */ |
---|
161 | @Test |
---|
162 | public void testWithNormalScroll_06() { |
---|
163 | RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule(); |
---|
164 | |
---|
165 | // ===== check ===== |
---|
166 | String spec = |
---|
167 | "UserSession {" + |
---|
168 | " Sequence seq1 {" + |
---|
169 | " Interaction elem1 {}" + |
---|
170 | " Scroll body {}" + |
---|
171 | " }" + |
---|
172 | " Sequence seq1 {" + |
---|
173 | " Interaction elem1 {}" + |
---|
174 | " Scroll body {}" + |
---|
175 | " }" + |
---|
176 | "}"; |
---|
177 | |
---|
178 | UsabilityDefect[] expectedDefects = new UsabilityDefect[] |
---|
179 | { new UsabilityDefect(HIGH, INEFFICIENT_ACTIONS) }; |
---|
180 | |
---|
181 | assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec))); |
---|
182 | |
---|
183 | } |
---|
184 | |
---|
185 | /** |
---|
186 | * |
---|
187 | */ |
---|
188 | @Test |
---|
189 | public void testScrollSeldomRequired_01() { |
---|
190 | RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule(); |
---|
191 | |
---|
192 | // ===== check ===== |
---|
193 | String spec = |
---|
194 | "UserSession {" + |
---|
195 | " Sequence seq1 {" + |
---|
196 | " Interaction elem1 {}" + |
---|
197 | " Interaction elem1 {}" + |
---|
198 | " Interaction elem1 {}" + |
---|
199 | " Scroll body {}" + |
---|
200 | " Interaction elem1 {}" + |
---|
201 | " }" + |
---|
202 | "}"; |
---|
203 | |
---|
204 | UsabilityDefect[] expectedDefects = new UsabilityDefect[] |
---|
205 | { new UsabilityDefect(LOW, INEFFICIENT_ACTIONS) }; |
---|
206 | |
---|
207 | assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec))); |
---|
208 | |
---|
209 | } |
---|
210 | |
---|
211 | /** |
---|
212 | * |
---|
213 | */ |
---|
214 | @Test |
---|
215 | public void testScrollSeldomRequired_02() { |
---|
216 | RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule(); |
---|
217 | |
---|
218 | // ===== check ===== |
---|
219 | String spec = |
---|
220 | "UserSession {" + |
---|
221 | " Sequence seq1 {" + |
---|
222 | " Optional opt1 { }" + |
---|
223 | " Interaction elem1 {}" + |
---|
224 | " }" + |
---|
225 | " Sequence seq1 {" + |
---|
226 | " Optional opt1 {" + |
---|
227 | " Scroll body {}" + |
---|
228 | " }" + |
---|
229 | " Interaction elem1 {}" + |
---|
230 | " }" + |
---|
231 | " Sequence seq1 {" + |
---|
232 | " Optional opt1 {" + |
---|
233 | " Scroll body {}" + |
---|
234 | " }" + |
---|
235 | " Interaction elem1 {}" + |
---|
236 | " }" + |
---|
237 | "}"; |
---|
238 | |
---|
239 | UsabilityDefect[] expectedDefects = new UsabilityDefect[] |
---|
240 | { new UsabilityDefect(MEDIUM, INEFFICIENT_ACTIONS) }; |
---|
241 | |
---|
242 | assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec))); |
---|
243 | |
---|
244 | } |
---|
245 | |
---|
246 | /** |
---|
247 | * |
---|
248 | */ |
---|
249 | @Test |
---|
250 | public void testScrollSeldomRequired_03() { |
---|
251 | RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule(); |
---|
252 | |
---|
253 | // ===== check ===== |
---|
254 | String spec = |
---|
255 | "UserSession {" + |
---|
256 | " Sequence seq1 {" + |
---|
257 | " Interaction elem1 {}" + |
---|
258 | " Optional opt1 { }" + |
---|
259 | " }" + |
---|
260 | " Sequence seq1 {" + |
---|
261 | " Interaction elem1 {}" + |
---|
262 | " Optional opt1 {" + |
---|
263 | " Scroll body {}" + |
---|
264 | " }" + |
---|
265 | " }" + |
---|
266 | " Sequence seq1 {" + |
---|
267 | " Interaction elem1 {}" + |
---|
268 | " Optional opt1 {" + |
---|
269 | " Scroll body {}" + |
---|
270 | " }" + |
---|
271 | " }" + |
---|
272 | "}"; |
---|
273 | |
---|
274 | UsabilityDefect[] expectedDefects = new UsabilityDefect[] |
---|
275 | { new UsabilityDefect(MEDIUM, INEFFICIENT_ACTIONS) }; |
---|
276 | |
---|
277 | assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec))); |
---|
278 | |
---|
279 | } |
---|
280 | |
---|
281 | /** |
---|
282 | * |
---|
283 | */ |
---|
284 | @Test |
---|
285 | public void testScrollSeldomRequired_04() { |
---|
286 | RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule(); |
---|
287 | |
---|
288 | // ===== check ===== |
---|
289 | String spec = |
---|
290 | "UserSession {" + |
---|
291 | " Sequence seq1 {" + |
---|
292 | " Optional opt1 { }" + |
---|
293 | " Interaction elem1 {}" + |
---|
294 | " }" + |
---|
295 | " Sequence seq1 {" + |
---|
296 | " Optional opt1 {}" + |
---|
297 | " Interaction elem1 {}" + |
---|
298 | " }" + |
---|
299 | " Sequence seq1 {" + |
---|
300 | " Optional opt1 {" + |
---|
301 | " Scroll body {}" + |
---|
302 | " }" + |
---|
303 | " Interaction elem1 {}" + |
---|
304 | " }" + |
---|
305 | " Sequence seq1 {" + |
---|
306 | " Optional opt1 {" + |
---|
307 | " Scroll body {}" + |
---|
308 | " }" + |
---|
309 | " Interaction elem1 {}" + |
---|
310 | " }" + |
---|
311 | "}"; |
---|
312 | |
---|
313 | UsabilityDefect[] expectedDefects = new UsabilityDefect[] |
---|
314 | { new UsabilityDefect(LOW, INEFFICIENT_ACTIONS) }; |
---|
315 | |
---|
316 | assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec))); |
---|
317 | |
---|
318 | } |
---|
319 | |
---|
320 | /** |
---|
321 | * |
---|
322 | */ |
---|
323 | @Test |
---|
324 | public void testScrollSeldomRequired_05() { |
---|
325 | RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule(); |
---|
326 | |
---|
327 | // ===== check ===== |
---|
328 | String spec = |
---|
329 | "UserSession {" + |
---|
330 | " Sequence seq1 {" + |
---|
331 | " Interaction elem1 {}" + |
---|
332 | " Optional opt1 { }" + |
---|
333 | " }" + |
---|
334 | " Sequence seq1 {" + |
---|
335 | " Interaction elem1 {}" + |
---|
336 | " Optional opt1 {}" + |
---|
337 | " }" + |
---|
338 | " Sequence seq1 {" + |
---|
339 | " Interaction elem1 {}" + |
---|
340 | " Optional opt1 {" + |
---|
341 | " Scroll body {}" + |
---|
342 | " }" + |
---|
343 | " }" + |
---|
344 | " Sequence seq1 {" + |
---|
345 | " Interaction elem1 {}" + |
---|
346 | " Optional opt1 {" + |
---|
347 | " Scroll body {}" + |
---|
348 | " }" + |
---|
349 | " }" + |
---|
350 | "}"; |
---|
351 | |
---|
352 | UsabilityDefect[] expectedDefects = new UsabilityDefect[] |
---|
353 | { new UsabilityDefect(LOW, INEFFICIENT_ACTIONS) }; |
---|
354 | |
---|
355 | assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec))); |
---|
356 | |
---|
357 | } |
---|
358 | |
---|
359 | /** |
---|
360 | * |
---|
361 | */ |
---|
362 | @Test |
---|
363 | public void testScrollSeldomRequired_06() { |
---|
364 | RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule(); |
---|
365 | |
---|
366 | // ===== check ===== |
---|
367 | String spec = |
---|
368 | "UserSession {" + |
---|
369 | " Sequence seq1 {" + |
---|
370 | " Optional opt1 { }" + |
---|
371 | " Interaction elem1 {}" + |
---|
372 | " }" + |
---|
373 | " Sequence seq1 {" + |
---|
374 | " Optional opt1 { }" + |
---|
375 | " Interaction elem1 {}" + |
---|
376 | " }" + |
---|
377 | " Sequence seq1 {" + |
---|
378 | " Optional opt1 { }" + |
---|
379 | " Interaction elem1 {}" + |
---|
380 | " }" + |
---|
381 | " Sequence seq1 {" + |
---|
382 | " Optional opt1 {" + |
---|
383 | " Scroll body {}" + |
---|
384 | " }" + |
---|
385 | " Interaction elem1 {}" + |
---|
386 | " }" + |
---|
387 | "}"; |
---|
388 | |
---|
389 | UsabilityDefect[] expectedDefects = new UsabilityDefect[] |
---|
390 | { new UsabilityDefect(INFO, INEFFICIENT_ACTIONS) }; |
---|
391 | |
---|
392 | assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec))); |
---|
393 | |
---|
394 | } |
---|
395 | |
---|
396 | /** |
---|
397 | * |
---|
398 | */ |
---|
399 | @Test |
---|
400 | public void testScrollSeldomRequired_07() { |
---|
401 | RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule(); |
---|
402 | |
---|
403 | // ===== check ===== |
---|
404 | String spec = |
---|
405 | "UserSession {" + |
---|
406 | " Sequence seq1 {" + |
---|
407 | " Interaction elem1 {}" + |
---|
408 | " Optional opt1 { }" + |
---|
409 | " }" + |
---|
410 | " Sequence seq1 {" + |
---|
411 | " Interaction elem1 {}" + |
---|
412 | " Optional opt1 { }" + |
---|
413 | " }" + |
---|
414 | " Sequence seq1 {" + |
---|
415 | " Interaction elem1 {}" + |
---|
416 | " Optional opt1 { }" + |
---|
417 | " }" + |
---|
418 | " Sequence seq1 {" + |
---|
419 | " Interaction elem1 {}" + |
---|
420 | " Optional opt1 {" + |
---|
421 | " Scroll body {}" + |
---|
422 | " }" + |
---|
423 | " }" + |
---|
424 | "}"; |
---|
425 | |
---|
426 | UsabilityDefect[] expectedDefects = new UsabilityDefect[] |
---|
427 | { new UsabilityDefect(INFO, INEFFICIENT_ACTIONS) }; |
---|
428 | |
---|
429 | assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec))); |
---|
430 | |
---|
431 | } |
---|
432 | |
---|
433 | /** |
---|
434 | * |
---|
435 | */ |
---|
436 | @Test |
---|
437 | public void testScrollSeldomRequired_08() { |
---|
438 | RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule(); |
---|
439 | |
---|
440 | // ===== check ===== |
---|
441 | String spec = |
---|
442 | "UserSession {" + |
---|
443 | " Sequence seq1 {" + |
---|
444 | " Optional opt1 { }" + |
---|
445 | " Interaction elem1 {}" + |
---|
446 | " }" + |
---|
447 | " Sequence seq1 {" + |
---|
448 | " Optional opt1 { }" + |
---|
449 | " Interaction elem1 {}" + |
---|
450 | " }" + |
---|
451 | " Sequence seq1 {" + |
---|
452 | " Optional opt1 { }" + |
---|
453 | " Interaction elem1 {}" + |
---|
454 | " }" + |
---|
455 | " Sequence seq1 {" + |
---|
456 | " Optional opt1 {" + |
---|
457 | " Scroll body {}" + |
---|
458 | " }" + |
---|
459 | " Interaction elem1 {}" + |
---|
460 | " }" + |
---|
461 | " Sequence seq1 {" + |
---|
462 | " Optional opt1 { }" + |
---|
463 | " Interaction elem1 {}" + |
---|
464 | " }" + |
---|
465 | " Sequence seq1 {" + |
---|
466 | " Optional opt1 { }" + |
---|
467 | " Interaction elem1 {}" + |
---|
468 | " }" + |
---|
469 | " Sequence seq1 {" + |
---|
470 | " Optional opt1 { }" + |
---|
471 | " Interaction elem1 {}" + |
---|
472 | " }" + |
---|
473 | " Sequence seq1 {" + |
---|
474 | " Optional opt1 { }" + |
---|
475 | " Interaction elem1 {}" + |
---|
476 | " }" + |
---|
477 | "}"; |
---|
478 | |
---|
479 | UsabilityDefect[] expectedDefects = new UsabilityDefect[] { }; |
---|
480 | |
---|
481 | assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec))); |
---|
482 | |
---|
483 | } |
---|
484 | |
---|
485 | /** |
---|
486 | * |
---|
487 | */ |
---|
488 | @Test |
---|
489 | public void testScrollSeldomRequired_09() { |
---|
490 | RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule(); |
---|
491 | |
---|
492 | // ===== check ===== |
---|
493 | String spec = |
---|
494 | "UserSession {" + |
---|
495 | " Sequence seq1 {" + |
---|
496 | " Interaction elem1 {}" + |
---|
497 | " Optional opt1 { }" + |
---|
498 | " }" + |
---|
499 | " Sequence seq1 {" + |
---|
500 | " Interaction elem1 {}" + |
---|
501 | " Optional opt1 { }" + |
---|
502 | " }" + |
---|
503 | " Sequence seq1 {" + |
---|
504 | " Interaction elem1 {}" + |
---|
505 | " Optional opt1 { }" + |
---|
506 | " }" + |
---|
507 | " Sequence seq1 {" + |
---|
508 | " Interaction elem1 {}" + |
---|
509 | " Optional opt1 {" + |
---|
510 | " Scroll body {}" + |
---|
511 | " }" + |
---|
512 | " }" + |
---|
513 | " Sequence seq1 {" + |
---|
514 | " Interaction elem1 {}" + |
---|
515 | " Optional opt1 { }" + |
---|
516 | " }" + |
---|
517 | " Sequence seq1 {" + |
---|
518 | " Interaction elem1 {}" + |
---|
519 | " Optional opt1 { }" + |
---|
520 | " }" + |
---|
521 | " Sequence seq1 {" + |
---|
522 | " Interaction elem1 {}" + |
---|
523 | " Optional opt1 { }" + |
---|
524 | " }" + |
---|
525 | " Sequence seq1 {" + |
---|
526 | " Interaction elem1 {}" + |
---|
527 | " Optional opt1 { }" + |
---|
528 | " }" + |
---|
529 | "}"; |
---|
530 | |
---|
531 | UsabilityDefect[] expectedDefects = new UsabilityDefect[] { }; |
---|
532 | |
---|
533 | assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec))); |
---|
534 | |
---|
535 | } |
---|
536 | } |
---|