Changeset 1335


Ignore:
Timestamp:
01/24/14 13:50:29 (10 years ago)
Author:
pharms
Message:
  • corrected and extended usability evaluations
  • checking now more text field specific for required input formats and word repetitions
  • checking also for required scrolls
Location:
trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-core-usability-test/src/test/java/de/ugoe/cs/autoquest/usability/AbstractUsabilityEvaluationTC.java

    r1210 r1335  
    5050 
    5151    /** 
    52    * 
    53    */ 
     52     * 
     53     */ 
    5454    @Before 
    5555    public void setUp() { 
     
    5858 
    5959    /** 
    60    * 
    61    */ 
     60     * 
     61     */ 
    6262    protected ITaskModel createTaskModel(String spec) { 
    6363        TaskTreeDecoder decoder = new TaskTreeDecoder(taskFactory, taskBuilder); 
     
    8282                                                   UsabilityEvaluationResult evaluationResult) 
    8383    { 
    84         assertEquals(expectedDefects.length, evaluationResult.getAllDefects().size()); 
     84        assertEquals(evaluationResult.getAllDefects().toString(), 
     85                     expectedDefects.length, evaluationResult.getAllDefects().size()); 
    8586 
    8687        EXPECTED_DEFECT_ITERATION: 
  • trunk/autoquest-core-usability-test/src/test/java/de/ugoe/cs/autoquest/usability/TextInputStatisticsRuleTest.java

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

    r1301 r1335  
    1919import java.util.Collection; 
    2020import java.util.HashMap; 
     21import java.util.HashSet; 
     22import java.util.LinkedList; 
    2123import java.util.List; 
    2224import java.util.Map; 
     25import java.util.Set; 
    2326 
    2427import de.ugoe.cs.autoquest.eventcore.IEventTarget; 
     
    2730import de.ugoe.cs.autoquest.eventcore.guimodel.ITextArea; 
    2831import de.ugoe.cs.autoquest.eventcore.guimodel.ITextField; 
    29 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
    3032import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 
    31 import de.ugoe.cs.autoquest.tasktrees.treeifc.IMarkingTemporalRelationship; 
    32 import de.ugoe.cs.autoquest.tasktrees.treeifc.IStructuringTemporalRelationship; 
    33 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     33import de.ugoe.cs.autoquest.tasktrees.treeifc.IIterationInstance; 
     34import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptionalInstance; 
     35import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelectionInstance; 
     36import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequenceInstance; 
    3437import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    3538import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 
     39import de.ugoe.cs.autoquest.tasktrees.treeifc.IUserSession; 
    3640 
    3741/** 
     
    4145 * @author 2012, last modified by $Author: pharms$ 
    4246 */ 
    43 public class TextInputStatisticsRule implements de.ugoe.cs.autoquest.usability.UsabilityEvaluationRule { 
     47public class TextInputStatisticsRule implements UsabilityEvaluationRule { 
    4448 
    4549    /* 
     
    5155    public UsabilityEvaluationResult evaluate(ITaskModel taskModel) { 
    5256        TextInputStatistics statistics = new TextInputStatistics(); 
    53         calculateStatistics(taskModel.getTasks(), statistics); 
     57        calculateStatistics(taskModel.getUserSessions(), statistics); 
    5458 
    5559        UsabilityEvaluationResult results = new UsabilityEvaluationResult(); 
     
    97101        if (severity != null) { 
    98102            Map<String, String> parameters = new HashMap<String, String>(); 
    99             parameters.put("textInputRatio", DecimalFormat.getInstance().format(ratio * 100) + "%"); 
     103            parameters.put("textInputRatio", DecimalFormat.getInstance().format(ratio * 100)); 
    100104 
    101105            results.addDefect 
    102                 (new UsabilityDefect(severity, UsabilityDefectDescription.TEXT_FIELD_INPUT_RATIO, 
    103                                      parameters)); 
     106                (severity, UsabilityDefectDescription.TEXT_FIELD_INPUT_RATIO, parameters); 
    104107        } 
    105108    } 
     
    111114                                                UsabilityEvaluationResult results) 
    112115    { 
    113         Map<String, Integer> words = new HashMap<String, Integer>(); 
    114         int numberOfRepeatedWords = 0; 
    115         int maxRepetitions = 0; 
    116  
    117         for (int i = 0; i < statistics.getNoOfTextFieldInputs(); i++) { 
    118             String[] fragments = statistics.getTextFieldInputFragments(i); 
    119             for (String fragment : fragments) { 
    120                 if (!"".equals(fragment.trim())) { 
    121                     Integer count = words.get(fragment); 
    122                     if (count == null) { 
    123                         words.put(fragment, 1); 
    124                     } 
    125                     else { 
    126                         count++; 
    127                         words.put(fragment, count); 
    128                         maxRepetitions = Math.max(count, maxRepetitions); 
    129  
    130                         if (count == 2) { 
    131                             // do not calculate repeated words several times 
    132                             numberOfRepeatedWords++; 
    133                         } 
    134                     } 
    135                 } 
    136             } 
    137         } 
    138  
     116        List<TextFieldCorrelation> textFieldCorrelations = 
     117            statistics.determineTextFieldCorrelations(); 
     118         
     119        for (TextFieldCorrelation entry : textFieldCorrelations) { 
     120            int noOfUsagesOfTextField1 = statistics.getUsageCount(entry.textField1); 
     121            int noOfUsagesOfTextField2 = statistics.getUsageCount(entry.textField2); 
     122            int noOfUsagesOfTextField1WithSameTextInTextField2 = entry.enteredTexts.size(); 
     123             
     124            float ratioTextField1 = 
     125                noOfUsagesOfTextField1WithSameTextInTextField2 / (float) noOfUsagesOfTextField1; 
     126             
     127            float ratioTextField2 = 
     128                noOfUsagesOfTextField1WithSameTextInTextField2 / (float) noOfUsagesOfTextField2; 
     129             
     130            createTextFieldEntryRepetitionDefect 
     131                (ratioTextField1, entry.textField1, entry.textField2, results); 
     132             
     133            createTextFieldEntryRepetitionDefect 
     134                (ratioTextField2, entry.textField2, entry.textField1, results); 
     135             
     136        } 
     137    } 
     138 
     139    /** 
     140     * 
     141     */ 
     142    private void createTextFieldEntryRepetitionDefect(float                     ratioOfEqualEntries, 
     143                                                      ITextField                textField1, 
     144                                                      ITextField                textField2, 
     145                                                      UsabilityEvaluationResult results) 
     146    { 
    139147        UsabilityDefectSeverity severity = null; 
    140         if ((numberOfRepeatedWords > 10) || (maxRepetitions > 10)) { 
     148        if (ratioOfEqualEntries > 0.9) { 
    141149            severity = UsabilityDefectSeverity.HIGH; 
    142150        } 
    143         else if ((numberOfRepeatedWords > 4) || (maxRepetitions > 4)) { 
     151        else if (ratioOfEqualEntries > 0.5) { 
    144152            severity = UsabilityDefectSeverity.MEDIUM; 
    145153        } 
    146         else if ((numberOfRepeatedWords > 2) || (maxRepetitions > 2)) { 
     154        else if (ratioOfEqualEntries > 0.2) { 
    147155            severity = UsabilityDefectSeverity.LOW; 
    148156        } 
    149         else if ((numberOfRepeatedWords > 1) || (maxRepetitions > 1)) { 
     157        else if (ratioOfEqualEntries > 0.1) { 
    150158            severity = UsabilityDefectSeverity.INFO; 
    151159        } 
    152  
     160         
    153161        if (severity != null) { 
    154162            Map<String, String> parameters = new HashMap<String, String>(); 
    155             parameters.put("textRepetitionRatio", numberOfRepeatedWords + 
    156                            " repeated tokens, up to " + maxRepetitions + " repetitions per token"); 
     163            parameters.put("textRepetitionRatio", 
     164                           DecimalFormat.getInstance().format(ratioOfEqualEntries * 100)); 
     165            parameters.put("textField1", textField1.toString()); 
     166            parameters.put("textField2", textField2.toString()); 
    157167 
    158168            results.addDefect 
    159                 (new UsabilityDefect(severity, 
    160                                      UsabilityDefectDescription.TEXT_FIELD_INPUT_REPETITIONS, 
    161                                      parameters)); 
     169                (severity, UsabilityDefectDescription.TEXT_FIELD_INPUT_REPETITIONS, parameters); 
    162170        } 
    163171    } 
     
    169177                                                     UsabilityEvaluationResult results) 
    170178    { 
    171         int allCharactersCount = 0; 
    172         int noLetterOrDigitCount = 0; 
    173  
    174         for (int i = 0; i < statistics.getNoOfTextFieldInputs(); i++) { 
    175             String[] fragments = statistics.getTextFieldInputFragments(i); 
    176             for (String fragment : fragments) { 
    177                 String effectiveFragment = fragment.trim(); 
    178                 for (int j = 0; j < effectiveFragment.length(); j++) { 
    179                     if (!Character.isWhitespace(effectiveFragment.charAt(j))) { 
    180                         if (!Character.isLetterOrDigit(effectiveFragment.charAt(j))) { 
     179        for (ITextField textField : statistics.getAllTextFields()) { 
     180            int allCharactersCount = 0; 
     181            int noLetterOrDigitCount = 0; 
     182 
     183            for (String textInput : statistics.getAllInputsInto(textField)) { 
     184                for (int j = 0; j < textInput.length(); j++) { 
     185                    if (!Character.isWhitespace(textInput.charAt(j))) { 
     186                        if (!Character.isLetterOrDigit(textInput.charAt(j))) { 
    181187                            noLetterOrDigitCount++; 
    182188                        } 
     
    185191                } 
    186192            } 
    187         } 
    188  
    189         float ratio = (float) noLetterOrDigitCount / (float) allCharactersCount; 
    190  
    191         UsabilityDefectSeverity severity = null; 
    192         if (ratio > 0.1) // every 10th sign 
    193         { 
    194             severity = UsabilityDefectSeverity.HIGH; 
    195         } 
    196         else if (ratio > 0.05) // every 20th sign 
    197         { 
    198             severity = UsabilityDefectSeverity.MEDIUM; 
    199         } 
    200         else if (ratio > 0.02) // every 50th sign 
    201         { 
    202             severity = UsabilityDefectSeverity.LOW; 
    203         } 
    204         else if (ratio > 0.01) // every 100th sign 
    205         { 
    206             severity = UsabilityDefectSeverity.INFO; 
    207         } 
    208  
    209         if (severity != null) { 
    210             Map<String, String> parameters = new HashMap<String, String>(); 
    211             parameters.put("noLetterOrDigitRatio", allCharactersCount + " entered characters of " + 
    212                            "which " + noLetterOrDigitCount + " were no letter or digit"); 
    213  
    214             results.addDefect 
    215                 (new UsabilityDefect(severity, 
    216                                      UsabilityDefectDescription.TEXT_FIELD_NO_LETTER_OR_DIGIT_RATIO, 
    217                                      parameters)); 
     193 
     194            float ratio = (float) noLetterOrDigitCount / (float) allCharactersCount; 
     195 
     196            UsabilityDefectSeverity severity = null; 
     197            if (ratio > 0.1) { // every 10th sign 
     198                severity = UsabilityDefectSeverity.HIGH; 
     199            } 
     200            else if (ratio > 0.05) { // every 20th sign 
     201                severity = UsabilityDefectSeverity.MEDIUM; 
     202            } 
     203            else if (ratio > 0.02) { // every 50th sign 
     204                severity = UsabilityDefectSeverity.LOW; 
     205            } 
     206            else if (ratio > 0.01) { // every 100th sign 
     207                severity = UsabilityDefectSeverity.INFO; 
     208            } 
     209 
     210            if (severity != null) { 
     211                Map<String, String> parameters = new HashMap<String, String>(); 
     212                parameters.put("textField", textField.toString()); 
     213                parameters.put("noLetterOrDigitRatio", 
     214                               DecimalFormat.getInstance().format(ratio * 100)); 
     215 
     216                results.addDefect 
     217                    (severity, UsabilityDefectDescription.TEXT_FIELD_NO_LETTER_OR_DIGIT_RATIO, parameters); 
     218            } 
    218219        } 
    219220    } 
     
    222223     *  
    223224     */ 
    224     private void calculateStatistics(Collection<ITask> tasks, TextInputStatistics statistics) { 
    225         for (ITask task : tasks) { 
    226             calculateStatistics(task, statistics); 
    227         } 
    228     } 
    229  
    230     /** 
    231      * 
    232      */ 
    233     private void calculateStatistics(ITask task, TextInputStatistics statistics) { 
    234          
    235         if (isTextInput(task)) { 
    236             calculateStatistics((IEventTask) task, statistics); 
     225    private void calculateStatistics(Collection<IUserSession> sessions, 
     226                                     TextInputStatistics      statistics) 
     227    { 
     228        System.out.print("calculating statistics ... "); 
     229        for (IUserSession session : sessions) { 
     230            for (ITaskInstance taskInstance : session) { 
     231                calculateStatistics(taskInstance, session, statistics); 
     232            } 
     233        } 
     234        System.out.println("done"); 
     235    } 
     236 
     237    /** 
     238     * 
     239     */ 
     240    private void calculateStatistics(ITaskInstance       taskInstance, 
     241                                     IUserSession        session, 
     242                                     TextInputStatistics statistics) 
     243    { 
     244        if (isTextInput(taskInstance)) { 
     245            calculateStatistics((IEventTaskInstance) taskInstance, session, statistics); 
    237246        } 
    238247        else { 
    239             if (task instanceof IStructuringTemporalRelationship) { 
    240                 for (ITask child : ((IStructuringTemporalRelationship) task).getChildren()) { 
    241                     calculateStatistics(child, statistics); 
    242                 } 
    243             } 
    244             else if (task instanceof IMarkingTemporalRelationship) { 
     248            if (taskInstance instanceof ISequenceInstance) { 
     249                for (ITaskInstance child : (ISequenceInstance) taskInstance) { 
     250                    calculateStatistics(child, session, statistics); 
     251                } 
     252            } 
     253            else if (taskInstance instanceof IIterationInstance) { 
     254                for (ITaskInstance child : (IIterationInstance) taskInstance) { 
     255                    calculateStatistics(child, session, statistics); 
     256                } 
     257            } 
     258            else if (taskInstance instanceof ISelectionInstance) { 
    245259                calculateStatistics 
    246                     (((IMarkingTemporalRelationship) task).getMarkedTask(), statistics); 
    247             } 
    248             else { 
     260                    (((ISelectionInstance) taskInstance).getChild(), session, statistics); 
     261            } 
     262            else if (taskInstance instanceof IOptionalInstance) { 
     263                calculateStatistics 
     264                    (((IOptionalInstance) taskInstance).getChild(), session, statistics); 
     265            } 
     266            else{ 
    249267                statistics.incrementNoOfOtherEventTasks(); 
    250268            } 
     
    255273     * 
    256274     */ 
    257     private boolean isTextInput(ITask task) { 
    258         if (task.getInstances().size() > 0) { 
    259             ITaskInstance instance = task.getInstances().iterator().next(); 
    260             if (instance instanceof IEventTaskInstance) { 
    261                 return ((IEventTaskInstance) instance).getEvent().getType() instanceof TextInput; 
    262             } 
     275    private boolean isTextInput(ITaskInstance taskInstance) { 
     276        if (taskInstance instanceof IEventTaskInstance) { 
     277            return ((IEventTaskInstance) taskInstance).getEvent().getType() instanceof TextInput; 
    263278        } 
    264279 
     
    269284     * 
    270285     */ 
    271     private void calculateStatistics(IEventTask node, TextInputStatistics statistics) { 
    272          
    273         for (ITaskInstance instance : node.getInstances()) { 
    274             IEventType type = ((IEventTaskInstance) instance).getEvent().getType(); 
    275             IEventTarget target = ((IEventTaskInstance) instance).getEvent().getTarget(); 
    276  
    277             if (type instanceof TextInput) { 
    278                 String[] fragments = 
    279                     determineTextFragments(((TextInput) type).getEnteredText()); 
    280                  
    281                 if (target instanceof ITextField) { 
    282                     statistics.addTextFieldInput(node, fragments); 
    283                 } 
    284                 else if (target instanceof ITextArea) { 
    285                     statistics.addTextAreaInput(node, fragments); 
    286                 } 
    287             } 
    288         } 
    289     } 
    290  
    291     /** 
    292      * 
    293      */ 
    294     private String[] determineTextFragments(String enteredText) { 
     286    private void calculateStatistics(IEventTaskInstance  taskInstance, 
     287                                     IUserSession        session, 
     288                                     TextInputStatistics statistics) 
     289    { 
     290        IEventType type = taskInstance.getEvent().getType(); 
     291        IEventTarget target = taskInstance.getEvent().getTarget(); 
     292 
     293        if (type instanceof TextInput) { 
     294            if (target instanceof ITextField) { 
     295                statistics.addTextFieldInput(taskInstance, session); 
     296            } 
     297            else if (target instanceof ITextArea) { 
     298                statistics.addTextAreaInput(taskInstance, session); 
     299            } 
     300        } 
     301    } 
     302 
     303    /** 
     304     * 
     305     */ 
     306/*    private static String[] determineTextFragments(String enteredText) { 
    295307        List<String> fragments = new ArrayList<String>(); 
    296308 
     
    304316                // the previous fragment ended. so finalize it and start a new one 
    305317                if ((fragment != null) && (fragment.length() > 0)) { 
    306                     fragments.add(fragment.toString()); 
     318                    String fragmentStr = fragment.toString().trim(); 
     319                     
     320                    if (!"".equals(fragmentStr)) { 
     321                        fragments.add(fragmentStr); 
     322                    } 
     323                     
    307324                    fragment = new StringBuffer(); 
    308325                } 
     
    314331 
    315332        if ((fragment != null) && (fragment.length() > 0)) { 
    316             fragments.add(fragment.toString()); 
     333            String fragmentStr = fragment.toString().trim(); 
     334             
     335            if (!"".equals(fragmentStr)) { 
     336                fragments.add(fragmentStr); 
     337            } 
    317338        } 
    318339 
     
    323344     * 
    324345     */ 
    325     private boolean isEqualCharacterType(char char1, char char2) { 
     346/*    private static boolean isEqualCharacterType(char char1, char char2) { 
    326347        return 
    327348            ((char1 == char2) || 
     
    330351            (Character.isLetter(char1) && Character.isLetter(char2)) || 
    331352            (Character.isJavaIdentifierPart(char1) && Character.isJavaIdentifierPart(char2))); 
    332     } 
    333  
    334     /** 
    335      * TODO comment 
     353    }*/ 
     354 
     355    /** 
     356     * 
     357     */ 
     358    private static class TextInputStatistics { 
     359         
     360        /** */ 
     361        private List<IEventTaskInstance> textFieldInputs = new ArrayList<IEventTaskInstance>(); 
     362         
     363        /** */ 
     364        private Map<ITextField, List<String>> textFields = new HashMap<ITextField, List<String>>(); 
     365 
     366        /** */ 
     367        private List<IEventTaskInstance> textAreaInputs = new ArrayList<IEventTaskInstance>(); 
     368 
     369        /** */ 
     370        private Map<IUserSession, Map<String, TextEntryData>> textEntries = 
     371            new HashMap<IUserSession, Map<String, TextEntryData>>(); 
     372 
     373        /** */ 
     374        private int otherEventsCount; 
     375 
     376        /** 
     377         * 
     378         */ 
     379        private void addTextFieldInput(IEventTaskInstance instance, IUserSession session) { 
     380            String enteredText = ((TextInput) instance.getEvent().getType()).getEnteredText(); 
     381             
     382            if ((enteredText != null) && (!"".equals(enteredText.trim()))) { 
     383                enteredText = enteredText.trim(); 
     384                 
     385                textFieldInputs.add(instance); 
     386 
     387                // store text entries into text fields 
     388                List<String> entries = textFields.get(instance.getEvent().getTarget()); 
     389 
     390                if (entries == null) { 
     391                    entries = new LinkedList<String>(); 
     392                    textFields.put((ITextField) instance.getEvent().getTarget(), entries); 
     393                } 
     394                 
     395                entries.add(enteredText); 
     396 
     397                // writing down all text entries in text fields to check later for cooccurrences in 
     398                // same session 
     399                Map<String, TextEntryData> sessionTextEntries = textEntries.get(session); 
     400 
     401                if (sessionTextEntries == null) { 
     402                    sessionTextEntries = new HashMap<String, TextEntryData>(); 
     403                    textEntries.put(session, sessionTextEntries); 
     404                } 
     405 
     406                TextEntryData data = sessionTextEntries.get(enteredText); 
     407 
     408                if (data == null) { 
     409                    data = new TextEntryData(enteredText); 
     410                    sessionTextEntries.put(enteredText, data); 
     411                } 
     412 
     413                data.addTaskInstance(instance); 
     414            } 
     415        } 
     416         
     417        /** 
     418         * 
     419         */ 
     420        public List<String> getAllInputsInto(ITextField textField) { 
     421            return textFields.get(textField); 
     422        } 
     423 
     424        /** 
     425         * 
     426         */ 
     427        private int getUsageCount(ITextField textField) { 
     428            List<String> entries = textFields.get(textField); 
     429             
     430            if (entries == null) { 
     431                return 0; 
     432            } 
     433            else { 
     434                return entries.size(); 
     435            } 
     436        } 
     437 
     438        /** 
     439         * 
     440         */ 
     441        private List<TextFieldCorrelation> determineTextFieldCorrelations() { 
     442            System.out.print("determining text field correlations of " + textFields.size() + 
     443                             " text fields ... "); 
     444            List<TextFieldCorrelation> correlations = new ArrayList<TextFieldCorrelation>(); 
     445             
     446            // we need an ordered list of text fields to be able compare all with each other 
     447            // through a nested loop 
     448            List<ITextField> textFieldList = getAllTextFields(); 
     449             
     450            List<TextEntryData> relevantTextEntryData = new LinkedList<TextEntryData>(); 
     451             
     452            for (Map<String, TextEntryData> sessionSpecEntries : textEntries.values()) { 
     453                for (TextEntryData data : sessionSpecEntries.values()) { 
     454                    if (data.textFields.size() > 1) { 
     455                        relevantTextEntryData.add(data); 
     456                    } 
     457                } 
     458            } 
     459             
     460            for (int i = 0; i < (textFieldList.size() - 1); i++) { 
     461                for (int j = i + 1; j < textFieldList.size(); j++) { 
     462                    // count the number of times, in which the same text was entered in both 
     463                    // text fields within the same session 
     464                    List<String> sameEnteredTexts = new LinkedList<String>(); 
     465 
     466                    for (TextEntryData data : relevantTextEntryData) { 
     467                        if (data.textFields.contains(textFieldList.get(i)) && 
     468                            data.textFields.contains(textFieldList.get(j))) 
     469                        { 
     470                            sameEnteredTexts.add(data.enteredText); 
     471                        } 
     472                    } 
     473 
     474                    if (sameEnteredTexts.size() > 0) { 
     475                        // for the checked combination of text fields, there is at least once 
     476                        // the same text entered into both text fields during the same session 
     477                        correlations.add(new TextFieldCorrelation(textFieldList.get(i), 
     478                                                                  textFieldList.get(j), 
     479                                                                  sameEnteredTexts)); 
     480                    } 
     481                } 
     482            } 
     483             
     484            System.out.println("done"); 
     485             
     486            return correlations; 
     487        } 
     488 
     489        /** 
     490         * 
     491         */ 
     492        private void addTextAreaInput(IEventTaskInstance instance, IUserSession session) { 
     493            textAreaInputs.add(instance); 
     494        } 
     495 
     496        /** 
     497         * 
     498         */ 
     499        private int getNoOfAllEvents() { 
     500            return textFieldInputs.size() + textAreaInputs.size() + otherEventsCount; 
     501        } 
     502 
     503        /** 
     504         * 
     505         */ 
     506        private int getNoOfTextFieldInputs() { 
     507            return textFieldInputs.size(); 
     508        } 
     509 
     510        /** 
     511         * 
     512         */ 
     513        private int getNoOfTextAreaInputs() { 
     514            return textAreaInputs.size(); 
     515        } 
     516 
     517        /** 
     518         * 
     519         */ 
     520        private void incrementNoOfOtherEventTasks() { 
     521            otherEventsCount++; 
     522        } 
     523 
     524        /** 
     525         *  
     526         */ 
     527        private List<ITextField> getAllTextFields() { 
     528            List<ITextField> textFieldList = new ArrayList<ITextField>(textFields.size()); 
     529             
     530            for (ITextField textField : textFields.keySet()) { 
     531                textFieldList.add(textField); 
     532            } 
     533             
     534            return textFieldList; 
     535        } 
     536    } 
     537     
     538    /** 
    336539     *  
    337      * @version $Revision: $ $Date: 16.07.2012$ 
    338      * @author 2012, last modified by $Author: pharms$ 
    339      */ 
    340     public static class TextInputStatistics { 
    341          
    342         /** */ 
    343         private List<Object[]> textFieldInputs = new ArrayList<Object[]>(); 
    344  
    345         /** */ 
    346         private List<Object[]> textAreaInputs = new ArrayList<Object[]>(); 
    347  
    348         /** */ 
    349         private int otherEventsCount; 
    350  
    351         /** 
    352          * 
    353          */ 
    354         public void addTextFieldInput(IEventTask node, String[] fragments) { 
    355             textFieldInputs.add(new Object[] { node, fragments }); 
    356         } 
    357  
    358         /** 
    359          * 
    360          */ 
    361         public void addTextAreaInput(IEventTask node, String[] fragments) { 
    362             textAreaInputs.add(new Object[] { node, fragments }); 
    363         } 
    364  
    365         /** 
    366          * 
    367          */ 
    368         public int getNoOfAllEvents() { 
    369             return textFieldInputs.size() + textAreaInputs.size() + otherEventsCount; 
    370         } 
    371  
    372         /** 
    373          * 
    374          */ 
    375         public int getNoOfTextFieldInputs() { 
    376             return textFieldInputs.size(); 
    377         } 
    378  
    379         /** 
    380          * 
    381          */ 
    382         public String[] getTextFieldInputFragments(int index) { 
    383             return (String[]) textFieldInputs.get(index)[1]; 
    384         } 
    385  
    386         /** 
    387          * 
    388          */ 
    389         public int getNoOfTextAreaInputs() { 
    390             return textAreaInputs.size(); 
    391         } 
    392  
    393         /** 
    394          * 
    395          */ 
    396         public String[] getTextAreaInputFragments(int index) { 
    397             return (String[]) textAreaInputs.get(index)[1]; 
    398         } 
    399  
    400         /** 
    401          * 
    402          */ 
    403         public void incrementNoOfOtherEventTasks() { 
    404             otherEventsCount++; 
     540     */ 
     541    private static class TextEntryData { 
     542         
     543        /** */ 
     544        private String enteredText; 
     545         
     546        /** */ 
     547        private List<IEventTaskInstance> respectiveTaskInstances = 
     548            new LinkedList<IEventTaskInstance>(); 
     549 
     550        /** */ 
     551        private Set<ITextField> textFields = new HashSet<ITextField>(); 
     552         
     553        /** 
     554         * 
     555         */ 
     556        private TextEntryData(String text) { 
     557            this.enteredText = text; 
     558        } 
     559 
     560        /** 
     561         * 
     562         */ 
     563        private void addTaskInstance(IEventTaskInstance instance) { 
     564            respectiveTaskInstances.add(instance); 
     565            textFields.add((ITextField) instance.getEvent().getTarget()); 
     566        } 
     567         
     568    } 
     569 
     570    /** 
     571     *  
     572     */ 
     573    private static class TextFieldCorrelation { 
     574         
     575        /** */ 
     576        private List<String> enteredTexts = new LinkedList<String>(); 
     577 
     578        /** */ 
     579        private ITextField textField1; 
     580         
     581        /** */ 
     582        private ITextField textField2; 
     583         
     584        /** 
     585         * 
     586         */ 
     587        private TextFieldCorrelation(ITextField   textField1, 
     588                                     ITextField   textField2, 
     589                                     List<String> enteredTexts) 
     590        { 
     591            this.textField1 = textField1; 
     592            this.textField2 = textField2; 
     593            this.enteredTexts = enteredTexts; 
    405594        } 
    406595 
  • trunk/autoquest-core-usability/src/main/java/de/ugoe/cs/autoquest/usability/UsabilityDefect.java

    r1301 r1335  
    3737     * 
    3838     */ 
    39     public UsabilityDefect(UsabilityDefectSeverity severity, UsabilityDefectDescription description) 
     39    UsabilityDefect(UsabilityDefectSeverity severity, UsabilityDefectDescription description) 
    4040    { 
    4141        this(severity, description, null); 
     
    4545     * 
    4646     */ 
    47     public UsabilityDefect(UsabilityDefectSeverity    severity, 
    48                            UsabilityDefectDescription description, 
    49                            Map<String, String>        parameters) 
     47    UsabilityDefect(UsabilityDefectSeverity    severity, 
     48                    UsabilityDefectDescription description, 
     49                    Map<String, String>        parameters) 
    5050    { 
    5151        this.severity = severity; 
  • trunk/autoquest-core-usability/src/main/java/de/ugoe/cs/autoquest/usability/UsabilityDefectDescription.java

    r1301 r1335  
    3333public enum UsabilityDefectDescription { 
    3434     
     35    SCROLL_REQUIRED, 
    3536    TEXT_FIELD_INPUT_RATIO, 
    3637    TEXT_FIELD_INPUT_REPETITIONS, 
  • trunk/autoquest-core-usability/src/main/java/de/ugoe/cs/autoquest/usability/UsabilityEvaluationManager.java

    r1301 r1335  
    4646    private void init() { 
    4747        rules.add(new TextInputStatisticsRule()); 
     48        rules.add(new RequiredScrollRule()); 
    4849    } 
    4950 
     
    5455        Console.traceln(Level.INFO, "evaluating usability of task model " + taskModel); 
    5556 
    56         List<UsabilityEvaluationResult> results = new ArrayList<UsabilityEvaluationResult>(); 
     57        List<UsabilityEvaluationResult> interimResults = new ArrayList<UsabilityEvaluationResult>(); 
    5758 
    5859        for (UsabilityEvaluationRule rule : rules) { 
    5960            Console.traceln(Level.INFO, "applying rule " + rule.getClass().getSimpleName()); 
    6061            UsabilityEvaluationResult result = rule.evaluate(taskModel); 
    61             results.add(result); 
     62            interimResults.add(result); 
    6263            Console.traceln(Level.INFO, "the rule found " + result.getAllDefects().size() + 
    6364                            " usability defects, of which " + result.getSevereDefects().size() + 
     
    6566        } 
    6667 
    67         UsabilityEvaluationResult result = mergeResults(results); 
     68        UsabilityEvaluationResult result = new UsabilityEvaluationResult(interimResults); 
    6869        Console.println("the evaluation result contains " + result.getAllDefects().size() + 
    6970                        " defects, of which " + result.getSevereDefects().size() + " are severe."); 
    70         return result; 
    71     } 
    7271 
    73     /** 
    74      * 
    75      */ 
    76     private UsabilityEvaluationResult mergeResults(List<UsabilityEvaluationResult> results) { 
    77         UsabilityEvaluationResult result = new UsabilityEvaluationResult(); 
    78  
    79         for (UsabilityEvaluationResult ruleResult : results) { 
    80             for (UsabilityDefect defect : ruleResult.getAllDefects()) { 
    81                 result.addDefect(defect); 
    82             } 
     72        List<UsabilityDefect> defects = result.getAllDefects(); 
     73        for (int i = 0; i < defects.size(); i++) { 
     74            Console.println((i + 1) + ": " + defects.get(i).getParameterizedDescription()); 
    8375        } 
    8476 
  • trunk/autoquest-core-usability/src/main/java/de/ugoe/cs/autoquest/usability/UsabilityEvaluationResult.java

    r1301 r1335  
    1717import java.util.ArrayList; 
    1818import java.util.List; 
     19import java.util.Map; 
    1920 
    2021/** 
     
    3233     * 
    3334     */ 
    34     public void addDefect(UsabilityDefect defect) { 
    35         defects.add(defect); 
     35    public UsabilityEvaluationResult() { 
     36        // default constructor 
     37    } 
     38 
     39    /** 
     40     * 
     41     */ 
     42    public UsabilityEvaluationResult(List<UsabilityEvaluationResult> results) { 
     43        for (UsabilityEvaluationResult result : results) { 
     44            for (UsabilityDefect defect : result.getAllDefects()) { 
     45                defects.add(defect); 
     46            } 
     47        } 
     48    } 
     49 
     50    /** 
     51     * 
     52     */ 
     53    public void addDefect(UsabilityDefectSeverity    severity, 
     54                          UsabilityDefectDescription description, 
     55                          Map<String, String>        parameters) 
     56    { 
     57        defects.add(new UsabilityDefect(severity, description, parameters)); 
    3658    } 
    3759 
  • trunk/autoquest-core-usability/src/main/resources/defectDescriptions_en.xml

    r496 r1335  
    1212    <parameterFragment parameterName="textInputRatio" /> 
    1313    <textFragment> 
    14       ). This should be reduced. As an example, entering data can also be done using check boxes 
     14      %). This should be reduced. As an example, entering data can also be done using check boxes 
    1515      or combo boxes in the case predefined values must be entered. 
    1616    </textFragment> 
     
    1919  <defectDescription defectId="TEXT_FIELD_INPUT_REPETITIONS"> 
    2020    <textFragment> 
    21       Several interactions that enter text into text fields repeat tokens such as words or 
    22       specific signs ( 
     21      In 
    2322    </textFragment> 
    2423    <parameterFragment parameterName="textRepetitionRatio" /> 
    2524    <textFragment> 
    26       ). This is an indicator that the same data must be entered several times. This could be 
    27       better supported by using e.g. automatic filling of input fields, provision of combo 
    28       boxes or lists prefilled with data that was already entered previously.  
     25      % of entering text into text field  
     26    </textFragment> 
     27    <parameterFragment parameterName="textField1" /> 
     28    <textFragment> 
     29      , the same text was also entered into text field 
     30    </textFragment> 
     31    <parameterFragment parameterName="textField2" /> 
     32    <textFragment> 
     33      during the same session. Perhaps this can be automated, so that the user does not have to 
     34      reenter the same text several times into different text fields. 
    2935    </textFragment> 
    3036  </defectDescription> 
    3137   
    3238  <defectDescription defectId="TEXT_FIELD_NO_LETTER_OR_DIGIT_RATIO"> 
    33     <textFragment> 
    34       Much of the text entered into text fields contains signs other than letters or digits ( 
    35     </textFragment> 
    3639    <parameterFragment parameterName="noLetterOrDigitRatio" /> 
    3740    <textFragment> 
    38       ). This is an indicator that the entered data has to follow a specific syntax. This should 
    39       be supported by syntax checking, auto completion or even providing the text fields in a way 
    40       that does not require the entering of special signs as they are already included at the right 
    41       positions. 
     41      % of the text entered into text field 
     42    </textFragment> 
     43    <parameterFragment parameterName="textField" /> 
     44    <textFragment> 
     45      was no letter or digit. This is an indicator that the entered data has to follow a specific 
     46      syntax. This should be supported by syntax checking, auto completion or even providing the 
     47      text fields in a way that does not require the entering of special signs as they are already 
     48      included at the right positions. 
     49    </textFragment> 
     50  </defectDescription> 
     51   
     52  <defectDescription defectId="SCROLL_REQUIRED"> 
     53    <textFragment> 
     54      In 
     55    </textFragment> 
     56    <parameterFragment parameterName="scrollRatio" /> 
     57    <textFragment> 
     58      % of all occurrences, the task 
     59    </textFragment> 
     60    <parameterFragment parameterName="task" /> 
     61    <textFragment> 
     62      is started with a scroll. This should be prevented as scrolling decreases the efficiency of 
     63      the user and indicates, that not all required information is visible at once in the 
     64      respective view. However, scrolling for reading of texts is no problem. 
    4265    </textFragment> 
    4366  </defectDescription> 
Note: See TracChangeset for help on using the changeset viewer.