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

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