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

Last change on this file since 1941 was 1941, checked in by pharms, 9 years ago
  • removed failing tests of not yet finished implementations
File size: 3.2 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 * @author Patrick Harms
39 */
40public class AbstractUsabilityEvaluationTC {
41
42    /** */
43    private ITaskBuilder taskBuilder = new TaskBuilder();
44
45    /** */
46    private ITaskFactory taskFactory = new TaskFactory();
47
48    /**
49     *
50     */
51    @Before
52    public void setUp() {
53        new TextConsole(Level.FINEST);
54    }
55
56    /**
57     *
58     */
59    protected ITaskModel createTaskModel(String spec) {
60        TaskTreeDecoder decoder = new TaskTreeDecoder(taskFactory, taskBuilder);
61       
62        ITaskInstanceList list = decoder.decode(spec);
63       
64        assertTrue(list instanceof IUserSession);
65       
66        List<IUserSession> sessions = new ArrayList<IUserSession>();
67        sessions.add((IUserSession) list);
68
69        return taskFactory.createTaskModel(sessions);
70    }
71
72    /**
73     *
74     */
75    protected void assertUsabilityEvaluationResult(UsabilitySmell[]          expectedSmells,
76                                                   UsabilityEvaluationResult evaluationResult)
77    {
78        assertEquals(evaluationResult.getAllSmells().toString(),
79                     expectedSmells.length, evaluationResult.getAllSmells().size());
80
81        EXPECTED_DEFECT_ITERATION:
82        for (UsabilitySmell expectedSmell : expectedSmells) {
83            for (UsabilitySmell smell : evaluationResult.getAllSmells()) {
84                if (expectedSmell.equals(smell)) {
85                    System.err.println(smell.getParameterizedDescription());
86                    continue EXPECTED_DEFECT_ITERATION;
87                }
88            }
89
90            for (UsabilitySmell smell : evaluationResult.getAllSmells()) {
91                System.err.println(smell);
92            }
93
94            fail("expected smell " + expectedSmell + " not found in evaluation result");
95        }
96    }
97
98}
Note: See TracBrowser for help on using the repository browser.