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 | |
---|
15 | package de.ugoe.cs.autoquest.usability; |
---|
16 | |
---|
17 | import static de.ugoe.cs.autoquest.usability.UsabilityDefectDescription.SCROLL_REQUIRED; |
---|
18 | import static de.ugoe.cs.autoquest.usability.UsabilityDefectSeverity.HIGH; |
---|
19 | import static de.ugoe.cs.autoquest.usability.UsabilityDefectSeverity.INFO; |
---|
20 | import static de.ugoe.cs.autoquest.usability.UsabilityDefectSeverity.LOW; |
---|
21 | import static de.ugoe.cs.autoquest.usability.UsabilityDefectSeverity.MEDIUM; |
---|
22 | |
---|
23 | import org.junit.Test; |
---|
24 | |
---|
25 | import de.ugoe.cs.autoquest.usability.UsabilityDefect; |
---|
26 | |
---|
27 | /** |
---|
28 | * |
---|
29 | */ |
---|
30 | public class RequiredScrollRuleTest extends AbstractUsabilityEvaluationTC { |
---|
31 | |
---|
32 | /** |
---|
33 | * |
---|
34 | */ |
---|
35 | @Test |
---|
36 | public void testWithNormalScroll_01() { |
---|
37 | RequiredScrollRule rule = new RequiredScrollRule(); |
---|
38 | |
---|
39 | // ===== check ===== |
---|
40 | String spec = |
---|
41 | "UserSession {" + |
---|
42 | " Scroll body {}" + |
---|
43 | " Interaction elem1 {}" + |
---|
44 | "}"; |
---|
45 | |
---|
46 | // no defect expected, as interactions do not form tasks |
---|
47 | UsabilityDefect[] expectedDefects = new UsabilityDefect[] { }; |
---|
48 | |
---|
49 | assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec))); |
---|
50 | |
---|
51 | } |
---|
52 | |
---|
53 | /** |
---|
54 | * |
---|
55 | */ |
---|
56 | @Test |
---|
57 | public void testWithNormalScroll_02() { |
---|
58 | RequiredScrollRule rule = new RequiredScrollRule(); |
---|
59 | |
---|
60 | // ===== check ===== |
---|
61 | String spec = |
---|
62 | "UserSession {" + |
---|
63 | " Scroll body {}" + |
---|
64 | " Interaction elem1 {}" + |
---|
65 | " Scroll body {}" + |
---|
66 | " Interaction elem1 {}" + |
---|
67 | "}"; |
---|
68 | |
---|
69 | // no defect expected, as interactions do not form tasks |
---|
70 | UsabilityDefect[] expectedDefects = new UsabilityDefect[] { }; |
---|
71 | |
---|
72 | assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec))); |
---|
73 | |
---|
74 | } |
---|
75 | |
---|
76 | /** |
---|
77 | * |
---|
78 | */ |
---|
79 | @Test |
---|
80 | public void testWithNormalScroll_03() { |
---|
81 | RequiredScrollRule rule = new RequiredScrollRule(); |
---|
82 | |
---|
83 | // ===== check ===== |
---|
84 | String spec = |
---|
85 | "UserSession {" + |
---|
86 | " Sequence {" + |
---|
87 | " Scroll body {}" + |
---|
88 | " Interaction elem1 {}" + |
---|
89 | " }" + |
---|
90 | "}"; |
---|
91 | |
---|
92 | UsabilityDefect[] expectedDefects = new UsabilityDefect[] |
---|
93 | { new UsabilityDefect(HIGH, SCROLL_REQUIRED) }; |
---|
94 | |
---|
95 | assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec))); |
---|
96 | |
---|
97 | } |
---|
98 | |
---|
99 | /** |
---|
100 | * |
---|
101 | */ |
---|
102 | @Test |
---|
103 | public void testWithNormalScroll_04() { |
---|
104 | RequiredScrollRule rule = new RequiredScrollRule(); |
---|
105 | |
---|
106 | // ===== check ===== |
---|
107 | String spec = |
---|
108 | "UserSession {" + |
---|
109 | " Sequence seq1 {" + |
---|
110 | " Scroll body {}" + |
---|
111 | " Interaction elem1 {}" + |
---|
112 | " }" + |
---|
113 | " Sequence seq1 {" + |
---|
114 | " Scroll body {}" + |
---|
115 | " Interaction elem1 {}" + |
---|
116 | " }" + |
---|
117 | "}"; |
---|
118 | |
---|
119 | UsabilityDefect[] expectedDefects = new UsabilityDefect[] |
---|
120 | { new UsabilityDefect(HIGH, SCROLL_REQUIRED) }; |
---|
121 | |
---|
122 | assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec))); |
---|
123 | |
---|
124 | } |
---|
125 | |
---|
126 | /** |
---|
127 | * |
---|
128 | */ |
---|
129 | @Test |
---|
130 | public void testOnlySeldomPreceededByScroll_01() { |
---|
131 | RequiredScrollRule rule = new RequiredScrollRule(); |
---|
132 | |
---|
133 | // ===== check ===== |
---|
134 | String spec = |
---|
135 | "UserSession {" + |
---|
136 | " Sequence seq1 {" + |
---|
137 | " Interaction elem1 {}" + |
---|
138 | " Interaction elem1 {}" + |
---|
139 | " Interaction elem1 {}" + |
---|
140 | " Scroll body {}" + |
---|
141 | " Interaction elem1 {}" + |
---|
142 | " }" + |
---|
143 | "}"; |
---|
144 | |
---|
145 | UsabilityDefect[] expectedDefects = new UsabilityDefect[] { }; |
---|
146 | |
---|
147 | assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec))); |
---|
148 | |
---|
149 | } |
---|
150 | |
---|
151 | /** |
---|
152 | * |
---|
153 | */ |
---|
154 | @Test |
---|
155 | public void testOnlySeldomPreceededByScroll_02() { |
---|
156 | RequiredScrollRule rule = new RequiredScrollRule(); |
---|
157 | |
---|
158 | // ===== check ===== |
---|
159 | String spec = |
---|
160 | "UserSession {" + |
---|
161 | " Sequence seq1 {" + |
---|
162 | " Optional opt1 { }" + |
---|
163 | " Interaction elem1 {}" + |
---|
164 | " }" + |
---|
165 | " Sequence seq1 {" + |
---|
166 | " Optional opt1 {" + |
---|
167 | " Scroll body {}" + |
---|
168 | " }" + |
---|
169 | " Interaction elem1 {}" + |
---|
170 | " }" + |
---|
171 | " Sequence seq1 {" + |
---|
172 | " Optional opt1 {" + |
---|
173 | " Scroll body {}" + |
---|
174 | " }" + |
---|
175 | " Interaction elem1 {}" + |
---|
176 | " }" + |
---|
177 | "}"; |
---|
178 | |
---|
179 | UsabilityDefect[] expectedDefects = new UsabilityDefect[] |
---|
180 | { new UsabilityDefect(MEDIUM, SCROLL_REQUIRED) }; |
---|
181 | |
---|
182 | assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec))); |
---|
183 | |
---|
184 | } |
---|
185 | |
---|
186 | /** |
---|
187 | * |
---|
188 | */ |
---|
189 | @Test |
---|
190 | public void testOnlySeldomPreceededByScroll_03() { |
---|
191 | RequiredScrollRule rule = new RequiredScrollRule(); |
---|
192 | |
---|
193 | // ===== check ===== |
---|
194 | String spec = |
---|
195 | "UserSession {" + |
---|
196 | " Sequence seq1 {" + |
---|
197 | " Optional opt1 { }" + |
---|
198 | " Interaction elem1 {}" + |
---|
199 | " }" + |
---|
200 | " Sequence seq1 {" + |
---|
201 | " Optional opt1 {}" + |
---|
202 | " Interaction elem1 {}" + |
---|
203 | " }" + |
---|
204 | " Sequence seq1 {" + |
---|
205 | " Optional opt1 {" + |
---|
206 | " Scroll body {}" + |
---|
207 | " }" + |
---|
208 | " Interaction elem1 {}" + |
---|
209 | " }" + |
---|
210 | " Sequence seq1 {" + |
---|
211 | " Optional opt1 {" + |
---|
212 | " Scroll body {}" + |
---|
213 | " }" + |
---|
214 | " Interaction elem1 {}" + |
---|
215 | " }" + |
---|
216 | "}"; |
---|
217 | |
---|
218 | UsabilityDefect[] expectedDefects = new UsabilityDefect[] |
---|
219 | { new UsabilityDefect(LOW, SCROLL_REQUIRED) }; |
---|
220 | |
---|
221 | assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec))); |
---|
222 | |
---|
223 | } |
---|
224 | |
---|
225 | /** |
---|
226 | * |
---|
227 | */ |
---|
228 | @Test |
---|
229 | public void testOnlySeldomPreceededByScroll_04() { |
---|
230 | RequiredScrollRule rule = new RequiredScrollRule(); |
---|
231 | |
---|
232 | // ===== check ===== |
---|
233 | String spec = |
---|
234 | "UserSession {" + |
---|
235 | " Sequence seq1 {" + |
---|
236 | " Optional opt1 { }" + |
---|
237 | " Interaction elem1 {}" + |
---|
238 | " }" + |
---|
239 | " Sequence seq1 {" + |
---|
240 | " Optional opt1 { }" + |
---|
241 | " Interaction elem1 {}" + |
---|
242 | " }" + |
---|
243 | " Sequence seq1 {" + |
---|
244 | " Optional opt1 { }" + |
---|
245 | " Interaction elem1 {}" + |
---|
246 | " }" + |
---|
247 | " Sequence seq1 {" + |
---|
248 | " Optional opt1 {" + |
---|
249 | " Scroll body {}" + |
---|
250 | " }" + |
---|
251 | " Interaction elem1 {}" + |
---|
252 | " }" + |
---|
253 | "}"; |
---|
254 | |
---|
255 | UsabilityDefect[] expectedDefects = new UsabilityDefect[] |
---|
256 | { new UsabilityDefect(INFO, SCROLL_REQUIRED) }; |
---|
257 | |
---|
258 | assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec))); |
---|
259 | |
---|
260 | } |
---|
261 | |
---|
262 | /** |
---|
263 | * |
---|
264 | */ |
---|
265 | @Test |
---|
266 | public void testOnlySeldomPreceededByScroll_05() { |
---|
267 | RequiredScrollRule rule = new RequiredScrollRule(); |
---|
268 | |
---|
269 | // ===== check ===== |
---|
270 | String spec = |
---|
271 | "UserSession {" + |
---|
272 | " Sequence seq1 {" + |
---|
273 | " Optional opt1 { }" + |
---|
274 | " Interaction elem1 {}" + |
---|
275 | " }" + |
---|
276 | " Sequence seq1 {" + |
---|
277 | " Optional opt1 { }" + |
---|
278 | " Interaction elem1 {}" + |
---|
279 | " }" + |
---|
280 | " Sequence seq1 {" + |
---|
281 | " Optional opt1 { }" + |
---|
282 | " Interaction elem1 {}" + |
---|
283 | " }" + |
---|
284 | " Sequence seq1 {" + |
---|
285 | " Optional opt1 {" + |
---|
286 | " Scroll body {}" + |
---|
287 | " }" + |
---|
288 | " Interaction elem1 {}" + |
---|
289 | " }" + |
---|
290 | " Sequence seq1 {" + |
---|
291 | " Optional opt1 { }" + |
---|
292 | " Interaction elem1 {}" + |
---|
293 | " }" + |
---|
294 | " Sequence seq1 {" + |
---|
295 | " Optional opt1 { }" + |
---|
296 | " Interaction elem1 {}" + |
---|
297 | " }" + |
---|
298 | " Sequence seq1 {" + |
---|
299 | " Optional opt1 { }" + |
---|
300 | " Interaction elem1 {}" + |
---|
301 | " }" + |
---|
302 | " Sequence seq1 {" + |
---|
303 | " Optional opt1 { }" + |
---|
304 | " Interaction elem1 {}" + |
---|
305 | " }" + |
---|
306 | "}"; |
---|
307 | |
---|
308 | UsabilityDefect[] expectedDefects = new UsabilityDefect[] { }; |
---|
309 | |
---|
310 | assertUsabilityEvaluationResult(expectedDefects, rule.evaluate(createTaskModel(spec))); |
---|
311 | |
---|
312 | } |
---|
313 | } |
---|