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

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