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

Last change on this file since 1335 was 1335, checked in by pharms, 10 years ago
  • corrected and extended usability evaluations
  • checking now more text field specific for required input formats and word repetitions
  • checking also for required scrolls
File size: 3.3 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 org.junit.Assert.assertEquals;
18import static org.junit.Assert.assertTrue;
19import static org.junit.Assert.fail;
20
21import java.util.ArrayList;
22import java.util.List;
23import java.util.logging.Level;
24
25import org.junit.Before;
26
27import de.ugoe.cs.autoquest.tasktrees.TaskTreeDecoder;
28import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder;
29import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory;
30import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstanceList;
31import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
32import de.ugoe.cs.autoquest.tasktrees.treeifc.IUserSession;
33import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder;
34import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory;
35import de.ugoe.cs.util.console.TextConsole;
36
37/**
38 * TODO comment
39 *
40 * @version $Revision: $ $Date: 18.07.2012$
41 * @author 2012, last modified by $Author: pharms$
42 */
43public class AbstractUsabilityEvaluationTC {
44
45    /** */
46    private ITaskBuilder taskBuilder = new TaskBuilder();
47
48    /** */
49    private ITaskFactory taskFactory = new TaskFactory();
50
51    /**
52     *
53     */
54    @Before
55    public void setUp() {
56        new TextConsole(Level.FINEST);
57    }
58
59    /**
60     *
61     */
62    protected ITaskModel createTaskModel(String spec) {
63        TaskTreeDecoder decoder = new TaskTreeDecoder(taskFactory, taskBuilder);
64       
65        ITaskInstanceList list = decoder.decode(spec);
66       
67        assertTrue(list instanceof IUserSession);
68       
69        List<IUserSession> sessions = new ArrayList<IUserSession>();
70        sessions.add((IUserSession) list);
71
72        return taskFactory.createTaskModel(sessions);
73    }
74
75    /**
76     * TODO: comment
77     *
78     * @param expectedDefects
79     * @param evaluateUsability
80     */
81    protected void assertUsabilityEvaluationResult(UsabilityDefect[]         expectedDefects,
82                                                   UsabilityEvaluationResult evaluationResult)
83    {
84        assertEquals(evaluationResult.getAllDefects().toString(),
85                     expectedDefects.length, evaluationResult.getAllDefects().size());
86
87        EXPECTED_DEFECT_ITERATION:
88        for (UsabilityDefect expectedDefect : expectedDefects) {
89            for (UsabilityDefect defect : evaluationResult.getAllDefects()) {
90                if (expectedDefect.equals(defect)) {
91                    System.err.println(defect.getParameterizedDescription());
92                    continue EXPECTED_DEFECT_ITERATION;
93                }
94            }
95
96            for (UsabilityDefect defect : evaluationResult.getAllDefects()) {
97                System.err.println(defect);
98            }
99
100            fail("expected defect " + expectedDefect + " not found in evaluation result");
101        }
102    }
103
104}
Note: See TracBrowser for help on using the repository browser.