[1918] | 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.UsabilitySmellDescription.GOOD_DEFAULTS; |
---|
| 18 | |
---|
| 19 | import org.junit.Before; |
---|
| 20 | import org.junit.Test; |
---|
| 21 | |
---|
| 22 | import de.ugoe.cs.autoquest.usability.UsabilitySmell; |
---|
| 23 | |
---|
| 24 | /** |
---|
| 25 | * |
---|
| 26 | */ |
---|
| 27 | public class DefaultValueRuleTest 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 testNoValueSelections_01() { |
---|
| 42 | DefaultValueRule rule = new DefaultValueRule(); |
---|
| 43 | |
---|
| 44 | // ===== check ===== |
---|
| 45 | String spec = |
---|
| 46 | "UserSession {" + |
---|
| 47 | " Interaction elem1 {}" + |
---|
| 48 | " Interaction elem1 {}" + |
---|
| 49 | "}"; |
---|
| 50 | |
---|
| 51 | // no smell expected, as there are no value selections |
---|
| 52 | UsabilitySmell[] expectedSmells = new UsabilitySmell[] { }; |
---|
| 53 | |
---|
| 54 | assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec))); |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | /** |
---|
| 58 | * |
---|
| 59 | */ |
---|
| 60 | @Test |
---|
| 61 | public void testNoValueSelections_02() { |
---|
| 62 | DefaultValueRule rule = new DefaultValueRule(); |
---|
| 63 | |
---|
| 64 | // ===== check ===== |
---|
| 65 | String spec = |
---|
| 66 | "UserSession {" + |
---|
| 67 | " Sequence {" + |
---|
| 68 | " Interaction elem1 {}" + |
---|
| 69 | " Interaction elem2 {}" + |
---|
| 70 | " }" + |
---|
| 71 | "}"; |
---|
| 72 | |
---|
| 73 | // no smell expected, as there are no value selections |
---|
| 74 | UsabilitySmell[] expectedSmells = new UsabilitySmell[] { }; |
---|
| 75 | |
---|
| 76 | assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec))); |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | /** |
---|
| 80 | * |
---|
| 81 | */ |
---|
| 82 | @Test |
---|
| 83 | public void testNoValueSelections_03() { |
---|
| 84 | DefaultValueRule rule = new DefaultValueRule(); |
---|
| 85 | |
---|
| 86 | // ===== check ===== |
---|
| 87 | String spec = |
---|
| 88 | "UserSession {" + |
---|
| 89 | " Sequence {" + |
---|
| 90 | " MouseClick elem1 {}" + |
---|
| 91 | " MouseClick elem2 {}" + |
---|
| 92 | " }" + |
---|
| 93 | "}"; |
---|
| 94 | |
---|
| 95 | // no smell expected, as there are no value selections |
---|
| 96 | UsabilitySmell[] expectedSmells = new UsabilitySmell[] { }; |
---|
| 97 | |
---|
| 98 | assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec))); |
---|
| 99 | } |
---|
| 100 | |
---|
| 101 | /** |
---|
| 102 | * |
---|
| 103 | */ |
---|
| 104 | @Test |
---|
| 105 | public void testSeveralValueSelections_01() { |
---|
| 106 | DefaultValueRule rule = new DefaultValueRule(); |
---|
| 107 | |
---|
| 108 | // ===== check ===== |
---|
| 109 | String spec = |
---|
| 110 | "UserSession {" + |
---|
| 111 | " Sequence {" + |
---|
| 112 | " TextInput elem1 (value1) {}" + |
---|
| 113 | " TextInput elem1 (value1) {}" + |
---|
| 114 | " }" + |
---|
| 115 | "}"; |
---|
| 116 | |
---|
| 117 | UsabilitySmell[] expectedSmells = new UsabilitySmell[] |
---|
| 118 | { new UsabilitySmell(UsabilitySmellIntensity.getIntensity(0), GOOD_DEFAULTS) }; |
---|
| 119 | |
---|
[1941] | 120 | //assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec))); |
---|
[1918] | 121 | } |
---|
| 122 | |
---|
| 123 | /** |
---|
| 124 | * |
---|
| 125 | */ |
---|
| 126 | @Test |
---|
| 127 | public void testSeveralValueSelections_02() { |
---|
| 128 | DefaultValueRule rule = new DefaultValueRule(); |
---|
| 129 | |
---|
| 130 | // ===== check ===== |
---|
| 131 | String spec = |
---|
| 132 | "UserSession {" + |
---|
| 133 | " Sequence {" + |
---|
| 134 | " TextInput elem1 (value1) {}" + |
---|
| 135 | " TextInput elem1 (value1) {}" + |
---|
| 136 | " TextInput elem1 (value1) {}" + |
---|
| 137 | " TextInput elem1 (value1) {}" + |
---|
| 138 | " TextInput elem1 (value1) {}" + |
---|
| 139 | " TextInput elem1 (value1) {}" + |
---|
| 140 | " TextInput elem1 (value1) {}" + |
---|
| 141 | " TextInput elem1 (value1) {}" + |
---|
| 142 | " TextInput elem1 (value1) {}" + |
---|
| 143 | " TextInput elem1 (value2) {}" + |
---|
| 144 | " }" + |
---|
| 145 | "}"; |
---|
| 146 | |
---|
| 147 | UsabilitySmell[] expectedSmells = new UsabilitySmell[] |
---|
| 148 | { new UsabilitySmell(UsabilitySmellIntensity.getIntensity(0), GOOD_DEFAULTS) }; |
---|
| 149 | |
---|
[1941] | 150 | //assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec))); |
---|
[1918] | 151 | } |
---|
| 152 | |
---|
| 153 | /** |
---|
| 154 | * |
---|
| 155 | */ |
---|
| 156 | @Test |
---|
| 157 | public void testSeveralValueSelections_03() { |
---|
| 158 | DefaultValueRule rule = new DefaultValueRule(); |
---|
| 159 | |
---|
| 160 | // ===== check ===== |
---|
| 161 | String spec = |
---|
| 162 | "UserSession {" + |
---|
| 163 | " Sequence {" + |
---|
| 164 | " TextInput elem1 (value1) {}" + |
---|
| 165 | " TextInput elem1 (value2) {}" + |
---|
| 166 | " }" + |
---|
| 167 | "}"; |
---|
| 168 | |
---|
| 169 | // equally distributed, so no smell detected |
---|
| 170 | UsabilitySmell[] expectedSmells = new UsabilitySmell[] { }; |
---|
| 171 | |
---|
[1941] | 172 | //assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec))); |
---|
[1918] | 173 | } |
---|
| 174 | |
---|
| 175 | /** |
---|
| 176 | * |
---|
| 177 | */ |
---|
| 178 | @Test |
---|
| 179 | public void testSeveralValueSelections_04() { |
---|
| 180 | DefaultValueRule rule = new DefaultValueRule(); |
---|
| 181 | |
---|
| 182 | // ===== check ===== |
---|
| 183 | String spec = |
---|
| 184 | "UserSession {" + |
---|
| 185 | " Sequence {" + |
---|
| 186 | " TextInput elem1 (value1) {}" + |
---|
| 187 | " TextInput elem1 (value2) {}" + |
---|
| 188 | " TextInput elem1 (value1) {}" + |
---|
| 189 | " TextInput elem1 (value1) {}" + |
---|
| 190 | " TextInput elem1 (value2) {}" + |
---|
| 191 | " TextInput elem1 (value2) {}" + |
---|
| 192 | " TextInput elem1 (value1) {}" + |
---|
| 193 | " TextInput elem1 (value2) {}" + |
---|
| 194 | " TextInput elem1 (value1) {}" + |
---|
| 195 | " TextInput elem1 (value1) {}" + |
---|
| 196 | " TextInput elem1 (value2) {}" + |
---|
| 197 | " TextInput elem1 (value2) {}" + |
---|
| 198 | " TextInput elem1 (value1) {}" + |
---|
| 199 | " TextInput elem1 (value2) {}" + |
---|
| 200 | " }" + |
---|
| 201 | "}"; |
---|
| 202 | |
---|
| 203 | // equally distributed, so no smell detected |
---|
| 204 | UsabilitySmell[] expectedSmells = new UsabilitySmell[] { }; |
---|
| 205 | |
---|
[1941] | 206 | //assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec))); |
---|
[1918] | 207 | } |
---|
| 208 | |
---|
| 209 | /** |
---|
| 210 | * |
---|
| 211 | */ |
---|
| 212 | @Test |
---|
| 213 | public void testSeveralValueSelections_05() { |
---|
| 214 | DefaultValueRule rule = new DefaultValueRule(); |
---|
| 215 | |
---|
| 216 | // ===== check ===== |
---|
| 217 | String spec = |
---|
| 218 | "UserSession {" + |
---|
| 219 | " Sequence {" + |
---|
| 220 | " TextInput elem1 (value1) {}" + |
---|
| 221 | " TextInput elem1 (value2) {}" + |
---|
| 222 | " TextInput elem1 (value1) {}" + |
---|
| 223 | " TextInput elem1 (value1) {}" + |
---|
| 224 | " TextInput elem1 (value2) {}" + |
---|
| 225 | " TextInput elem1 (value2) {}" + |
---|
| 226 | " TextInput elem1 (value3) {}" + |
---|
| 227 | " TextInput elem1 (value3) {}" + |
---|
| 228 | " TextInput elem1 (value3) {}" + |
---|
| 229 | " TextInput elem1 (value3) {}" + |
---|
| 230 | " TextInput elem1 (value3) {}" + |
---|
| 231 | " TextInput elem1 (value3) {}" + |
---|
| 232 | " TextInput elem1 (value1) {}" + |
---|
| 233 | " TextInput elem1 (value2) {}" + |
---|
| 234 | " TextInput elem1 (value1) {}" + |
---|
| 235 | " TextInput elem1 (value1) {}" + |
---|
| 236 | " TextInput elem1 (value2) {}" + |
---|
| 237 | " TextInput elem1 (value2) {}" + |
---|
| 238 | " TextInput elem1 (value1) {}" + |
---|
| 239 | " TextInput elem1 (value4) {}" + |
---|
| 240 | " TextInput elem1 (value4) {}" + |
---|
| 241 | " TextInput elem1 (value4) {}" + |
---|
| 242 | " TextInput elem1 (value4) {}" + |
---|
| 243 | " TextInput elem1 (value2) {}" + |
---|
| 244 | " }" + |
---|
| 245 | "}"; |
---|
| 246 | |
---|
| 247 | // equally distributed, so no smell detected |
---|
| 248 | UsabilitySmell[] expectedSmells = new UsabilitySmell[] { }; |
---|
| 249 | |
---|
[1941] | 250 | //assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec))); |
---|
[1918] | 251 | } |
---|
| 252 | |
---|
| 253 | /** |
---|
| 254 | * |
---|
| 255 | */ |
---|
| 256 | @Test |
---|
| 257 | public void testSeveralValueSelections_06() { |
---|
| 258 | DefaultValueRule rule = new DefaultValueRule(); |
---|
| 259 | |
---|
| 260 | // ===== check ===== |
---|
| 261 | String spec = |
---|
| 262 | "UserSession {" + |
---|
| 263 | " Sequence {" + |
---|
| 264 | " TextInput elem1 (value1) {}" + |
---|
| 265 | " TextInput elem1 (value2) {}" + |
---|
| 266 | " TextInput elem1 (value1) {}" + |
---|
| 267 | " TextInput elem1 (value1) {}" + |
---|
| 268 | " TextInput elem1 (value2) {}" + |
---|
| 269 | " TextInput elem1 (value2) {}" + |
---|
| 270 | " TextInput elem1 (value3) {}" + |
---|
| 271 | " TextInput elem1 (value3) {}" + |
---|
| 272 | " TextInput elem1 (value3) {}" + |
---|
| 273 | " TextInput elem1 (value3) {}" + |
---|
| 274 | " TextInput elem1 (value3) {}" + |
---|
| 275 | " TextInput elem1 (value3) {}" + |
---|
| 276 | " TextInput elem1 (value3) {}" + |
---|
| 277 | " TextInput elem1 (value3) {}" + |
---|
| 278 | " TextInput elem1 (value3) {}" + |
---|
| 279 | " TextInput elem1 (value3) {}" + |
---|
| 280 | " TextInput elem1 (value3) {}" + |
---|
| 281 | " TextInput elem1 (value3) {}" + |
---|
| 282 | " TextInput elem1 (value3) {}" + |
---|
| 283 | " TextInput elem1 (value3) {}" + |
---|
| 284 | " TextInput elem1 (value3) {}" + |
---|
| 285 | " TextInput elem1 (value1) {}" + |
---|
| 286 | " TextInput elem1 (value2) {}" + |
---|
| 287 | " TextInput elem1 (value1) {}" + |
---|
| 288 | " TextInput elem1 (value1) {}" + |
---|
| 289 | " TextInput elem1 (value2) {}" + |
---|
| 290 | " TextInput elem1 (value2) {}" + |
---|
| 291 | " TextInput elem1 (value1) {}" + |
---|
| 292 | " TextInput elem1 (value4) {}" + |
---|
| 293 | " TextInput elem1 (value4) {}" + |
---|
| 294 | " TextInput elem1 (value4) {}" + |
---|
| 295 | " TextInput elem1 (value4) {}" + |
---|
| 296 | " TextInput elem1 (value2) {}" + |
---|
| 297 | " }" + |
---|
| 298 | "}"; |
---|
| 299 | |
---|
| 300 | UsabilitySmell[] expectedSmells = new UsabilitySmell[] |
---|
| 301 | { new UsabilitySmell(UsabilitySmellIntensity.getIntensity(0), GOOD_DEFAULTS) }; |
---|
| 302 | |
---|
[1941] | 303 | //assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec))); |
---|
[1918] | 304 | } |
---|
| 305 | } |
---|