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