source: trunk/autoquest-core-usability-test/src/test/java/de/ugoe/cs/autoquest/usability/TextInputStatisticsRuleTest.java @ 1210

Last change on this file since 1210 was 1210, checked in by pharms, 11 years ago
  • complete refactoring of task tree model with a separation of task models and task instances
File size: 22.1 KB
Line 
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
15package de.ugoe.cs.autoquest.usability;
16
17import static de.ugoe.cs.autoquest.usability.UsabilityDefectDescription.TEXT_FIELD_INPUT_RATIO;
18import static de.ugoe.cs.autoquest.usability.UsabilityDefectDescription.TEXT_FIELD_INPUT_REPETITIONS;
19import static de.ugoe.cs.autoquest.usability.UsabilityDefectDescription.TEXT_FIELD_NO_LETTER_OR_DIGIT_RATIO;
20import static de.ugoe.cs.autoquest.usability.UsabilityDefectSeverity.HIGH;
21import static de.ugoe.cs.autoquest.usability.UsabilityDefectSeverity.INFO;
22import static de.ugoe.cs.autoquest.usability.UsabilityDefectSeverity.LOW;
23import static de.ugoe.cs.autoquest.usability.UsabilityDefectSeverity.MEDIUM;
24
25import org.junit.Test;
26
27import de.ugoe.cs.autoquest.usability.UsabilityDefect;
28import de.ugoe.cs.autoquest.usability.UsabilityEvaluationManager;
29
30/**
31 * TODO comment
32 *
33 * @version $Revision: $ $Date: 18.07.2012$
34 * @author 2012, last modified by $Author: pharms$
35 */
36public class TextInputStatisticsRuleTest extends AbstractUsabilityEvaluationTC {
37
38    /**
39     * TODO: comment
40     *
41     */
42    @Test
43    public void testWithDifferentTextInputInteractionsOnly() {
44        UsabilityEvaluationManager manager = new UsabilityEvaluationManager();
45
46        // ===== check =====
47        String spec =
48            "UserSession {" +
49            "  TextInput (bla) {}" +
50            "}";
51        UsabilityDefect[] expectedDefects = new UsabilityDefect[]
52            { new UsabilityDefect(HIGH, TEXT_FIELD_INPUT_RATIO) };
53
54        assertUsabilityEvaluationResult
55            (expectedDefects, manager.evaluateUsability(createTaskModel(spec)));
56
57        // ===== check =====
58        spec =
59            "UserSession {" +
60            "  TextInput (a) {}" +
61            "  TextInput (b) {}" +
62            "  TextInput (c) {}" +
63            "  TextInput (d) {}" +
64            "}";
65
66        expectedDefects = new UsabilityDefect[]
67            { new UsabilityDefect(HIGH, TEXT_FIELD_INPUT_RATIO) };
68
69        assertUsabilityEvaluationResult
70            (expectedDefects, manager.evaluateUsability(createTaskModel(spec)));
71
72        // ===== check =====
73        spec =
74            "UserSession {" +
75            "  TextInput (a) {}" +
76            "  TextInput (b) {}" +
77            "  TextInput (c) {}" +
78            "  TextInput (d) {}" +
79            "}";
80
81        expectedDefects = new UsabilityDefect[]
82            { new UsabilityDefect(HIGH, TEXT_FIELD_INPUT_RATIO) };
83
84        assertUsabilityEvaluationResult
85            (expectedDefects, manager.evaluateUsability(createTaskModel(spec)));
86
87        // ===== check =====
88        spec =
89            "Iteration {" +
90            "  TextInput (bla) {}" +
91            "}";
92
93        expectedDefects = new UsabilityDefect[]
94            { new UsabilityDefect(HIGH, TEXT_FIELD_INPUT_RATIO) };
95
96        assertUsabilityEvaluationResult
97            (expectedDefects, manager.evaluateUsability(createTaskModel(spec)));
98
99        // ===== check =====
100        spec =
101            "Sequence {" +
102            "  TextInput (a) {}" +
103            "  Sequence {" +
104            "    TextInput (b) {}" +
105            "    TextInput (c) {}" +
106            "    TextInput (d) {}" +
107            "    TextInput (e) {}" +
108            "  }" +
109            "  Iteration {" +
110            "    TextInput (f) {}" +
111            "  }" +
112            "  TextInput (g) {}" +
113            "  Selection {" +
114            "    TextInput (h) {}" +
115            "    TextInput (i) {}" +
116            "    TextInput (j) {}" +
117            "    TextInput (k) {}" +
118            "  }" +
119            "  Sequence {" +
120            "    TextInput (l) {}" +
121            "    Sequence {" +
122            "      TextInput (m) {}" +
123            "      TextInput (n) {}" +
124            "      TextInput (o) {}" +
125            "      TextInput (p) {}" +
126            "    }" +
127            "    Iteration {" +
128            "      TextInput (q) {}" +
129            "    }" +
130            "    TextInput (r) {}" +
131            "    Selection {" +
132            "      TextInput (s) {}" +
133            "      TextInput (t) {}" +
134            "      TextInput (u) {}" +
135            "      TextInput (v) {}" +
136            "    }" +
137            "  }" +
138            "  Selection {" +
139            "    TextInput (w) {}" +
140            "    Sequence {" +
141            "      TextInput (x) {}" +
142            "      TextInput (y) {}" +
143            "      TextInput (z) {}" +
144            "      TextInput (aa) {}" +
145            "    }" +
146            "    Iteration {" +
147            "      TextInput (ab) {}" +
148            "    }" +
149            "    TextInput (ac) {}" +
150            "    Selection {" +
151            "      TextInput (ad) {}" +
152            "      TextInput (ae) {}" +
153            "      TextInput (af) {}" +
154            "      TextInput (ag) {}" +
155            "    }" +
156            "  }" +
157            "  TextInput (ah) {}" +
158            "}";
159
160        expectedDefects = new UsabilityDefect[]
161            { new UsabilityDefect(HIGH, TEXT_FIELD_INPUT_RATIO) };
162
163        assertUsabilityEvaluationResult
164            (expectedDefects, manager.evaluateUsability(createTaskModel(spec)));
165    }
166
167    /**
168     * TODO: comment
169     *
170     */
171    @Test
172    public void testCombinationsOfTextInputInteractionsAndOtherInteractions() {
173        UsabilityEvaluationManager manager = new UsabilityEvaluationManager();
174
175        // ===== check =====
176        String spec =
177            "Sequence {" +
178            "  Interaction {}" +
179            "  TextInput (a) {}" +
180            "  TextInput (b) {}" +
181            "  Interaction {}" +
182            "  TextInput (c) {}" +
183            "}";
184
185        UsabilityDefect[] expectedDefects = new UsabilityDefect[]
186            { new UsabilityDefect(LOW, TEXT_FIELD_INPUT_RATIO) };
187
188        assertUsabilityEvaluationResult
189            (expectedDefects, manager.evaluateUsability(createTaskModel(spec)));
190
191        // ===== check =====
192        spec =
193            "Sequence {" +
194            "  Interaction {}" +
195            "  TextInput (a) {}" +
196            "  Interaction {}" +
197            "  Interaction {}" +
198            "  TextInput (c) {}" +
199            "}";
200
201        expectedDefects = new UsabilityDefect[]
202            { new UsabilityDefect(INFO, TEXT_FIELD_INPUT_RATIO) };
203
204        assertUsabilityEvaluationResult
205            (expectedDefects, manager.evaluateUsability(createTaskModel(spec)));
206
207        // ===== check =====
208        spec =
209            "Sequence {" +
210            "  Interaction {}" +
211            "  TextInput (a) {}" +
212            "  Interaction {}" +
213            "  Interaction {}" +
214            "  Interaction {}" +
215            "}";
216
217        expectedDefects = new UsabilityDefect[0];
218
219        assertUsabilityEvaluationResult
220            (expectedDefects, manager.evaluateUsability(createTaskModel(spec)));
221
222        // ===== check =====
223        spec =
224            "Selection {" +
225            "  Interaction {}" +
226            "  TextInput (a) {}" +
227            "  TextInput (b) {}" +
228            "  Interaction {}" +
229            "  TextInput (c) {}" +
230            "}";
231
232        expectedDefects = new UsabilityDefect[]
233            { new UsabilityDefect(LOW, TEXT_FIELD_INPUT_RATIO) };
234
235        assertUsabilityEvaluationResult
236            (expectedDefects, manager.evaluateUsability(createTaskModel(spec)));
237
238        // ===== check =====
239        spec =
240            "Sequence {" +
241            "  TextInput (a) {}" +
242            "  Sequence {" +
243            "    Interaction {}" +
244            "    TextInput (b) {}" +
245            "    TextInput (c) {}" +
246            "    Interaction {}" +
247            "    TextInput (d) {}" +
248            "  }" +
249            "  Iteration {" +
250            "    TextInput (e) {}" +
251            "  }" +
252            "  Interaction {}" +
253            "  Selection {" +
254            "    Interaction {}" +
255            "    TextInput (f) {}" +
256            "    TextInput (g) {}" +
257            "    Interaction {}" +
258            "    TextInput (h) {}" +
259            "    TextInput (i) {}" +
260            "  }" +
261            "  Sequence {" +
262            "    TextInput (j) {}" +
263            "    Sequence {" +
264            "      TextInput (k) {}" +
265            "      Interaction {}" +
266            "      TextInput (l) {}" +
267            "      TextInput (m) {}" +
268            "      Interaction {}" +
269            "      TextInput (n) {}" +
270            "      TextInput (o) {}" +
271            "    }" +
272            "    Iteration {" +
273            "      Interaction {}" +
274            "    }" +
275            "    Interaction {}" +
276            "    Selection {" +
277            "      TextInput (p) {}" +
278            "      TextInput (q) {}" +
279            "      TextInput (r) {}" +
280            "      Interaction {}" +
281            "      TextInput (s) {}" +
282            "      TextInput (t) {}" +
283            "      Interaction {}" +
284            "      TextInput (u) {}" +
285            "      TextInput (v) {}" +
286            "    }" +
287            "  }" +
288            "  Selection {" +
289            "    Interaction {}" +
290            "    Sequence {" +
291            "      TextInput (w) {}" +
292            "      Interaction {}" +
293            "      TextInput (x) {}" +
294            "      TextInput (y) {}" +
295            "      Interaction {}" +
296            "    }" +
297            "    Iteration {" +
298            "      TextInput (z) {}" +
299            "    }" +
300            "    TextInput (aa) {}" +
301            "    Selection {" +
302            "      TextInput (ab) {}" +
303            "      Interaction {}" +
304            "      TextInput (ac) {}" +
305            "      TextInput (ad) {}" +
306            "      Interaction {}" +
307            "      TextInput (ae) {}" +
308            "    }" +
309            "  }" +
310            "  Interaction {}" +
311            "}";
312
313        expectedDefects = new UsabilityDefect[]
314            { new UsabilityDefect(LOW, TEXT_FIELD_INPUT_RATIO) };
315
316        assertUsabilityEvaluationResult
317            (expectedDefects, manager.evaluateUsability(createTaskModel(spec)));
318
319        // ===== check =====
320        spec =
321            "Sequence {" +
322            "  TextInput (a) {}" +
323            "  Sequence {" +
324            "    Interaction {}" +
325            "    TextInput (b) {}" +
326            "    Interaction {}" +
327            "    Interaction {}" +
328            "    TextInput (c) {}" +
329            "  }" +
330            "  Iteration {" +
331            "    TextInput (d) {}" +
332            "  }" +
333            "  Interaction {}" +
334            "  Selection {" +
335            "    Interaction {}" +
336            "    TextInput (e) {}" +
337            "    Interaction {}" +
338            "    Interaction {}" +
339            "    TextInput (g) {}" +
340            "    Interaction {}" +
341            "  }" +
342            "  Sequence {" +
343            "    TextInput (i) {}" +
344            "    Sequence {" +
345            "      TextInput (j) {}" +
346            "      Interaction {}" +
347            "      TextInput (k) {}" +
348            "      Interaction {}" +
349            "      Interaction {}" +
350            "      TextInput (m) {}" +
351            "      Interaction {}" +
352            "    }" +
353            "    Iteration {" +
354            "      Interaction {}" +
355            "    }" +
356            "    Interaction {}" +
357            "    Selection {" +
358            "      TextInput (o) {}" +
359            "      Interaction {}" +
360            "      Interaction {}" +
361            "      Interaction {}" +
362            "      Interaction {}" +
363            "      TextInput (s) {}" +
364            "      Interaction {}" +
365            "      TextInput (t) {}" +
366            "      TextInput (u) {}" +
367            "    }" +
368            "  }" +
369            "  Selection {" +
370            "    Interaction {}" +
371            "    Sequence {" +
372            "      TextInput (v) {}" +
373            "      Interaction {}" +
374            "      Interaction {}" +
375            "      TextInput (x) {}" +
376            "      Interaction {}" +
377            "    }" +
378            "    Iteration {" +
379            "      TextInput (y) {}" +
380            "    }" +
381            "    TextInput (z) {}" +
382            "    Selection {" +
383            "      TextInput (aa) {}" +
384            "      Interaction {}" +
385            "      TextInput (ab) {}" +
386            "      Interaction {}" +
387            "      Interaction {}" +
388            "      TextInput (ad) {}" +
389            "    }" +
390            "  }" +
391            "  Interaction {}" +
392            "}";
393
394        expectedDefects = new UsabilityDefect[]
395            { new UsabilityDefect(INFO, TEXT_FIELD_INPUT_RATIO) };
396
397        assertUsabilityEvaluationResult
398            (expectedDefects, manager.evaluateUsability(createTaskModel(spec)));
399    }
400
401    /**
402     * TODO: comment
403     *
404     */
405    @Test
406    public void testTextEntryRepetitions() {
407        UsabilityEvaluationManager manager = new UsabilityEvaluationManager();
408
409        // ===== check =====
410        String spec =
411            "Sequence {" +
412            "  TextInput (a b c) {}" +
413            "  Sequence {" +
414            "    TextInput (a) {}" +
415            "    TextInput (b) {}" +
416            "    TextInput (c) {}" +
417            "    TextInput (a) {}" +
418            "  }" +
419            "  Iteration {" +
420            "    TextInput (a) {}" +
421            "  }" +
422            "  TextInput (a) {}" +
423            "  Selection {" +
424            "    TextInput (b c) {}" +
425            "    TextInput (a) {}" +
426            "    TextInput (a c) {}" +
427            "    TextInput (b a) {}" +
428            "  }" +
429            "  Sequence {" +
430            "    TextInput (b c) {}" +
431            "    Sequence {" +
432            "      TextInput (d a c) {}" +
433            "      TextInput (b b b a) {}" +
434            "      TextInput (a a c c) {}" +
435            "      TextInput (b b a) {}" +
436            "    }" +
437            "  }" +
438            "  TextInput (d) {}" +
439            "}";
440
441        UsabilityDefect[] expectedDefects = new UsabilityDefect[]
442            { new UsabilityDefect(HIGH, TEXT_FIELD_INPUT_RATIO),
443              new UsabilityDefect(HIGH, TEXT_FIELD_INPUT_REPETITIONS) };
444
445        assertUsabilityEvaluationResult
446            (expectedDefects, manager.evaluateUsability(createTaskModel(spec)));
447
448        // ===== check =====
449        spec =
450            "Sequence {" +
451            "  TextInput (a b c d e f g h i j k l m) {}" +
452            "  Sequence {" +
453            "    TextInput (a) {}" +
454            "    TextInput (b) {}" +
455            "    TextInput (c) {}" +
456            "    TextInput (d) {}" +
457            "  }" +
458            "  Iteration {" +
459            "    TextInput (e) {}" +
460            "  }" +
461            "  TextInput (f) {}" +
462            "  Selection {" +
463            "    TextInput (g) {}" +
464            "    TextInput (h) {}" +
465            "    TextInput (i) {}" +
466            "    TextInput (j) {}" +
467            "  }" +
468            "  Sequence {" +
469            "    TextInput (k) {}" +
470            "    Sequence {" +
471            "      TextInput (l) {}" +
472            "      TextInput (m) {}" +
473            "      TextInput (n) {}" +
474            "      TextInput (o) {}" +
475            "    }" +
476            "  }" +
477            "  TextInput (p) {}" +
478            "}";
479
480        expectedDefects = new UsabilityDefect[]
481            { new UsabilityDefect(HIGH, TEXT_FIELD_INPUT_RATIO),
482              new UsabilityDefect(HIGH, TEXT_FIELD_INPUT_REPETITIONS) };
483
484        assertUsabilityEvaluationResult
485            (expectedDefects, manager.evaluateUsability(createTaskModel(spec)));
486
487        // ===== check =====
488        spec =
489            "Sequence {" +
490            "  TextInput (a b c d e f g h i j k l m) {}" +
491            "  Sequence {" +
492            "    TextInput (a) {}" +
493            "    TextInput (b) {}" +
494            "    TextInput (c) {}" +
495            "    TextInput (d) {}" +
496            "  }" +
497            "  Iteration {" +
498            "    TextInput (e) {}" +
499            "  }" +
500            "  TextInput (a) {}" +
501            "  Selection {" +
502            "    TextInput (b) {}" +
503            "    TextInput (c) {}" +
504            "    TextInput (d) {}" +
505            "    TextInput (e) {}" +
506            "  }" +
507            "  Sequence {" +
508            "    TextInput (a) {}" +
509            "    Sequence {" +
510            "      TextInput (b) {}" +
511            "      TextInput (c) {}" +
512            "      TextInput (d) {}" +
513            "      TextInput (e) {}" +
514            "    }" +
515            "  }" +
516            "  TextInput (f) {}" +
517            "}";
518
519        expectedDefects = new UsabilityDefect[]
520            { new UsabilityDefect(HIGH, TEXT_FIELD_INPUT_RATIO),
521              new UsabilityDefect(MEDIUM, TEXT_FIELD_INPUT_REPETITIONS) };
522
523        assertUsabilityEvaluationResult
524            (expectedDefects, manager.evaluateUsability(createTaskModel(spec)));
525
526        // ===== check =====
527        spec =
528            "Sequence {" +
529            "  TextInput (a b c d e f g h i j k l m) {}" +
530            "  Sequence {" +
531            "    TextInput (a) {}" +
532            "    TextInput (b) {}" +
533            "    TextInput (c) {}" +
534            "    TextInput (a) {}" +
535            "  }" +
536            "  Iteration {" +
537            "    TextInput (b) {}" +
538            "  }" +
539            "  TextInput (c) {}" +
540            "  Selection {" +
541            "    TextInput (a) {}" +
542            "    TextInput (b) {}" +
543            "    TextInput (c) {}" +
544            "    TextInput (a) {}" +
545            "  }" +
546            "  Sequence {" +
547            "    TextInput (b) {}" +
548            "    Sequence {" +
549            "      TextInput (c) {}" +
550            "      TextInput (a) {}" +
551            "      TextInput (b) {}" +
552            "      TextInput (c) {}" +
553            "    }" +
554            "  }" +
555            "  TextInput (a) {}" +
556            "}";
557
558        expectedDefects = new UsabilityDefect[]
559            { new UsabilityDefect(HIGH, TEXT_FIELD_INPUT_RATIO),
560              new UsabilityDefect(MEDIUM, TEXT_FIELD_INPUT_REPETITIONS) };
561
562        assertUsabilityEvaluationResult
563            (expectedDefects, manager.evaluateUsability(createTaskModel(spec)));
564
565        // ===== check =====
566        spec =
567            "Sequence {" +
568            "  TextInput (a b c) {}" +
569            "  Sequence {" +
570            "    TextInput (a) {}" +
571            "    TextInput (b) {}" +
572            "    TextInput (c) {}" +
573            "  }" +
574            "}";
575
576        expectedDefects = new UsabilityDefect[]
577            { new UsabilityDefect(HIGH, TEXT_FIELD_INPUT_RATIO),
578              new UsabilityDefect(LOW, TEXT_FIELD_INPUT_REPETITIONS) };
579
580        assertUsabilityEvaluationResult
581            (expectedDefects, manager.evaluateUsability(createTaskModel(spec)));
582
583        // ===== check =====
584        spec =
585            "Sequence {" +
586            "  TextInput (a b c) {}" +
587            "  Sequence {" +
588            "    TextInput (a) {}" +
589            "    TextInput (a) {}" +
590            "    TextInput (b) {}" +
591            "  }" +
592            "}";
593
594        expectedDefects = new UsabilityDefect[]
595            { new UsabilityDefect(HIGH, TEXT_FIELD_INPUT_RATIO),
596              new UsabilityDefect(LOW, TEXT_FIELD_INPUT_REPETITIONS) };
597
598        assertUsabilityEvaluationResult
599            (expectedDefects, manager.evaluateUsability(createTaskModel(spec)));
600
601        // ===== check =====
602        spec =
603            "Sequence {" +
604            "  TextInput (a b c) {}" +
605            "  Sequence {" +
606            "    TextInput (a) {}" +
607            "    TextInput (d) {}" +
608            "    TextInput (e) {}" +
609            "  }" +
610            "}";
611
612        expectedDefects = new UsabilityDefect[]
613            { new UsabilityDefect(HIGH, TEXT_FIELD_INPUT_RATIO),
614              new UsabilityDefect(INFO, TEXT_FIELD_INPUT_REPETITIONS) };
615
616        assertUsabilityEvaluationResult
617            (expectedDefects, manager.evaluateUsability(createTaskModel(spec)));
618
619    }
620
621    /**
622     * TODO: comment
623     *
624     */
625    @Test
626    public void testNoLetterOrDigitInput() {
627        UsabilityEvaluationManager manager = new UsabilityEvaluationManager();
628
629        // ===== check =====
630        String spec =
631            "Sequence {" +
632            "  TextInput (_a_b_c_) {}" +
633            "}";
634
635        UsabilityDefect[] expectedDefects = new UsabilityDefect[]
636            { new UsabilityDefect(HIGH, TEXT_FIELD_INPUT_RATIO),
637              new UsabilityDefect(HIGH, TEXT_FIELD_NO_LETTER_OR_DIGIT_RATIO) };
638
639        assertUsabilityEvaluationResult
640            (expectedDefects, manager.evaluateUsability(createTaskModel(spec)));
641
642        // ===== check =====
643        spec =
644            "Sequence {" +
645            "  TextInput (12345_6789012345) {}" +
646            "}";
647
648        expectedDefects = new UsabilityDefect[]
649            { new UsabilityDefect(HIGH, TEXT_FIELD_INPUT_RATIO),
650              new UsabilityDefect(MEDIUM, TEXT_FIELD_NO_LETTER_OR_DIGIT_RATIO) };
651
652        assertUsabilityEvaluationResult
653            (expectedDefects, manager.evaluateUsability(createTaskModel(spec)));
654
655        // ===== check =====
656        spec =
657            "Sequence {" +
658            "  TextInput (123456789012345678901234567890_123456789012345) {}" +
659            "}";
660
661        expectedDefects = new UsabilityDefect[]
662            { new UsabilityDefect(HIGH, TEXT_FIELD_INPUT_RATIO),
663              new UsabilityDefect(LOW, TEXT_FIELD_NO_LETTER_OR_DIGIT_RATIO) };
664
665        assertUsabilityEvaluationResult
666            (expectedDefects, manager.evaluateUsability(createTaskModel(spec)));
667
668        // ===== check =====
669        spec =
670            "Sequence {" +
671            "  TextInput (1234567890123456789012345678901234567890123456789_01234567890" +
672            "12345678901234567890123456789012345) {}" +
673            "}";
674
675        expectedDefects = new UsabilityDefect[]
676            { new UsabilityDefect(HIGH, TEXT_FIELD_INPUT_RATIO),
677              new UsabilityDefect(INFO, TEXT_FIELD_NO_LETTER_OR_DIGIT_RATIO) };
678
679        assertUsabilityEvaluationResult
680            (expectedDefects, manager.evaluateUsability(createTaskModel(spec)));
681
682    }
683}
Note: See TracBrowser for help on using the repository browser.