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

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