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

Last change on this file since 1127 was 1127, checked in by pharms, 11 years ago
  • complete refactoring of task detection
  • many performance improvements in task detection
  • improved merging of sequences using Myers diff algorithm
File size: 4.0 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.tasktrees.nodeequality.NodeEquality;
23import de.ugoe.cs.autoquest.test.DummyGUIElement;
24import de.ugoe.cs.autoquest.test.DummyInteraction;
25
26/**
27 * TODO comment
28 *
29 * @version $Revision: $ $Date: 28.04.2012$
30 * @author 2012, last modified by $Author: patrick$
31 */
32public class SequenceForTaskDetectionRuleTest extends AbstractTemporalRelationshipTC {
33
34    /**
35     *
36     */
37    @Test
38    public void testTaskDetection() throws Exception {
39        IEventTarget element1 = new DummyGUIElement("elem1");
40       
41        IInteraction action1 = new DummyInteraction("action1", 1);
42        IInteraction action2 = new DummyInteraction("action2", 1);
43        IInteraction action3 = new DummyInteraction("action3", 1);
44        IInteraction action4 = new DummyInteraction("action4", 1);
45       
46        simulateEvent(new DummyInteraction("noise0", 1), element1);
47        simulateEvent(action1, element1);
48        simulateEvent(action2, element1);
49        simulateEvent(action3, element1);
50        simulateEvent(action4, element1);
51        simulateEvent(new DummyInteraction("noise1", 1), element1);
52        simulateEvent(new DummyInteraction("noise2", 1), element1);
53        simulateEvent(action1, element1);
54        simulateEvent(action2, element1);
55        simulateEvent(action3, element1);
56        simulateEvent(action4, element1);
57        simulateEvent(new DummyInteraction("noise3", 1), element1);
58        simulateEvent(new DummyInteraction("noise4", 1), element1);
59        simulateEvent(new DummyInteraction("noise5", 1), element1);
60        simulateEvent(new DummyInteraction("noise6", 1), element1);
61        simulateEvent(action1, element1);
62        simulateEvent(action2, element1);
63        simulateEvent(action3, element1);
64        simulateEvent(action4, element1);
65        simulateEvent(new DummyInteraction("noise7", 1), element1);
66        simulateEvent(new DummyInteraction("noise8", 1), element1);
67       
68        new TaskTreeChecker(true).assertTaskTree
69            ("Sequence root {" +
70             "  Sequence session1 {" +
71             "    Event noise0 {}" +
72             "    Sequence sequence2 {" +
73             "      Event action1 {}" +
74             "      Event action2 {}" +
75             "      Event action3 {}" +
76             "      Event action4 {}" +
77             "    }" +
78             "    Event noise1 {}" +
79             "    Event noise2 {}" +
80             "    Sequence sequence2 {" +
81             "      Event action1 {}" +
82             "      Event action2 {}" +
83             "      Event action3 {}" +
84             "      Event action4 {}" +
85             "    }" +
86             "    Event noise3 {}" +
87             "    Event noise4 {}" +
88             "    Event noise5 {}" +
89             "    Event noise6 {}" +
90             "    Sequence sequence2 {" +
91             "      Event action1 {}" +
92             "      Event action2 {}" +
93             "      Event action3 {}" +
94             "      Event action4 {}" +
95             "    }" +
96             "    Event noise7 {}" +
97             "    Event noise8 {}" +
98             "  }" +
99             "}", getTaskTree(SequenceForTaskDetectionRule.class, NodeEquality.LEXICALLY_EQUAL));
100
101    }
102
103}
Note: See TracBrowser for help on using the repository browser.