Changeset 1327 for trunk/autoquest-test-utils/src/test/java/de/ugoe/cs/autoquest/tasktrees/TaskTreeDecoderTest.java
- Timestamp:
- 01/15/14 16:05:34 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-test-utils/src/test/java/de/ugoe/cs/autoquest/tasktrees/TaskTreeDecoderTest.java
r1325 r1327 19 19 import org.junit.Test; 20 20 21 import de.ugoe.cs.autoquest.eventcore.Event; 22 import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement; 23 import de.ugoe.cs.autoquest.eventcore.guimodel.ITextArea; 24 import de.ugoe.cs.autoquest.eventcore.guimodel.ITextField; 21 25 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 22 26 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; … … 237 241 assertFalse(list.get(0).equals(list.get(1))); 238 242 assertTrue(list.get(0).getTask().equals(list.get(1).getTask())); 243 244 new TaskTreeValidator().validate(list); 245 } 246 247 /** 248 * 249 */ 250 @Test 251 public void test_GuiElements_01() { 252 String blub = 253 "UserSession {" + 254 " MouseClick elem1 { }" + 255 "}"; 256 257 TaskTreeDecoder decoder = new TaskTreeDecoder(new TaskFactory(), new TaskBuilder()); 258 259 ITaskInstanceList list = decoder.decode(blub); 260 261 assertTrue(list.get(0) instanceof IEventTaskInstance); 262 263 Event event = ((IEventTaskInstance) list.get(0)).getEvent(); 264 265 assertTrue(event.getTarget() instanceof IGUIElement); 266 assertFalse(event.getTarget() instanceof ITextArea); 267 assertFalse(event.getTarget() instanceof ITextField); 268 269 new TaskTreeValidator().validate(list); 270 } 271 272 /** 273 * 274 */ 275 @Test 276 public void test_GuiElements_02() { 277 String blub = 278 "UserSession {" + 279 " TextInput elem1 { }" + 280 "}"; 281 282 TaskTreeDecoder decoder = new TaskTreeDecoder(new TaskFactory(), new TaskBuilder()); 283 284 ITaskInstanceList list = decoder.decode(blub); 285 286 assertTrue(list.get(0) instanceof IEventTaskInstance); 287 288 Event event = ((IEventTaskInstance) list.get(0)).getEvent(); 289 290 assertTrue(event.getTarget() instanceof IGUIElement); 291 assertFalse(event.getTarget() instanceof ITextArea); 292 assertTrue(event.getTarget() instanceof ITextField); 293 294 new TaskTreeValidator().validate(list); 295 } 296 297 /** 298 * 299 */ 300 @Test 301 public void test_GuiElements_03() { 302 String blub = 303 "UserSession {" + 304 " OtherInteraction elem1 { }" + 305 " TextInput elem1 { }" + 306 "}"; 307 308 TaskTreeDecoder decoder = new TaskTreeDecoder(new TaskFactory(), new TaskBuilder()); 309 310 ITaskInstanceList list = decoder.decode(blub); 311 312 assertTrue(list.get(0) instanceof IEventTaskInstance); 313 314 Event event = ((IEventTaskInstance) list.get(0)).getEvent(); 315 316 assertTrue(event.getTarget() instanceof IGUIElement); 317 assertFalse(event.getTarget() instanceof ITextArea); 318 assertTrue(event.getTarget() instanceof ITextField); 319 320 assertTrue(list.get(1) instanceof IEventTaskInstance); 321 322 event = ((IEventTaskInstance) list.get(1)).getEvent(); 323 324 assertTrue(event.getTarget() instanceof IGUIElement); 325 assertFalse(event.getTarget() instanceof ITextArea); 326 assertTrue(event.getTarget() instanceof ITextField); 327 328 new TaskTreeValidator().validate(list); 329 } 330 331 /** 332 * 333 */ 334 @Test 335 public void test_GuiElements_04() { 336 String blub = 337 "UserSession {" + 338 " Sequence seq1 {" + 339 " TextInput elem1 { }" + 340 " }" + 341 "}"; 342 343 TaskTreeDecoder decoder = new TaskTreeDecoder(new TaskFactory(), new TaskBuilder()); 344 345 ITaskInstanceList list = decoder.decode(blub); 346 347 assertTrue(list.get(0) instanceof ISequenceInstance); 348 assertTrue(((ISequenceInstance) list.get(0)).get(0) instanceof IEventTaskInstance); 349 350 Event event = ((IEventTaskInstance) ((ISequenceInstance) list.get(0)).get(0)).getEvent(); 351 352 assertTrue(event.getTarget() instanceof IGUIElement); 353 assertFalse(event.getTarget() instanceof ITextArea); 354 assertTrue(event.getTarget() instanceof ITextField); 355 356 new TaskTreeValidator().validate(list); 357 } 358 359 /** 360 * 361 */ 362 @Test 363 public void test_GuiElements_05() { 364 String blub = 365 "UserSession {" + 366 " Selection sel1 {" + 367 " TextInput elem1 { }" + 368 " }" + 369 "}"; 370 371 TaskTreeDecoder decoder = new TaskTreeDecoder(new TaskFactory(), new TaskBuilder()); 372 373 ITaskInstanceList list = decoder.decode(blub); 374 375 assertTrue(list.get(0) instanceof ISelectionInstance); 376 assertTrue(((ISelectionInstance) list.get(0)).getChild() instanceof IEventTaskInstance); 377 378 Event event = 379 ((IEventTaskInstance) ((ISelectionInstance) list.get(0)).getChild()).getEvent(); 380 381 assertTrue(event.getTarget() instanceof IGUIElement); 382 assertFalse(event.getTarget() instanceof ITextArea); 383 assertTrue(event.getTarget() instanceof ITextField); 239 384 240 385 new TaskTreeValidator().validate(list);
Note: See TracChangeset
for help on using the changeset viewer.