source: trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/DefaultTaskSequenceDetectionRuleTest.java @ 1109

Last change on this file since 1109 was 1109, checked in by pharms, 11 years ago
  • changed rules to be testable on their own
  • added first version for a task detection rule
  • refactored rules to have a simpler interface
File size: 3.8 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.tasktrees.temporalrelation;
16
17import org.junit.Test;
18
19import de.ugoe.cs.autoquest.eventcore.IEventTarget;
20import de.ugoe.cs.autoquest.eventcore.gui.IInteraction;
21import de.ugoe.cs.autoquest.tasktrees.TaskTreeChecker;
22import de.ugoe.cs.autoquest.test.DummyGUIElement;
23import de.ugoe.cs.autoquest.test.DummyInteraction;
24
25/**
26 * TODO comment
27 *
28 * @version $Revision: $ $Date: 28.04.2012$
29 * @author 2012, last modified by $Author: patrick$
30 */
31public class DefaultTaskSequenceDetectionRuleTest extends AbstractTemporalRelationshipTC {
32
33    /**
34     *
35     */
36    @Test
37    public void testTaskDetection() throws Exception {
38        IEventTarget element1 = new DummyGUIElement("elem1");
39       
40        IInteraction action1 = new DummyInteraction("action1", 1);
41        IInteraction action2 = new DummyInteraction("action2", 1);
42        IInteraction action3 = new DummyInteraction("action3", 1);
43        IInteraction action4 = new DummyInteraction("action4", 1);
44       
45        simulateEvent(new DummyInteraction("noise0", 1), element1);
46        simulateEvent(action1, element1);
47        simulateEvent(action2, element1);
48        simulateEvent(action3, element1);
49        simulateEvent(action4, element1);
50        simulateEvent(new DummyInteraction("noise1", 1), element1);
51        simulateEvent(new DummyInteraction("noise2", 1), element1);
52        simulateEvent(action1, element1);
53        simulateEvent(action2, element1);
54        simulateEvent(action3, element1);
55        simulateEvent(action4, element1);
56        simulateEvent(new DummyInteraction("noise3", 1), element1);
57        simulateEvent(new DummyInteraction("noise4", 1), element1);
58        simulateEvent(new DummyInteraction("noise5", 1), element1);
59        simulateEvent(new DummyInteraction("noise6", 1), element1);
60        simulateEvent(action1, element1);
61        simulateEvent(action2, element1);
62        simulateEvent(action3, element1);
63        simulateEvent(action4, element1);
64        simulateEvent(new DummyInteraction("noise7", 1), element1);
65        simulateEvent(new DummyInteraction("noise8", 1), element1);
66       
67        new TaskTreeChecker().assertTaskTree
68            ("Sequence sequence1 {" +
69             "  Event noise0 {}" +
70             "  Sequence sequence2 {" +
71             "    Event action1 {}" +
72             "    Event action2 {}" +
73             "    Event action3 {}" +
74             "    Event action4 {}" +
75             "  }" +
76             "  Event noise1 {}" +
77             "  Event noise2 {}" +
78             "  Sequence sequence2 {" +
79             "    Event action1 {}" +
80             "    Event action2 {}" +
81             "    Event action3 {}" +
82             "    Event action4 {}" +
83             "  }" +
84             "  Event noise3 {}" +
85             "  Event noise4 {}" +
86             "  Event noise5 {}" +
87             "  Event noise6 {}" +
88             "  Sequence sequence2 {" +
89             "    Event action1 {}" +
90             "    Event action2 {}" +
91             "    Event action3 {}" +
92             "    Event action4 {}" +
93             "  }" +
94             "  Event noise7 {}" +
95             "  Event noise8 {}" +
96             "}", getTaskTree());
97
98    }
99
100}
Note: See TracBrowser for help on using the repository browser.