Ignore:
Timestamp:
03/27/13 15:01:00 (12 years ago)
Author:
adeicke
Message:

Adapted test project to refactoring of evaluation project.

Location:
trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability
Files:
2 added
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/metrics/AbstractUsabilityEvaluationTC.java

    r1040 r1141  
    1313//   limitations under the License. 
    1414 
    15 package de.ugoe.cs.autoquest.usability.evaluation.rule.evaluator; 
     15package de.ugoe.cs.autoquest.usability.rules.metrics; 
    1616 
    1717import static org.junit.Assert.assertEquals; 
  • trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/metrics/NoLetterOrDigitTextInputsEvaluatorTest.java

    r1040 r1141  
    1313//   limitations under the License. 
    1414 
    15 package de.ugoe.cs.autoquest.usability.evaluation.rule.evaluator; 
     15package de.ugoe.cs.autoquest.usability.rules.metrics; 
    1616 
    17 import static de.ugoe.cs.autoquest.usability.evaluation.rule.set.RulesetFactory.textInputUsabiliyRuleset; 
    1817import static de.ugoe.cs.autoquest.usability.testutil.FestConditionUtil.absent; 
    1918import static de.ugoe.cs.autoquest.usability.testutil.FestConditionUtil.highRecommendationSeverityLevel; 
     
    2423import static org.fest.assertions.api.Assertions.assertThat; 
    2524 
    26 import java.util.EnumSet; 
    27  
    28 import org.junit.After; 
    29 import org.junit.Before; 
    3025import org.junit.Test; 
    3126 
    3227import com.google.common.base.Optional; 
    33 import com.google.common.base.Predicate; 
    34 import com.google.common.collect.Iterables; 
    3528 
    3629import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTree; 
    37 import de.ugoe.cs.autoquest.usability.evaluation.result.UsabilityDefect; 
    38 import de.ugoe.cs.autoquest.usability.evaluation.rule.set.UsabilityRule; 
    39 import de.ugoe.cs.autoquest.usability.tasktree.filter.FilterStatisticCache; 
     30import de.ugoe.cs.autoquest.usability.result.UsabilityDefect; 
     31import de.ugoe.cs.autoquest.usability.rules.metrics.NoLetterOrDigitRatioMetric; 
    4032 
    4133/** 
     
    4840public class NoLetterOrDigitTextInputsEvaluatorTest extends AbstractUsabilityEvaluationTC { 
    4941 
    50     private UsabilityRule ruleUnderTest; 
    51  
    52     @Before 
    53     public void initRuleUnderTest() { 
    54         EnumSet<? extends UsabilityRule> ruleset = textInputUsabiliyRuleset().evaluationRules(); 
    55         this.ruleUnderTest = Iterables.find(ruleset, new Predicate<UsabilityRule>() { 
    56  
    57             public boolean apply(UsabilityRule usabilityRule) { 
    58                 return usabilityRule.ruleIdentifier().equals("TEXT_FIELD_NO_LETTER_OR_DIGIT_RATIO"); 
    59             } 
    60  
    61         }); 
    62     } 
    63  
    64     @After 
    65     public void clearFilterStatisticCache() { 
    66         FilterStatisticCache.instance().clear(); 
    67     } 
    68  
    6942    @Test 
    7043    public void should_return_no_recommendation() { 
    7144        // Given 
    72         String spec = "Sequence {" + "  TextInput () {}" + "}"; 
     45        String spec = "Sequence {" +  
     46                      "  TextInput () {}" +  
     47                      "}"; 
    7348        ITaskTree taskTree = createTaskTree(spec); 
    7449        // When 
    75         Optional<UsabilityDefect> recommendation = 
    76             new NoLetterOrDigitTextInputsEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 
     50        Optional<UsabilityDefect> recommendation = new NoLetterOrDigitRatioMetric(taskTree).check(); 
    7751        // Then 
    7852        assertThat(recommendation).is(absent()); 
     
    8357        // Given 
    8458        String spec = 
    85             "Sequence {" 
    86                 + "  TextInput (1234567890123456789012345678901234567890123456789_01234567890" 
    87                 + "12345678901234567890123456789012345) {}" + "}"; 
     59            "Sequence {" +  
     60            "  TextInput (1234567890123456789012345678901234567890123456789_01234567890" +  
     61                         "12345678901234567890123456789012345) {}" +  
     62            "}"; 
    8863        ITaskTree taskTree = createTaskTree(spec); 
    8964        // When 
    90         Optional<UsabilityDefect> recommendation = 
    91             new NoLetterOrDigitTextInputsEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 
     65        Optional<UsabilityDefect> recommendation = new NoLetterOrDigitRatioMetric(taskTree).check(); 
    9266        // Then 
    9367        assertThat(recommendation).is(present()).has(infoRecommendationSeverityLevel()); 
     
    9872        // Given 
    9973        String spec = 
    100             "Sequence {" + "  TextInput (123456789012345678901234567890_123456789012345) {}" + "}"; 
     74            "Sequence {" +  
     75            "  TextInput (123456789012345678901234567890_123456789012345) {}" +  
     76            "}"; 
    10177        ITaskTree taskTree = createTaskTree(spec); 
    10278        // When 
    103         Optional<UsabilityDefect> recommendation = 
    104             new NoLetterOrDigitTextInputsEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 
     79        Optional<UsabilityDefect> recommendation = new NoLetterOrDigitRatioMetric(taskTree).check(); 
    10580        // Then 
    10681        assertThat(recommendation).is(present()).has(lowRecommendationSeverityLevel()); 
     
    11085    public void should_return_recommendation_with_medium_severity_level() { 
    11186        // Given 
    112         String spec = "Sequence {" + "  TextInput (12345_6789012345) {}" + "}"; 
     87        String spec = "Sequence {" +  
     88                      "  TextInput (12345_6789012345) {}" +  
     89                      "}"; 
    11390        ITaskTree taskTree = createTaskTree(spec); 
    11491        // When 
    115         Optional<UsabilityDefect> recommendation = 
    116             new NoLetterOrDigitTextInputsEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 
     92        Optional<UsabilityDefect> recommendation = new NoLetterOrDigitRatioMetric(taskTree).check(); 
    11793        // Then 
    11894        assertThat(recommendation).is(present()).has(mediumRecommendationSeverityLevel()); 
     
    12298    public void should_return_recommendation_with_high_severity_level() { 
    12399        // Given 
    124         String spec = "Sequence {" + "  TextInput (_a_b_c_) {}" + "}"; 
     100        String spec = "Sequence {" + 
     101                      "  TextInput (_a_b_c_) {}" + 
     102                      "}"; 
    125103        ITaskTree taskTree = createTaskTree(spec); 
    126104        // When 
    127         Optional<UsabilityDefect> recommendation = 
    128             new NoLetterOrDigitTextInputsEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 
     105        Optional<UsabilityDefect> recommendation = new NoLetterOrDigitRatioMetric(taskTree).check(); 
    129106        // Then 
    130107        assertThat(recommendation).is(present()).has(highRecommendationSeverityLevel()); 
  • trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/metrics/TextInputEntryRepetitionsEvaluatorTest.java

    r1040 r1141  
    1313//   limitations under the License. 
    1414 
    15 package de.ugoe.cs.autoquest.usability.evaluation.rule.evaluator; 
     15package de.ugoe.cs.autoquest.usability.rules.metrics; 
    1616 
    17 import static de.ugoe.cs.autoquest.usability.evaluation.rule.set.RulesetFactory.textInputUsabiliyRuleset; 
    1817import static de.ugoe.cs.autoquest.usability.testutil.FestConditionUtil.absent; 
    1918import static de.ugoe.cs.autoquest.usability.testutil.FestConditionUtil.highRecommendationSeverityLevel; 
     
    2423import static org.fest.assertions.api.Assertions.assertThat; 
    2524 
    26 import java.util.EnumSet; 
    27  
    28 import org.junit.After; 
    29 import org.junit.Before; 
    3025import org.junit.Test; 
    3126 
    3227import com.google.common.base.Optional; 
    33 import com.google.common.base.Predicate; 
    34 import com.google.common.collect.Iterables; 
    3528 
    3629import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTree; 
    37 import de.ugoe.cs.autoquest.usability.evaluation.result.UsabilityDefect; 
    38 import de.ugoe.cs.autoquest.usability.evaluation.rule.set.UsabilityRule; 
    39 import de.ugoe.cs.autoquest.usability.tasktree.filter.FilterStatisticCache; 
     30import de.ugoe.cs.autoquest.usability.result.UsabilityDefect; 
     31import de.ugoe.cs.autoquest.usability.rules.metrics.TextInputEntryRepetitionsMetric; 
    4032 
    4133/** 
     
    4840public class TextInputEntryRepetitionsEvaluatorTest extends AbstractUsabilityEvaluationTC { 
    4941 
    50     private UsabilityRule ruleUnderTest; 
    51  
    52     @Before 
    53     public void initRuleUnderTest() { 
    54         EnumSet<? extends UsabilityRule> ruleset = textInputUsabiliyRuleset().evaluationRules(); 
    55         this.ruleUnderTest = Iterables.find(ruleset, new Predicate<UsabilityRule>() { 
    56  
    57             public boolean apply(UsabilityRule usabilityRule) { 
    58                 return usabilityRule.ruleIdentifier().equals("TEXT_FIELD_INPUT_REPETITIONS"); 
    59             } 
    60  
    61         }); 
    62     } 
    63  
    64     @After 
    65     public void clearFilterStatisticCache() { 
    66         FilterStatisticCache.instance().clear(); 
    67     } 
    68  
    6942    @Test 
    7043    public void should_return_no_recommendation() { 
     
    7346        ITaskTree taskTree = createTaskTree(spec); 
    7447        // When 
    75         Optional<UsabilityDefect> recommendation = 
    76             new TextInputEntryRepetitionsEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 
     48        Optional<UsabilityDefect> recommendation = new TextInputEntryRepetitionsMetric(taskTree).check(); 
    7749        // Then 
    7850        assertThat(recommendation).is(absent()); 
     
    8759        ITaskTree taskTree = createTaskTree(spec); 
    8860        // When 
    89         Optional<UsabilityDefect> recommendation = 
    90             new TextInputEntryRepetitionsEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 
     61        Optional<UsabilityDefect> recommendation = new TextInputEntryRepetitionsMetric(taskTree).check(); 
    9162        // Then 
    9263        assertThat(recommendation).is(present()).has(infoRecommendationSeverityLevel()); 
     
    10172        ITaskTree taskTree = createTaskTree(spec); 
    10273        // When 
    103         Optional<UsabilityDefect> recommendation = 
    104             new TextInputEntryRepetitionsEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 
     74        Optional<UsabilityDefect> recommendation = new TextInputEntryRepetitionsMetric(taskTree).check(); 
    10575        // Then 
    10676        assertThat(recommendation).is(present()).has(lowRecommendationSeverityLevel()); 
     
    12191        ITaskTree taskTree = createTaskTree(spec); 
    12292        // When 
    123         Optional<UsabilityDefect> recommendation = 
    124             new TextInputEntryRepetitionsEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 
     93        Optional<UsabilityDefect> recommendation = new TextInputEntryRepetitionsMetric(taskTree).check(); 
    12594        // Then 
    12695        assertThat(recommendation).is(present()).has(mediumRecommendationSeverityLevel()); 
     
    141110        ITaskTree taskTree = createTaskTree(spec); 
    142111        // When 
    143         Optional<UsabilityDefect> recommendation = 
    144             new TextInputEntryRepetitionsEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 
     112        Optional<UsabilityDefect> recommendation = new TextInputEntryRepetitionsMetric(taskTree).check(); 
    145113        // Then 
    146114        assertThat(recommendation).is(present()).has(highRecommendationSeverityLevel()); 
  • trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/metrics/TextInputRatioEvaluatorTest.java

    r1040 r1141  
    1313//   limitations under the License. 
    1414 
    15 package de.ugoe.cs.autoquest.usability.evaluation.rule.evaluator; 
     15package de.ugoe.cs.autoquest.usability.rules.metrics; 
    1616 
    17 import static de.ugoe.cs.autoquest.usability.evaluation.rule.set.RulesetFactory.textInputUsabiliyRuleset; 
    1817import static de.ugoe.cs.autoquest.usability.testutil.FestConditionUtil.absent; 
    1918import static de.ugoe.cs.autoquest.usability.testutil.FestConditionUtil.highRecommendationSeverityLevel; 
     
    2423import static org.fest.assertions.api.Assertions.assertThat; 
    2524 
    26 import java.util.EnumSet; 
    27  
    28 import org.junit.After; 
    29 import org.junit.Before; 
    3025import org.junit.Test; 
    3126 
    3227import com.google.common.base.Optional; 
    33 import com.google.common.base.Predicate; 
    34 import com.google.common.collect.Iterables; 
    3528 
    3629import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTree; 
    37 import de.ugoe.cs.autoquest.usability.evaluation.result.UsabilityDefect; 
    38 import de.ugoe.cs.autoquest.usability.evaluation.rule.set.UsabilityRule; 
    39 import de.ugoe.cs.autoquest.usability.tasktree.filter.FilterStatisticCache; 
     30import de.ugoe.cs.autoquest.usability.result.UsabilityDefect; 
     31import de.ugoe.cs.autoquest.usability.rules.metrics.TextInputRatioMetric; 
    4032 
    4133/** 
     
    4840public class TextInputRatioEvaluatorTest extends AbstractUsabilityEvaluationTC { 
    4941 
    50     private UsabilityRule ruleUnderTest; 
    51  
    52     @Before 
    53     public void initRuleUnderTest() { 
    54         EnumSet<? extends UsabilityRule> ruleset = textInputUsabiliyRuleset().evaluationRules(); 
    55         this.ruleUnderTest = Iterables.find(ruleset, new Predicate<UsabilityRule>() { 
    56  
    57             public boolean apply(UsabilityRule usabilityRule) { 
    58                 return usabilityRule.ruleIdentifier().equals("TEXT_FIELD_INPUT_RATIO"); 
    59             } 
    60  
    61         }); 
    62     } 
    63  
    64     @After 
    65     public void clearFilterStatisticCache() { 
    66         FilterStatisticCache.instance().clear(); 
    67     } 
    68  
    6942    @Test 
    7043    public void should_return_no_recommendation() { 
     
    7649        ITaskTree taskTree = createTaskTree(spec); 
    7750        // When 
    78         Optional<UsabilityDefect> recommendation = 
    79             new TextInputRatioEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 
     51        Optional<UsabilityDefect> recommendation = new TextInputRatioMetric(taskTree).check(); 
    8052        // Then 
    8153        assertThat(recommendation).is(absent()); 
     
    9062        ITaskTree taskTree = createTaskTree(spec); 
    9163        // When 
    92         Optional<UsabilityDefect> recommendation = 
    93             new TextInputRatioEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 
     64        Optional<UsabilityDefect> recommendation = new TextInputRatioMetric(taskTree).check(); 
    9465        // Then 
    9566        assertThat(recommendation).is(present()).has(infoRecommendationSeverityLevel()); 
     
    10475        ITaskTree taskTree = createTaskTree(spec); 
    10576        // When 
    106         Optional<UsabilityDefect> recommendation = 
    107             new TextInputRatioEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 
     77        Optional<UsabilityDefect> recommendation = new TextInputRatioMetric(taskTree).check(); 
    10878        // Then 
    10979        assertThat(recommendation).is(present()).has(lowRecommendationSeverityLevel()); 
     
    11888        ITaskTree taskTree = createTaskTree(spec); 
    11989        // When 
    120         Optional<UsabilityDefect> recommendation = 
    121             new TextInputRatioEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 
     90        Optional<UsabilityDefect> recommendation = new TextInputRatioMetric(taskTree).check(); 
    12291        // Then 
    12392        assertThat(recommendation).is(present()).has(mediumRecommendationSeverityLevel()); 
     
    13099        ITaskTree taskTree = createTaskTree(spec); 
    131100        // When 
    132         Optional<UsabilityDefect> recommendation = 
    133             new TextInputRatioEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 
     101        Optional<UsabilityDefect> recommendation = new TextInputRatioMetric(taskTree).check(); 
    134102        // Then 
    135103        assertThat(recommendation).is(present()).has(highRecommendationSeverityLevel()); 
  • trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/testutil/FestConditionUtil.java

    r1040 r1141  
    1919import com.google.common.base.Optional; 
    2020 
    21 import de.ugoe.cs.autoquest.usability.UsabilityEvaluationReport; 
    22 import de.ugoe.cs.autoquest.usability.evaluation.result.UsabilityDefectSeverityLevel; 
    23 import de.ugoe.cs.autoquest.usability.evaluation.result.UsabilityDefect; 
    24 import de.ugoe.cs.autoquest.usability.evaluation.rule.set.UsabilityRuleset; 
     21import de.ugoe.cs.autoquest.usability.result.UsabilityDefect; 
     22import de.ugoe.cs.autoquest.usability.result.UsabilityDefectSeverityLevel; 
     23import de.ugoe.cs.autoquest.usability.rules.UsabilityResult; 
    2524 
    2625/** 
     
    3736    } 
    3837 
    39     public static Condition<UsabilityEvaluationReport> noUsabilityGuidlineRecommendations() { 
    40         return new Condition<UsabilityEvaluationReport>() { 
     38    public static Condition<UsabilityResult> noUsabilityGuidlineRecommendations() { 
     39        return new Condition<UsabilityResult>() { 
    4140 
    4241            @Override 
    43             public boolean matches(UsabilityEvaluationReport usabilityEvaluationReport) { 
    44                 return usabilityEvaluationReport.evaluationResults().isEmpty(); 
     42            public boolean matches(UsabilityResult usabilityResult) { 
     43                return !usabilityResult.hasDefects(); 
    4544            } 
    4645        }; 
    4746    } 
    4847 
    49     public static Condition<UsabilityEvaluationReport> usabilityGuidlineRecommendations() { 
    50         return new Condition<UsabilityEvaluationReport>() { 
     48    public static Condition<UsabilityResult> usabilityGuidlineRecommendations() { 
     49        return new Condition<UsabilityResult>() { 
    5150 
    5251            @Override 
    53             public boolean matches(UsabilityEvaluationReport usabilityEvaluationReport) { 
    54                 return !usabilityEvaluationReport.evaluationResults().isEmpty(); 
     52            public boolean matches(UsabilityResult usabilityResult) { 
     53                return usabilityResult.hasDefects(); 
    5554            } 
    56         }; 
    57     } 
    58  
    59     public static Condition<UsabilityRuleset> noUsabilityRules() { 
    60         return new Condition<UsabilityRuleset>() { 
    61  
    62             @Override 
    63             public boolean matches(UsabilityRuleset usabilityRuleset) { 
    64                 return usabilityRuleset.evaluationRules().isEmpty(); 
    65             } 
    66  
    67         }; 
    68     } 
    69  
    70     public static Condition<UsabilityRuleset> usabilityRules() { 
    71         return new Condition<UsabilityRuleset>() { 
    72  
    73             @Override 
    74             public boolean matches(UsabilityRuleset usabilityRuleset) { 
    75                 return !usabilityRuleset.evaluationRules().isEmpty(); 
    76             } 
    77  
    7855        }; 
    7956    } 
  • trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/testutil/GenerateTaskTreeUtil.java

    r1040 r1141  
    2424import de.ugoe.cs.autoquest.commands.usability.CMDgenerateTaskTree; 
    2525import de.ugoe.cs.autoquest.plugin.jfc.commands.CMDparseJFC; 
     26import de.ugoe.cs.autoquest.tasktrees.TaskTreeInstantiator; 
    2627import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTree; 
     28import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode; 
     29import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeBuilder; 
     30import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeNodeFactory; 
    2731import de.ugoe.cs.autoquest.test.CommandRunner; 
    28 import de.ugoe.cs.util.console.Console; 
    2932import de.ugoe.cs.util.console.GlobalDataContainer; 
    3033import de.ugoe.cs.util.console.TextConsole; 
     
    4245 
    4346    private static final String taskTreeName = "taskTree"; 
    44  
     47     
     48    public static ITaskTree getTaskTreeFromSpec(String spec) { 
     49        TaskTreeNodeFactory factory = new TaskTreeNodeFactory(); 
     50        ITaskTreeNode taskTree = new TaskTreeInstantiator(new TaskTreeNodeFactory(), new TaskTreeBuilder()).instantiateTaskTree(spec); 
     51        return factory.createTaskTree(taskTree); 
     52    } 
     53     
    4554    public static ITaskTree getTaskTreeFromFile(String filename) { 
    46         new TextConsole(Level.FINEST); 
     55        new TextConsole(Level.OFF); 
    4756        parseTraceFile(filename); 
    4857        condenseGuiModel(); 
     
    5564 
    5665    static private void parseTraceFile(String filetoparse) { 
    57         Console.println("parsing trace file"); 
    5866        CommandRunner.runCommand(CMDparseJFC.class, ClassLoader.getSystemResource(filetoparse) 
    5967            .getFile(), seqName); 
     
    6169 
    6270    private static void condenseGuiModel() { 
    63         Console.println("condensing GUI model"); 
    6471        CommandRunner.runCommand(CMDcondenseGuiModel.class, seqName); 
    6572    } 
    6673 
    6774    private static void sortKeyInteractions() { 
    68         Console.println("sorting key interactions"); 
    6975        CommandRunner.runCommand(CMDsortKeyInteractions.class, seqName); 
    7076    } 
    7177 
    7278    private static void correctKeyInteractionTargets() { 
    73         Console.println("correcting key interaction targets"); 
    7479        CommandRunner.runCommand(CMDcorrectKeyInteractionTargets.class, seqName); 
    7580    } 
    7681 
    7782    private static void detectTextInputEvents() { 
    78         Console.println("detecting text input events"); 
    7983        CommandRunner.runCommand(CMDdetectTextInputEvents.class, seqName); 
    8084    } 
    8185 
    8286    private static void condenseMouseClicks() { 
    83         Console.println("condensing mouse click events"); 
    8487        CommandRunner.runCommand(CMDcondenseMouseClicks.class, seqName); 
    8588    } 
Note: See TracChangeset for help on using the changeset viewer.