source: trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/LongFormUsageDefectTest.java @ 1151

Last change on this file since 1151 was 1151, checked in by adeicke, 11 years ago

Added tests for usage pattern detection-

  • Property svn:mime-type set to text/plain
File size: 3.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.usability.rules.patterns;
16
17import static de.ugoe.cs.autoquest.usability.testutil.FestConditionUtil.absent;
18import static de.ugoe.cs.autoquest.usability.testutil.FestConditionUtil.present;
19import static org.fest.assertions.api.Assertions.assertThat;
20
21import org.junit.Test;
22
23import com.google.common.base.Optional;
24
25import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTree;
26import de.ugoe.cs.autoquest.usability.result.UsabilityDefect;
27import de.ugoe.cs.autoquest.usability.testutil.GenerateTaskTreeUtil;
28
29/**
30 * <p>
31 * TODO comment
32 * </p>
33 *
34 * @author Alexander Deicke
35 */
36public class LongFormUsageDefectTest {
37
38    @Test
39    public void should_be_present() {
40        // Given
41        String spec = "Sequence {" +
42                      "  Selection {" +
43                      "     MouseClick() {}" +
44                      "     Sequence() {" +
45                      "       MouseClick() {}" +
46                      "       Iteration {" +
47                      "         Sequence {" +
48                      "           TextInput() {}" +
49                      "           Scroll () {}" +
50                      "         }" +
51                      "       }" +
52                      "       MouseClick() {}" +
53                      "     }" +
54                      "  }" +
55                      "}";
56        ITaskTree taskTree = GenerateTaskTreeUtil.getTaskTreeFromSpec(spec);
57        // When
58        Optional<UsabilityDefect> recommendation = new LongFormUsageDefect(taskTree).check();
59        // Then
60        assertThat(recommendation).is(present());
61    }
62   
63    @Test
64    public void should_be_absent() {
65        // Given
66        String spec = "Sequence {" +
67                      "  Selection {" +
68                      "     MouseClick() {}" +
69                      "     Sequence() {" +
70                      "       MouseClick() {}" +
71                      "       TextInput() {}" +
72                      "       Iteration {" +
73                      "         Scroll () {}" +
74                      "       }" +
75                      "       MouseClick() {}" +
76                      "     }" +
77                      "  }" +
78                      "}";
79        ITaskTree taskTree = GenerateTaskTreeUtil.getTaskTreeFromSpec(spec);
80        // When
81        Optional<UsabilityDefect> recommendation = new LongFormUsageDefect(taskTree).check();
82        // Then
83        assertThat(recommendation).is(absent());
84    }
85
86}
Note: See TracBrowser for help on using the repository browser.