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

Last change on this file since 2169 was 2169, checked in by pharms, 7 years ago
  • changes for first VR oriented usability evaluation
File size: 9.2 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.COMMON_TASK_RATE;
18
19import org.junit.Before;
20import org.junit.Test;
21
22import de.ugoe.cs.autoquest.usability.UsabilitySmell;
23
24/**
25 *
26 */
27public class CommonTaskRateRuleTest extends AbstractUsabilityEvaluationTC {
28
29    /**
30     *
31     */
32    @Before
33    public void setUp() {
34        //UsabilitySmellIntensity.defaultCoverageQuantile = 0;
35    }
36   
37    /**
38     *
39     */
40    @Test
41    public void testNoTaskCoverage_01() {
42        CommonTaskRateRule rule = new CommonTaskRateRule();
43
44        // ===== check =====
45        String spec =
46            "UserSession {" +
47            "  Interaction elem1 {}" +
48            "  Interaction elem2 {}" +
49            "}";
50       
51        // no smell expected, as there are too few recorded actions
52        UsabilitySmell[] expectedSmells = new UsabilitySmell[] { };
53
54        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
55    }
56   
57    /**
58     *
59     */
60    @Test
61    public void testNoTaskCoverage_02() {
62        CommonTaskRateRule rule = new CommonTaskRateRule();
63
64        // ===== check =====
65        String spec =
66            "UserSession {" +
67            "  Interaction elem1 {}" +
68            "  Interaction elem2 {}" +
69            "  Interaction elem3 {}" +
70            "  Interaction elem4 {}" +
71            "  Interaction elem5 {}" +
72            "  Interaction elem6 {}" +
73            "  Interaction elem7 {}" +
74            "  Interaction elem8 {}" +
75            "  Interaction elem9 {}" +
76            "  Interaction elem10 {}" +
77            "}";
78       
79        // smell expected, as for each action a different root node exists
80        UsabilitySmell[] expectedSmells = new UsabilitySmell[]
81            { new UsabilitySmell(UsabilitySmellIntensity.getIntensity(0), COMMON_TASK_RATE),
82              new UsabilitySmell(UsabilitySmellIntensity.getIntensity(0), COMMON_TASK_RATE) };
83
84        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
85    }
86   
87    /**
88     *
89     */
90    @Test
91    public void testBadTaskCoverage_01() {
92        CommonTaskRateRule rule = new CommonTaskRateRule();
93
94        // ===== check =====
95        String spec =
96            "UserSession {" +
97            "  Iteration it1 {" +
98            "    Interaction elem1 {}" +
99            "  }" +
100            "  Iteration it2 {" +
101            "    Interaction elem2 {}" +
102            "  }" +
103            "  Iteration it3 {" +
104            "    Interaction elem3 {}" +
105            "  }" +
106            "  Iteration it4 {" +
107            "    Interaction elem4 {}" +
108            "  }" +
109            "  Iteration it5 {" +
110            "    Interaction elem5 {}" +
111            "  }" +
112            "  Iteration it6 {" +
113            "    Interaction elem6 {}" +
114            "  }" +
115            "  Iteration it7 {" +
116            "    Interaction elem7 {}" +
117            "  }" +
118            "  Iteration it8 {" +
119            "    Interaction elem8 {}" +
120            "  }" +
121            "  Iteration it9 {" +
122            "    Interaction elem9 {}" +
123            "  }" +
124            "  Iteration it10 {" +
125            "    Interaction elem10 {}" +
126            "  }" +
127            "}";
128       
129        // smell expected, as for each action a different root node exists
130        UsabilitySmell[] expectedSmells = new UsabilitySmell[]
131            { new UsabilitySmell(UsabilitySmellIntensity.getIntensity(0), COMMON_TASK_RATE),
132              new UsabilitySmell(UsabilitySmellIntensity.getIntensity(0), COMMON_TASK_RATE) };
133
134        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
135    }
136   
137    /**
138     *
139     */
140    @Test
141    public void testBadTaskCoverage_02() {
142        CommonTaskRateRule rule = new CommonTaskRateRule();
143
144        // ===== check =====
145        String spec =
146            "UserSession {" +
147            "  Sequence seq1 {" +
148            "    Interaction elem1 {}" +
149            "    Interaction elem2 {}" +
150            "  }" +
151            "  Iteration it3 {" +
152            "    Interaction elem3 {}" +
153            "  }" +
154            "  Iteration it4 {" +
155            "    Interaction elem4 {}" +
156            "  }" +
157            "  Iteration it5 {" +
158            "    Interaction elem5 {}" +
159            "  }" +
160            "  Iteration it6 {" +
161            "    Interaction elem6 {}" +
162            "  }" +
163            "  Iteration it7 {" +
164            "    Interaction elem7 {}" +
165            "  }" +
166            "  Iteration it8 {" +
167            "    Interaction elem8 {}" +
168            "  }" +
169            "  Iteration it9 {" +
170            "    Interaction elem9 {}" +
171            "  }" +
172            "  Iteration it10 {" +
173            "    Interaction elem10 {}" +
174            "  }" +
175            "}";
176       
177        // smell expected, as for many actions a different root node exists
178        UsabilitySmell[] expectedSmells = new UsabilitySmell[]
179            { new UsabilitySmell(UsabilitySmellIntensity.getIntensity(0), COMMON_TASK_RATE),
180              new UsabilitySmell(UsabilitySmellIntensity.getIntensity(0), COMMON_TASK_RATE) };
181
182        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
183    }
184   
185    /**
186     *
187     */
188    @Test
189    public void testBadTaskCoverage_03() {
190        CommonTaskRateRule rule = new CommonTaskRateRule();
191
192        // ===== check =====
193        String spec =
194            "UserSession {" +
195            "  Iteration it1 {" +
196            "    Interaction elem1 {}" +
197            "  }" +
198            "  Sequence seq1 {" +
199            "    Interaction elem2 {}" +
200            "    Interaction elem3 {}" +
201            "  }" +
202            "  Iteration it4 {" +
203            "    Interaction elem4 {}" +
204            "  }" +
205            "  Iteration it5 {" +
206            "    Interaction elem5 {}" +
207            "  }" +
208            "  Iteration it6 {" +
209            "    Interaction elem6 {}" +
210            "  }" +
211            "  Iteration it7 {" +
212            "    Interaction elem7 {}" +
213            "  }" +
214            "  Iteration it8 {" +
215            "    Interaction elem8 {}" +
216            "  }" +
217            "  Iteration it9 {" +
218            "    Interaction elem9 {}" +
219            "  }" +
220            "  Iteration it10 {" +
221            "    Interaction elem10 {}" +
222            "  }" +
223            "}";
224       
225        // smell expected, as for many actions a different root node exists
226        UsabilitySmell[] expectedSmells = new UsabilitySmell[]
227            { new UsabilitySmell(UsabilitySmellIntensity.getIntensity(0), COMMON_TASK_RATE),
228              new UsabilitySmell(UsabilitySmellIntensity.getIntensity(0), COMMON_TASK_RATE) };
229
230        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
231    }
232
233    /**
234     *
235     */
236    @Test
237    public void testPerfectTaskCoverage_01() {
238        CommonTaskRateRule rule = new CommonTaskRateRule();
239
240        // ===== check =====
241        String spec =
242            "UserSession {" +
243            "  Sequence {" +
244            "    Interaction elem1 {}" +
245            "    Interaction elem2 {}" +
246            "    Interaction elem3 {}" +
247            "    Interaction elem4 {}" +
248            "    Interaction elem5 {}" +
249            "    Interaction elem6 {}" +
250            "    Interaction elem7 {}" +
251            "    Interaction elem8 {}" +
252            "    Interaction elem9 {}" +
253            "    Interaction elem10 {}" +
254            "  }" +
255            "}";
256       
257        UsabilitySmell[] expectedSmells = new UsabilitySmell[] { };
258
259        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
260    }
261
262    /**
263     *
264     */
265    @Test
266    public void testPerfectTaskCoverage_02() {
267        CommonTaskRateRule rule = new CommonTaskRateRule();
268
269        // ===== check =====
270        String spec =
271            "UserSession {" +
272            "  Sequence {" +
273            "    Interaction elem1 {}" +
274            "    Interaction elem2 {}" +
275            "    Interaction elem3 {}" +
276            "    Interaction elem4 {}" +
277            "    Interaction elem5 {}" +
278            "    Interaction elem6 {}" +
279            "    Interaction elem7 {}" +
280            "    Interaction elem8 {}" +
281            "    Interaction elem9 {}" +
282            "    Interaction elem10 {}" +
283            "    Interaction elem11 {}" +
284            "    Interaction elem12 {}" +
285            "    Interaction elem13 {}" +
286            "  }" +
287            "}";
288       
289        UsabilitySmell[] expectedSmells = new UsabilitySmell[] { };
290
291        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
292    }
293   
294}
Note: See TracBrowser for help on using the repository browser.