source: trunk/autoquest-core-usability-test/src/test/java/de/ugoe/cs/autoquest/usability/DataEntryMethodChangeRuleTest.java @ 1918

Last change on this file since 1918 was 1918, checked in by pharms, 9 years ago
  • extension with further smell detections
  • may not fully work. But Hudson is more happy because compile errors should be gone
File size: 7.9 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;
16
17import static de.ugoe.cs.autoquest.usability.UsabilitySmellDescription.DATA_ENTRY_METHOD_CHANGE;
18
19import org.junit.Before;
20import org.junit.Test;
21
22import de.ugoe.cs.autoquest.usability.UsabilitySmell;
23
24/**
25 *
26 */
27public class DataEntryMethodChangeRuleTest 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 testNoEntryMethodChange_01() {
42        DataEntryMethodChangeRule rule = new DataEntryMethodChangeRule();
43
44        // ===== check =====
45        String spec =
46            "UserSession {" +
47            "  Interaction elem1 {}" +
48            "  Interaction elem1 {}" +
49            "}";
50       
51        // no smell expected, as there are no changes between mouse and keyboard
52        UsabilitySmell[] expectedSmells = new UsabilitySmell[] {  };
53
54        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
55    }
56   
57    /**
58     *
59     */
60    @Test
61    public void testNoEntryMethodChange_02() {
62        DataEntryMethodChangeRule rule = new DataEntryMethodChangeRule();
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 changes between mouse and keyboard
74        UsabilitySmell[] expectedSmells = new UsabilitySmell[] {  };
75
76        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
77    }
78   
79    /**
80     *
81     */
82    @Test
83    public void testNoEntryMethodChange_03() {
84        DataEntryMethodChangeRule rule = new DataEntryMethodChangeRule();
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 changes between mouse and keyboard
96        UsabilitySmell[] expectedSmells = new UsabilitySmell[] {  };
97
98        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
99    }
100   
101    /**
102     *
103     */
104    @Test
105    public void testNoEntryMethodChange_04() {
106        DataEntryMethodChangeRule rule = new DataEntryMethodChangeRule();
107
108        // ===== check =====
109        String spec =
110            "UserSession {" +
111            "  Sequence {" +
112            "    TextInput elem1 {}" +
113            "    TextInput elem2 {}" +
114            "  }" +
115            "}";
116       
117        // no smell expected, as there are no changes between mouse and keyboard
118        UsabilitySmell[] expectedSmells = new UsabilitySmell[] {  };
119
120        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
121    }
122
123    /**
124     *
125     */
126    @Test
127    public void testEntryMethodChange_01() {
128        DataEntryMethodChangeRule rule = new DataEntryMethodChangeRule();
129
130        // ===== check =====
131        String spec =
132            "UserSession {" +
133            "  Sequence {" +
134            "    MouseClick elem1 {}" +
135            "    TextInput elem2 {}" +
136            "  }" +
137            "}";
138       
139        UsabilitySmell[] expectedSmells = new UsabilitySmell[]
140            { new UsabilitySmell(UsabilitySmellIntensity.getIntensity(0),
141                                  DATA_ENTRY_METHOD_CHANGE) };
142
143        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
144    }
145
146    /**
147     *
148     */
149    @Test
150    public void testEntryMethodChange_02() {
151        DataEntryMethodChangeRule rule = new DataEntryMethodChangeRule();
152
153        // ===== check =====
154        String spec =
155            "UserSession {" +
156            "  Sequence {" +
157            "    TextInput elem1 {}" +
158            "    MouseClick elem2 {}" +
159            "  }" +
160            "}";
161       
162        UsabilitySmell[] expectedSmells = new UsabilitySmell[]
163            { new UsabilitySmell(UsabilitySmellIntensity.getIntensity(0),
164                                  DATA_ENTRY_METHOD_CHANGE) };
165
166        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
167    }
168
169    /**
170     *
171     */
172    @Test
173    public void testEntryMethodChange_03() {
174        DataEntryMethodChangeRule rule = new DataEntryMethodChangeRule();
175
176        // ===== check =====
177        String spec =
178            "UserSession {" +
179            "  Sequence seq1 {" +
180            "    Selection sel1 {" +
181            "      TextInput elem2 {}" +
182            "    }" +
183            "    MouseClick elem1 {}" +
184            "  }" +
185            "  Sequence seq1 {" +
186            "    Selection sel1 {" +
187            "      MouseClick elem2 {}" +
188            "    }" +
189            "    MouseClick elem1 {}" +
190            "  }" +
191            "}";
192       
193        UsabilitySmell[] expectedSmells = new UsabilitySmell[]
194            { new UsabilitySmell(UsabilitySmellIntensity.getIntensity(0),
195                                  DATA_ENTRY_METHOD_CHANGE) };
196
197        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
198    }
199
200    /**
201     *
202     */
203    @Test
204    public void testEntryMethodChange_04() {
205        DataEntryMethodChangeRule rule = new DataEntryMethodChangeRule();
206
207        // ===== check =====
208        String spec =
209            "UserSession {" +
210            "  Sequence seq1 {" +
211            "    MouseClick elem1 {}" +
212            "    Selection sel1 {" +
213            "      TextInput elem2 {}" +
214            "    }" +
215            "  }" +
216            "  Sequence seq1 {" +
217            "    MouseClick elem1 {}" +
218            "    Selection sel1 {" +
219            "      MouseClick elem2 {}" +
220            "    }" +
221            "  }" +
222            "  Sequence seq1 {" +
223            "    MouseClick elem1 {}" +
224            "    Selection sel1 {" +
225            "      MouseClick elem2 {}" +
226            "    }" +
227            "  }" +
228            "  Sequence seq1 {" +
229            "    MouseClick elem1 {}" +
230            "    Selection sel1 {" +
231            "      MouseClick elem2 {}" +
232            "    }" +
233            "  }" +
234            "  Sequence seq1 {" +
235            "    MouseClick elem1 {}" +
236            "    Selection sel1 {" +
237            "      MouseClick elem2 {}" +
238            "    }" +
239            "  }" +
240            "  Sequence seq1 {" +
241            "    MouseClick elem1 {}" +
242            "    Selection sel1 {" +
243            "      MouseClick elem2 {}" +
244            "    }" +
245            "  }" +
246            "  Sequence seq1 {" +
247            "    MouseClick elem1 {}" +
248            "    Selection sel1 {" +
249            "      MouseClick elem2 {}" +
250            "    }" +
251            "  }" +
252            "  Sequence seq1 {" +
253            "    MouseClick elem1 {}" +
254            "    Selection sel1 {" +
255            "      MouseClick elem2 {}" +
256            "    }" +
257            "  }" +
258            "}";
259       
260        UsabilitySmell[] expectedSmells = new UsabilitySmell[]
261            { new UsabilitySmell(UsabilitySmellIntensity.getIntensity(0),
262                                  DATA_ENTRY_METHOD_CHANGE) };
263
264        assertUsabilityEvaluationResult(expectedSmells, rule.evaluate(createTaskModel(spec)));
265    }
266}
Note: See TracBrowser for help on using the repository browser.