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

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