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

Last change on this file since 1918 was 1918, checked in by pharms, 9 years ago
  • extension with further smell detections
  • may not fully work. But Hudson is more happy because compile errors should be gone
File size: 16.0 KB
RevLine 
[1335]1//   Copyright 2012 Georg-August-Universität Göttingen, Germany
2//
3//   Licensed under the Apache License, Version 2.0 (the "License");
4//   you may not use this file except in compliance with the License.
5//   You may obtain a copy of the License at
6//
7//       http://www.apache.org/licenses/LICENSE-2.0
8//
9//   Unless required by applicable law or agreed to in writing, software
10//   distributed under the License is distributed on an "AS IS" BASIS,
11//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12//   See the License for the specific language governing permissions and
13//   limitations under the License.
14
15package de.ugoe.cs.autoquest.usability;
16
[1918]17import static de.ugoe.cs.autoquest.usability.UsabilitySmellDescription.INEFFICIENT_ACTIONS;
[1335]18
[1493]19import org.junit.Before;
[1335]20import org.junit.Test;
21
[1918]22import de.ugoe.cs.autoquest.usability.UsabilitySmell;
[1335]23
24/**
25 *
26 */
[1493]27public class RequiredInefficientActionsRuleTest extends AbstractUsabilityEvaluationTC {
[1335]28
29    /**
30     *
31     */
[1493]32    @Before
33    public void setUp() {
[1918]34        //UsabilitySmellIntensity.defaultCoverageQuantile = 0;
[1493]35    }
36   
37    /**
38     *
39     */
[1335]40    @Test
41    public void testWithNormalScroll_01() {
[1493]42        RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule();
[1335]43
44        // ===== check =====
45        String spec =
46            "UserSession {" +
47            "  Scroll body {}" +
48            "  Interaction elem1 {}" +
49            "}";
50       
[1918]51        // no smell expected, as interactions do not form tasks
52        UsabilitySmell[] expectedSmells = new UsabilitySmell[] {  };
[1335]53
[1918]54        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
[1335]55
56    }
57
58    /**
59     *
60     */
61    @Test
62    public void testWithNormalScroll_02() {
[1493]63        RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule();
[1335]64
65        // ===== check =====
66        String spec =
67            "UserSession {" +
68            "  Scroll body {}" +
69            "  Interaction elem1 {}" +
70            "  Scroll body {}" +
71            "  Interaction elem1 {}" +
72            "}";
73       
[1918]74        // no smell expected, as interactions do not form tasks
75        UsabilitySmell[] expectedSmells = new UsabilitySmell[] { };
[1335]76
[1918]77        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
[1335]78
79    }
80
81    /**
82     *
83     */
84    @Test
85    public void testWithNormalScroll_03() {
[1493]86        RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule();
[1335]87
88        // ===== check =====
89        String spec =
90            "UserSession {" +
91            "  Sequence {" +
92            "    Scroll body {}" +
93            "    Interaction elem1 {}" +
94            "  }" +
95            "}";
96       
[1918]97        UsabilitySmell[] expectedSmells = new UsabilitySmell[]
98            { new UsabilitySmell(/*HIGH*/ UsabilitySmellIntensity.getIntensity(0),
99                                  INEFFICIENT_ACTIONS) };
[1335]100
[1918]101        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
[1335]102
103    }
104
105    /**
106     *
107     */
108    @Test
109    public void testWithNormalScroll_04() {
[1493]110        RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule();
[1335]111
112        // ===== check =====
113        String spec =
114            "UserSession {" +
[1493]115            "  Sequence {" +
116            "    Interaction elem1 {}" +
117            "    Scroll body {}" +
118            "  }" +
119            "}";
120       
[1918]121        UsabilitySmell[] expectedSmells = new UsabilitySmell[]
122            { new UsabilitySmell(/*HIGH*/ UsabilitySmellIntensity.getIntensity(0),
123                                  INEFFICIENT_ACTIONS) };
[1493]124
[1918]125        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
[1493]126
127    }
128
129    /**
130     *
131     */
132    @Test
133    public void testWithNormalScroll_05() {
134        RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule();
135
136        // ===== check =====
137        String spec =
138            "UserSession {" +
[1335]139            "  Sequence seq1 {" +
140            "    Scroll body {}" +
141            "    Interaction elem1 {}" +
142            "  }" +
143            "  Sequence seq1 {" +
144            "    Scroll body {}" +
145            "    Interaction elem1 {}" +
146            "  }" +
147            "}";
148       
[1918]149        UsabilitySmell[] expectedSmells = new UsabilitySmell[]
150            { new UsabilitySmell(/*HIGH*/ UsabilitySmellIntensity.getIntensity(0),
151                                  INEFFICIENT_ACTIONS) };
[1335]152
[1918]153        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
[1335]154
155    }
156
157    /**
158     *
159     */
160    @Test
[1493]161    public void testWithNormalScroll_06() {
162        RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule();
[1335]163
164        // ===== check =====
165        String spec =
166            "UserSession {" +
167            "  Sequence seq1 {" +
168            "    Interaction elem1 {}" +
[1493]169            "    Scroll body {}" +
170            "  }" +
171            "  Sequence seq1 {" +
[1335]172            "    Interaction elem1 {}" +
[1493]173            "    Scroll body {}" +
174            "  }" +
175            "}";
176       
[1918]177        UsabilitySmell[] expectedSmells = new UsabilitySmell[]
178            { new UsabilitySmell(/*HIGH*/ UsabilitySmellIntensity.getIntensity(0),
179                                  INEFFICIENT_ACTIONS) };
[1493]180
[1918]181        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
[1493]182
183    }
184
185    /**
186     *
187     */
188    @Test
189    public void testScrollSeldomRequired_01() {
190        RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule();
191
192        // ===== check =====
193        String spec =
194            "UserSession {" +
195            "  Sequence seq1 {" +
[1335]196            "    Interaction elem1 {}" +
[1493]197            "    Interaction elem1 {}" +
198            "    Interaction elem1 {}" +
[1335]199            "    Scroll body {}" +
200            "    Interaction elem1 {}" +
201            "  }" +
202            "}";
203       
[1918]204        UsabilitySmell[] expectedSmells = new UsabilitySmell[]
205            { new UsabilitySmell(/*LOW*/ UsabilitySmellIntensity.getIntensity(0),
206                                  INEFFICIENT_ACTIONS) };
[1335]207
[1918]208        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
[1335]209
210    }
211
212    /**
213     *
214     */
215    @Test
[1493]216    public void testScrollSeldomRequired_02() {
217        RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule();
[1335]218
219        // ===== check =====
220        String spec =
221            "UserSession {" +
222            "  Sequence seq1 {" +
223            "    Optional opt1 { }" +
224            "    Interaction elem1 {}" +
225            "  }" +
226            "  Sequence seq1 {" +
227            "    Optional opt1 {" +
228            "      Scroll body {}" +
229            "    }" +
230            "    Interaction elem1 {}" +
231            "  }" +
232            "  Sequence seq1 {" +
233            "    Optional opt1 {" +
234            "      Scroll body {}" +
235            "    }" +
236            "    Interaction elem1 {}" +
237            "  }" +
238            "}";
239       
[1918]240        UsabilitySmell[] expectedSmells = new UsabilitySmell[]
241            { new UsabilitySmell(/*MEDIUM*/ UsabilitySmellIntensity.getIntensity(0),
242                                  INEFFICIENT_ACTIONS) };
[1335]243
[1918]244        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
[1335]245
246    }
247
248    /**
249     *
250     */
251    @Test
[1493]252    public void testScrollSeldomRequired_03() {
253        RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule();
[1335]254
255        // ===== check =====
256        String spec =
257            "UserSession {" +
258            "  Sequence seq1 {" +
[1493]259            "    Interaction elem1 {}" +
[1335]260            "    Optional opt1 { }" +
[1493]261            "  }" +
262            "  Sequence seq1 {" +
[1335]263            "    Interaction elem1 {}" +
[1493]264            "    Optional opt1 {" +
265            "      Scroll body {}" +
266            "    }" +
[1335]267            "  }" +
268            "  Sequence seq1 {" +
[1493]269            "    Interaction elem1 {}" +
270            "    Optional opt1 {" +
271            "      Scroll body {}" +
272            "    }" +
273            "  }" +
274            "}";
275       
[1918]276        UsabilitySmell[] expectedSmells = new UsabilitySmell[]
277            { new UsabilitySmell(/*MEDIUM*/ UsabilitySmellIntensity.getIntensity(0),
278                                  INEFFICIENT_ACTIONS) };
[1493]279
[1918]280        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
[1493]281
282    }
283
284    /**
285     *
286     */
287    @Test
288    public void testScrollSeldomRequired_04() {
289        RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule();
290
291        // ===== check =====
292        String spec =
293            "UserSession {" +
294            "  Sequence seq1 {" +
295            "    Optional opt1 { }" +
296            "    Interaction elem1 {}" +
297            "  }" +
298            "  Sequence seq1 {" +
[1335]299            "    Optional opt1 {}" +
300            "    Interaction elem1 {}" +
301            "  }" +
302            "  Sequence seq1 {" +
303            "    Optional opt1 {" +
304            "      Scroll body {}" +
305            "    }" +
306            "    Interaction elem1 {}" +
307            "  }" +
308            "  Sequence seq1 {" +
309            "    Optional opt1 {" +
310            "      Scroll body {}" +
311            "    }" +
312            "    Interaction elem1 {}" +
313            "  }" +
314            "}";
315       
[1918]316        UsabilitySmell[] expectedSmells = new UsabilitySmell[]
317           { new UsabilitySmell(/*LOW*/ UsabilitySmellIntensity.getIntensity(0),
318                                  INEFFICIENT_ACTIONS) };
[1335]319
[1918]320        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
[1335]321
322    }
323
324    /**
325     *
326     */
327    @Test
[1493]328    public void testScrollSeldomRequired_05() {
329        RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule();
[1335]330
331        // ===== check =====
332        String spec =
333            "UserSession {" +
334            "  Sequence seq1 {" +
[1493]335            "    Interaction elem1 {}" +
[1335]336            "    Optional opt1 { }" +
[1493]337            "  }" +
338            "  Sequence seq1 {" +
[1335]339            "    Interaction elem1 {}" +
[1493]340            "    Optional opt1 {}" +
[1335]341            "  }" +
342            "  Sequence seq1 {" +
[1493]343            "    Interaction elem1 {}" +
344            "    Optional opt1 {" +
345            "      Scroll body {}" +
346            "    }" +
347            "  }" +
348            "  Sequence seq1 {" +
349            "    Interaction elem1 {}" +
350            "    Optional opt1 {" +
351            "      Scroll body {}" +
352            "    }" +
353            "  }" +
354            "}";
355       
[1918]356        UsabilitySmell[] expectedSmells = new UsabilitySmell[]
357           { new UsabilitySmell(/*LOW*/ UsabilitySmellIntensity.getIntensity(0),
358                                  INEFFICIENT_ACTIONS) };
[1493]359
[1918]360        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
[1493]361
362    }
363
364    /**
365     *
366     */
367    @Test
368    public void testScrollSeldomRequired_06() {
369        RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule();
370
371        // ===== check =====
372        String spec =
373            "UserSession {" +
374            "  Sequence seq1 {" +
[1335]375            "    Optional opt1 { }" +
376            "    Interaction elem1 {}" +
377            "  }" +
378            "  Sequence seq1 {" +
379            "    Optional opt1 { }" +
380            "    Interaction elem1 {}" +
381            "  }" +
382            "  Sequence seq1 {" +
[1493]383            "    Optional opt1 { }" +
384            "    Interaction elem1 {}" +
385            "  }" +
386            "  Sequence seq1 {" +
[1335]387            "    Optional opt1 {" +
388            "      Scroll body {}" +
389            "    }" +
390            "    Interaction elem1 {}" +
391            "  }" +
392            "}";
393       
[1918]394        UsabilitySmell[] expectedSmells = new UsabilitySmell[]
395            { new UsabilitySmell(/*INFO*/ UsabilitySmellIntensity.getIntensity(0),
396                                  INEFFICIENT_ACTIONS) };
[1335]397
[1918]398        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
[1335]399
400    }
401
402    /**
403     *
404     */
405    @Test
[1493]406    public void testScrollSeldomRequired_07() {
407        RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule();
[1335]408
409        // ===== check =====
410        String spec =
411            "UserSession {" +
412            "  Sequence seq1 {" +
[1493]413            "    Interaction elem1 {}" +
[1335]414            "    Optional opt1 { }" +
[1493]415            "  }" +
416            "  Sequence seq1 {" +
[1335]417            "    Interaction elem1 {}" +
[1493]418            "    Optional opt1 { }" +
[1335]419            "  }" +
420            "  Sequence seq1 {" +
[1493]421            "    Interaction elem1 {}" +
[1335]422            "    Optional opt1 { }" +
[1493]423            "  }" +
424            "  Sequence seq1 {" +
[1335]425            "    Interaction elem1 {}" +
[1493]426            "    Optional opt1 {" +
427            "      Scroll body {}" +
428            "    }" +
[1335]429            "  }" +
[1493]430            "}";
431       
[1918]432        UsabilitySmell[] expectedSmells = new UsabilitySmell[]
433            { new UsabilitySmell(/*INFO*/ UsabilitySmellIntensity.getIntensity(0),
434                                  INEFFICIENT_ACTIONS) };
[1493]435
[1918]436        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
[1493]437
438    }
439
440    /**
441     *
442     */
443    @Test
444    public void testScrollSeldomRequired_08() {
445        RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule();
446
447        // ===== check =====
448        String spec =
449            "UserSession {" +
[1335]450            "  Sequence seq1 {" +
451            "    Optional opt1 { }" +
452            "    Interaction elem1 {}" +
453            "  }" +
454            "  Sequence seq1 {" +
[1493]455            "    Optional opt1 { }" +
456            "    Interaction elem1 {}" +
457            "  }" +
458            "  Sequence seq1 {" +
459            "    Optional opt1 { }" +
460            "    Interaction elem1 {}" +
461            "  }" +
462            "  Sequence seq1 {" +
[1335]463            "    Optional opt1 {" +
464            "      Scroll body {}" +
465            "    }" +
466            "    Interaction elem1 {}" +
467            "  }" +
468            "  Sequence seq1 {" +
469            "    Optional opt1 { }" +
470            "    Interaction elem1 {}" +
471            "  }" +
472            "  Sequence seq1 {" +
473            "    Optional opt1 { }" +
474            "    Interaction elem1 {}" +
475            "  }" +
476            "  Sequence seq1 {" +
477            "    Optional opt1 { }" +
478            "    Interaction elem1 {}" +
479            "  }" +
480            "  Sequence seq1 {" +
481            "    Optional opt1 { }" +
482            "    Interaction elem1 {}" +
483            "  }" +
484            "}";
485       
[1918]486        UsabilitySmell[] expectedSmells = new UsabilitySmell[] { };
[1335]487
[1918]488        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
[1335]489
490    }
[1493]491
492    /**
493     *
494     */
495    @Test
496    public void testScrollSeldomRequired_09() {
497        RequiredInefficientActionsRule rule = new RequiredInefficientActionsRule();
498
499        // ===== check =====
500        String spec =
501            "UserSession {" +
502            "  Sequence seq1 {" +
503            "    Interaction elem1 {}" +
504            "    Optional opt1 { }" +
505            "  }" +
506            "  Sequence seq1 {" +
507            "    Interaction elem1 {}" +
508            "    Optional opt1 { }" +
509            "  }" +
510            "  Sequence seq1 {" +
511            "    Interaction elem1 {}" +
512            "    Optional opt1 { }" +
513            "  }" +
514            "  Sequence seq1 {" +
515            "    Interaction elem1 {}" +
516            "    Optional opt1 {" +
517            "      Scroll body {}" +
518            "    }" +
519            "  }" +
520            "  Sequence seq1 {" +
521            "    Interaction elem1 {}" +
522            "    Optional opt1 { }" +
523            "  }" +
524            "  Sequence seq1 {" +
525            "    Interaction elem1 {}" +
526            "    Optional opt1 { }" +
527            "  }" +
528            "  Sequence seq1 {" +
529            "    Interaction elem1 {}" +
530            "    Optional opt1 { }" +
531            "  }" +
532            "  Sequence seq1 {" +
533            "    Interaction elem1 {}" +
534            "    Optional opt1 { }" +
535            "  }" +
536            "}";
537       
[1918]538        UsabilitySmell[] expectedSmells = new UsabilitySmell[] { };
[1493]539
[1918]540        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
[1493]541
542    }
[1335]543}
Note: See TracBrowser for help on using the repository browser.