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

Last change on this file since 442 was 442, checked in by pharms, 12 years ago

Initial import.

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