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

Last change on this file since 1493 was 1493, checked in by pharms, 10 years ago
  • state of the HCSE 2014 Paper. An appropriate tag will follow.
File size: 15.3 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.UsabilityDefectDescription.COOCCURENCE_PRECED;
18import static de.ugoe.cs.autoquest.usability.UsabilityDefectDescription.COOCCURENCE_SUCCEED;
19import static de.ugoe.cs.autoquest.usability.UsabilityDefectSeverity.HIGH;
20import static de.ugoe.cs.autoquest.usability.UsabilityDefectSeverity.INFO;
21import static de.ugoe.cs.autoquest.usability.UsabilityDefectSeverity.LOW;
22import static de.ugoe.cs.autoquest.usability.UsabilityDefectSeverity.MEDIUM;
23
24import org.junit.Before;
25import org.junit.Test;
26
27import de.ugoe.cs.autoquest.usability.UsabilityDefect;
28
29/**
30 *
31 */
32public class TaskCooccurrenceRuleTest extends AbstractUsabilityEvaluationTC {
33
34    /**
35     *
36     */
37    @Before
38    public void setUp() {
39        UsabilityDefectSeverity.defaultCoverageQuantile = 0;
40    }
41
42    /**
43     *
44     */
45    @Test
46    public void testCooccurrence_01() {
47        TaskCooccurrenceRule rule = new TaskCooccurrenceRule();
48
49        // ===== check =====
50        String spec =
51            "UserSession {" +
52            "  Interaction elem1 {}" +
53            "  Interaction elem2 {}" +
54            "}";
55       
56        // no defect expected, as interactions do not form tasks
57        UsabilityDefect[] expectedDefects = new UsabilityDefect[] {  };
58
59        assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec)));
60
61    }
62
63    /**
64     *
65     */
66    @Test
67    public void testCooccurrence_02() {
68        TaskCooccurrenceRule rule = new TaskCooccurrenceRule();
69
70        // ===== check =====
71        String spec =
72            "UserSession {" +
73            "  Interaction elem1 {}" +
74            "  Interaction elem2 {}" +
75            "  Interaction elem1 {}" +
76            "  Interaction elem2 {}" +
77            "}";
78       
79        // no defect expected, as interactions do not form tasks
80        UsabilityDefect[] expectedDefects = new UsabilityDefect[] { };
81
82        assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec)));
83
84    }
85
86    /**
87     *
88     */
89    @Test
90    public void testCooccurrence_03() {
91        TaskCooccurrenceRule rule = new TaskCooccurrenceRule();
92
93        // ===== check =====
94        String spec =
95            "UserSession {" +
96            "  Sequence {" +
97            "    Interaction elem1 {}" +
98            "    Interaction elem2 {}" +
99            "  }" +
100            "}";
101       
102        UsabilityDefect[] expectedDefects = new UsabilityDefect[]
103            { new UsabilityDefect(HIGH, COOCCURENCE_SUCCEED),
104              new UsabilityDefect(HIGH, COOCCURENCE_PRECED) };
105
106        assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec)));
107
108    }
109
110    /**
111     *
112     */
113    @Test
114    public void testCooccurrence_04() {
115        TaskCooccurrenceRule rule = new TaskCooccurrenceRule();
116
117        // ===== check =====
118        String spec =
119            "UserSession {" +
120            "  Sequence seq1 {" +
121            "    Interaction elem1 {}" +
122            "    Interaction elem2 {}" +
123            "  }" +
124            "  Sequence seq1 {" +
125            "    Interaction elem1 {}" +
126            "    Interaction elem2 {}" +
127            "  }" +
128            "}";
129       
130        UsabilityDefect[] expectedDefects = new UsabilityDefect[]
131            { new UsabilityDefect(HIGH, COOCCURENCE_SUCCEED),
132              new UsabilityDefect(HIGH, COOCCURENCE_PRECED) };
133
134        assertUsabilityEvaluationResult(expectedDefects, 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        UsabilityDefect[] expectedDefects = new UsabilityDefect[]
158            { new UsabilityDefect(HIGH, COOCCURENCE_SUCCEED),
159              new UsabilityDefect(HIGH, COOCCURENCE_SUCCEED),
160              new UsabilityDefect(HIGH, COOCCURENCE_SUCCEED),
161              new UsabilityDefect(HIGH, COOCCURENCE_SUCCEED),
162              new UsabilityDefect(HIGH, COOCCURENCE_PRECED),
163              new UsabilityDefect(HIGH, COOCCURENCE_PRECED),
164              new UsabilityDefect(HIGH, COOCCURENCE_PRECED),
165              new UsabilityDefect(HIGH, COOCCURENCE_PRECED) };
166
167        assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec)));
168
169    }
170
171    /**
172     *
173     */
174    @Test
175    public void testSeldomCooccurrence_02() {
176        TaskCooccurrenceRule rule = new TaskCooccurrenceRule();
177
178        // ===== check =====
179        String spec =
180            "UserSession {" +
181            "  Sequence seq1 {" +
182            "    Interaction other {}" +
183            "    Interaction elem2 {}" +
184            "  }" +
185            "  Sequence seq2 {" +
186            "    Interaction elem1 {}" +
187            "    Interaction elem2 {}" +
188            "  }" +
189            "  Sequence seq2 {" +
190            "    Interaction elem1 {}" +
191            "    Interaction elem2 {}" +
192            "  }" +
193            "}";
194       
195        UsabilityDefect[] expectedDefects = new UsabilityDefect[]
196            { new UsabilityDefect(HIGH, COOCCURENCE_SUCCEED),
197              new UsabilityDefect(HIGH, COOCCURENCE_SUCCEED),
198              new UsabilityDefect(LOW, COOCCURENCE_PRECED),
199              new UsabilityDefect(INFO, COOCCURENCE_PRECED) };
200
201        assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec)));
202
203    }
204
205    /**
206     *
207     */
208    @Test
209    public void testSeldomCooccurrence_03() {
210        TaskCooccurrenceRule rule = new TaskCooccurrenceRule();
211
212        // ===== check =====
213        String spec =
214            "UserSession {" +
215            "  Sequence seq1 {" +
216            "    Interaction elem2 {}" +
217            "    Interaction other {}" +
218            "  }" +
219            "  Sequence seq2 {" +
220            "    Interaction elem2 {}" +
221            "    Interaction elem1 {}" +
222            "  }" +
223            "  Sequence seq2 {" +
224            "    Interaction elem2 {}" +
225            "    Interaction elem1 {}" +
226            "  }" +
227            "}";
228       
229        UsabilityDefect[] expectedDefects = new UsabilityDefect[]
230            { new UsabilityDefect(HIGH, COOCCURENCE_PRECED),
231              new UsabilityDefect(HIGH, COOCCURENCE_PRECED),
232              new UsabilityDefect(LOW, COOCCURENCE_SUCCEED),
233              new UsabilityDefect(INFO, COOCCURENCE_SUCCEED) };
234
235        assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec)));
236
237    }
238
239    /**
240     *
241     */
242    @Test
243    public void testSeldomCooccurrence_04() {
244        TaskCooccurrenceRule rule = new TaskCooccurrenceRule();
245
246        // ===== check =====
247        String spec =
248            "UserSession {" +
249            "  Sequence seq1 {" +
250            "    Interaction other {}" +
251            "    Interaction elem2 {}" +
252            "  }" +
253            "  Sequence seq1 {" +
254            "    Interaction other {}" +
255            "    Interaction elem2 {}" +
256            "  }" +
257            "  Sequence seq2 {" +
258            "    Interaction elem1 {}" +
259            "    Interaction elem2 {}" +
260            "  }" +
261            "  Sequence seq2 {" +
262            "    Interaction elem1 {}" +
263            "    Interaction elem2 {}" +
264            "  }" +
265            "}";
266       
267        UsabilityDefect[] expectedDefects = new UsabilityDefect[]
268           { new UsabilityDefect(LOW, COOCCURENCE_PRECED),
269             new UsabilityDefect(LOW, COOCCURENCE_PRECED),
270             new UsabilityDefect(HIGH, COOCCURENCE_SUCCEED),
271             new UsabilityDefect(HIGH, COOCCURENCE_SUCCEED) };
272
273        assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec)));
274
275    }
276
277    /**
278     *
279     */
280    @Test
281    public void testSeldomCooccurrence_05() {
282        TaskCooccurrenceRule rule = new TaskCooccurrenceRule();
283
284        // ===== check =====
285        String spec =
286            "UserSession {" +
287            "  Sequence seq1 {" +
288            "    Interaction elem2 {}" +
289            "    Interaction other {}" +
290            "  }" +
291            "  Sequence seq1 {" +
292            "    Interaction elem2 {}" +
293            "    Interaction other {}" +
294            "  }" +
295            "  Sequence seq2 {" +
296            "    Interaction elem2 {}" +
297            "    Interaction elem1 {}" +
298            "  }" +
299            "  Sequence seq2 {" +
300            "    Interaction elem2 {}" +
301            "    Interaction elem1 {}" +
302            "  }" +
303            "}";
304       
305        UsabilityDefect[] expectedDefects = new UsabilityDefect[]
306           { new UsabilityDefect(HIGH, COOCCURENCE_PRECED),
307             new UsabilityDefect(HIGH, COOCCURENCE_PRECED),
308             new UsabilityDefect(LOW, COOCCURENCE_SUCCEED),
309             new UsabilityDefect(LOW, COOCCURENCE_SUCCEED) };
310
311        assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec)));
312
313    }
314
315    /**
316     *
317     */
318    @Test
319    public void testSeldomCooccurrence_06() {
320        TaskCooccurrenceRule rule = new TaskCooccurrenceRule();
321
322        // ===== check =====
323        String spec =
324            "UserSession {" +
325            "  Sequence seq1 {" +
326            "    Interaction other {}" +
327            "    Interaction elem2 {}" +
328            "  }" +
329            "  Sequence seq1 {" +
330            "    Interaction other {}" +
331            "    Interaction elem2 {}" +
332            "  }" +
333            "  Sequence seq1 {" +
334            "    Interaction other {}" +
335            "    Interaction elem2 {}" +
336            "  }" +
337            "  Sequence seq2 {" +
338            "    Interaction elem1 {}" +
339            "    Interaction elem2 {}" +
340            "  }" +
341            "}";
342       
343        UsabilityDefect[] expectedDefects = new UsabilityDefect[]
344            { new UsabilityDefect(MEDIUM, COOCCURENCE_PRECED),
345              new UsabilityDefect(HIGH, COOCCURENCE_SUCCEED),
346              new UsabilityDefect(HIGH, COOCCURENCE_SUCCEED) };
347
348        assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec)));
349
350    }
351
352    /**
353     *
354     */
355    @Test
356    public void testSeldomCooccurrence_07() {
357        TaskCooccurrenceRule rule = new TaskCooccurrenceRule();
358
359        // ===== check =====
360        String spec =
361            "UserSession {" +
362            "  Sequence seq1 {" +
363            "    Interaction elem2 {}" +
364            "    Interaction other {}" +
365            "  }" +
366            "  Sequence seq1 {" +
367            "    Interaction elem2 {}" +
368            "    Interaction other {}" +
369            "  }" +
370            "  Sequence seq1 {" +
371            "    Interaction elem2 {}" +
372            "    Interaction other {}" +
373            "  }" +
374            "  Sequence seq2 {" +
375            "    Interaction elem2 {}" +
376            "    Interaction elem1 {}" +
377            "  }" +
378            "}";
379       
380        UsabilityDefect[] expectedDefects = new UsabilityDefect[]
381            { new UsabilityDefect(HIGH, COOCCURENCE_PRECED),
382              new UsabilityDefect(HIGH, COOCCURENCE_PRECED),
383              new UsabilityDefect(MEDIUM, COOCCURENCE_SUCCEED) };
384
385        assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec)));
386
387    }
388
389    /**
390     *
391     */
392    @Test
393    public void testSeldomCooccurrence_08() {
394        TaskCooccurrenceRule rule = new TaskCooccurrenceRule();
395
396        // ===== check =====
397        String spec =
398            "UserSession {" +
399            "  Sequence seq1 {" +
400            "    Interaction other {}" +
401            "    Interaction elem2 {}" +
402            "  }" +
403            "  Sequence seq1 {" +
404            "    Interaction other {}" +
405            "    Interaction elem2 {}" +
406            "  }" +
407            "  Sequence seq1 {" +
408            "    Interaction other {}" +
409            "    Interaction elem2 {}" +
410            "  }" +
411            "  Sequence seq2 {" +
412            "    Interaction elem1 {}" +
413            "    Interaction elem2 {}" +
414            "  }" +
415            "  Sequence seq1 {" +
416            "    Interaction other {}" +
417            "    Interaction elem2 {}" +
418            "  }" +
419            "  Sequence seq1 {" +
420            "    Interaction other {}" +
421            "    Interaction elem2 {}" +
422            "  }" +
423            "  Sequence seq1 {" +
424            "    Interaction other {}" +
425            "    Interaction elem2 {}" +
426            "  }" +
427            "  Sequence seq1 {" +
428            "    Interaction other {}" +
429            "    Interaction elem2 {}" +
430            "  }" +
431            "}";
432       
433        UsabilityDefect[] expectedDefects = new UsabilityDefect[]
434            { new UsabilityDefect(MEDIUM, COOCCURENCE_PRECED),
435              new UsabilityDefect(HIGH, COOCCURENCE_SUCCEED),
436              new UsabilityDefect(HIGH, COOCCURENCE_SUCCEED) };
437
438        assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec)));
439
440    }
441
442    /**
443     *
444     */
445    @Test
446    public void testSeldomCooccurrence_09() {
447        TaskCooccurrenceRule rule = new TaskCooccurrenceRule();
448
449        // ===== check =====
450        String spec =
451            "UserSession {" +
452            "  Sequence seq1 {" +
453            "    Interaction elem2 {}" +
454            "    Interaction other {}" +
455            "  }" +
456            "  Sequence seq1 {" +
457            "    Interaction elem2 {}" +
458            "    Interaction other {}" +
459            "  }" +
460            "  Sequence seq1 {" +
461            "    Interaction elem2 {}" +
462            "    Interaction other {}" +
463            "  }" +
464            "  Sequence seq2 {" +
465            "    Interaction elem2 {}" +
466            "    Interaction elem1 {}" +
467            "  }" +
468            "  Sequence seq1 {" +
469            "    Interaction elem2 {}" +
470            "    Interaction other {}" +
471            "  }" +
472            "  Sequence seq1 {" +
473            "    Interaction elem2 {}" +
474            "    Interaction other {}" +
475            "  }" +
476            "  Sequence seq1 {" +
477            "    Interaction elem2 {}" +
478            "    Interaction other {}" +
479            "  }" +
480            "  Sequence seq1 {" +
481            "    Interaction elem2 {}" +
482            "    Interaction other {}" +
483            "  }" +
484            "}";
485       
486        UsabilityDefect[] expectedDefects = new UsabilityDefect[]
487            { new UsabilityDefect(HIGH, COOCCURENCE_PRECED),
488              new UsabilityDefect(HIGH, COOCCURENCE_PRECED),
489              new UsabilityDefect(MEDIUM, COOCCURENCE_SUCCEED) };
490
491        assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec)));
492
493    }
494}
Note: See TracBrowser for help on using the repository browser.