Changeset 1141 for trunk/autoquest-core-usability-evaluation-test
- Timestamp:
- 03/27/13 15:01:00 (12 years ago)
- 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 13 13 // limitations under the License. 14 14 15 package de.ugoe.cs.autoquest.usability. evaluation.rule.evaluator;15 package de.ugoe.cs.autoquest.usability.rules.metrics; 16 16 17 17 import 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 13 13 // limitations under the License. 14 14 15 package de.ugoe.cs.autoquest.usability. evaluation.rule.evaluator;15 package de.ugoe.cs.autoquest.usability.rules.metrics; 16 16 17 import static de.ugoe.cs.autoquest.usability.evaluation.rule.set.RulesetFactory.textInputUsabiliyRuleset;18 17 import static de.ugoe.cs.autoquest.usability.testutil.FestConditionUtil.absent; 19 18 import static de.ugoe.cs.autoquest.usability.testutil.FestConditionUtil.highRecommendationSeverityLevel; … … 24 23 import static org.fest.assertions.api.Assertions.assertThat; 25 24 26 import java.util.EnumSet;27 28 import org.junit.After;29 import org.junit.Before;30 25 import org.junit.Test; 31 26 32 27 import com.google.common.base.Optional; 33 import com.google.common.base.Predicate;34 import com.google.common.collect.Iterables;35 28 36 29 import 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; 30 import de.ugoe.cs.autoquest.usability.result.UsabilityDefect; 31 import de.ugoe.cs.autoquest.usability.rules.metrics.NoLetterOrDigitRatioMetric; 40 32 41 33 /** … … 48 40 public class NoLetterOrDigitTextInputsEvaluatorTest extends AbstractUsabilityEvaluationTC { 49 41 50 private UsabilityRule ruleUnderTest;51 52 @Before53 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 @After65 public void clearFilterStatisticCache() {66 FilterStatisticCache.instance().clear();67 }68 69 42 @Test 70 43 public void should_return_no_recommendation() { 71 44 // Given 72 String spec = "Sequence {" + " TextInput () {}" + "}"; 45 String spec = "Sequence {" + 46 " TextInput () {}" + 47 "}"; 73 48 ITaskTree taskTree = createTaskTree(spec); 74 49 // When 75 Optional<UsabilityDefect> recommendation = 76 new NoLetterOrDigitTextInputsEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 50 Optional<UsabilityDefect> recommendation = new NoLetterOrDigitRatioMetric(taskTree).check(); 77 51 // Then 78 52 assertThat(recommendation).is(absent()); … … 83 57 // Given 84 58 String spec = 85 "Sequence {" 86 + " TextInput (1234567890123456789012345678901234567890123456789_01234567890" 87 + "12345678901234567890123456789012345) {}" + "}"; 59 "Sequence {" + 60 " TextInput (1234567890123456789012345678901234567890123456789_01234567890" + 61 "12345678901234567890123456789012345) {}" + 62 "}"; 88 63 ITaskTree taskTree = createTaskTree(spec); 89 64 // When 90 Optional<UsabilityDefect> recommendation = 91 new NoLetterOrDigitTextInputsEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 65 Optional<UsabilityDefect> recommendation = new NoLetterOrDigitRatioMetric(taskTree).check(); 92 66 // Then 93 67 assertThat(recommendation).is(present()).has(infoRecommendationSeverityLevel()); … … 98 72 // Given 99 73 String spec = 100 "Sequence {" + " TextInput (123456789012345678901234567890_123456789012345) {}" + "}"; 74 "Sequence {" + 75 " TextInput (123456789012345678901234567890_123456789012345) {}" + 76 "}"; 101 77 ITaskTree taskTree = createTaskTree(spec); 102 78 // When 103 Optional<UsabilityDefect> recommendation = 104 new NoLetterOrDigitTextInputsEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 79 Optional<UsabilityDefect> recommendation = new NoLetterOrDigitRatioMetric(taskTree).check(); 105 80 // Then 106 81 assertThat(recommendation).is(present()).has(lowRecommendationSeverityLevel()); … … 110 85 public void should_return_recommendation_with_medium_severity_level() { 111 86 // Given 112 String spec = "Sequence {" + " TextInput (12345_6789012345) {}" + "}"; 87 String spec = "Sequence {" + 88 " TextInput (12345_6789012345) {}" + 89 "}"; 113 90 ITaskTree taskTree = createTaskTree(spec); 114 91 // When 115 Optional<UsabilityDefect> recommendation = 116 new NoLetterOrDigitTextInputsEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 92 Optional<UsabilityDefect> recommendation = new NoLetterOrDigitRatioMetric(taskTree).check(); 117 93 // Then 118 94 assertThat(recommendation).is(present()).has(mediumRecommendationSeverityLevel()); … … 122 98 public void should_return_recommendation_with_high_severity_level() { 123 99 // Given 124 String spec = "Sequence {" + " TextInput (_a_b_c_) {}" + "}"; 100 String spec = "Sequence {" + 101 " TextInput (_a_b_c_) {}" + 102 "}"; 125 103 ITaskTree taskTree = createTaskTree(spec); 126 104 // When 127 Optional<UsabilityDefect> recommendation = 128 new NoLetterOrDigitTextInputsEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 105 Optional<UsabilityDefect> recommendation = new NoLetterOrDigitRatioMetric(taskTree).check(); 129 106 // Then 130 107 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 13 13 // limitations under the License. 14 14 15 package de.ugoe.cs.autoquest.usability. evaluation.rule.evaluator;15 package de.ugoe.cs.autoquest.usability.rules.metrics; 16 16 17 import static de.ugoe.cs.autoquest.usability.evaluation.rule.set.RulesetFactory.textInputUsabiliyRuleset;18 17 import static de.ugoe.cs.autoquest.usability.testutil.FestConditionUtil.absent; 19 18 import static de.ugoe.cs.autoquest.usability.testutil.FestConditionUtil.highRecommendationSeverityLevel; … … 24 23 import static org.fest.assertions.api.Assertions.assertThat; 25 24 26 import java.util.EnumSet;27 28 import org.junit.After;29 import org.junit.Before;30 25 import org.junit.Test; 31 26 32 27 import com.google.common.base.Optional; 33 import com.google.common.base.Predicate;34 import com.google.common.collect.Iterables;35 28 36 29 import 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; 30 import de.ugoe.cs.autoquest.usability.result.UsabilityDefect; 31 import de.ugoe.cs.autoquest.usability.rules.metrics.TextInputEntryRepetitionsMetric; 40 32 41 33 /** … … 48 40 public class TextInputEntryRepetitionsEvaluatorTest extends AbstractUsabilityEvaluationTC { 49 41 50 private UsabilityRule ruleUnderTest;51 52 @Before53 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 @After65 public void clearFilterStatisticCache() {66 FilterStatisticCache.instance().clear();67 }68 69 42 @Test 70 43 public void should_return_no_recommendation() { … … 73 46 ITaskTree taskTree = createTaskTree(spec); 74 47 // When 75 Optional<UsabilityDefect> recommendation = 76 new TextInputEntryRepetitionsEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 48 Optional<UsabilityDefect> recommendation = new TextInputEntryRepetitionsMetric(taskTree).check(); 77 49 // Then 78 50 assertThat(recommendation).is(absent()); … … 87 59 ITaskTree taskTree = createTaskTree(spec); 88 60 // When 89 Optional<UsabilityDefect> recommendation = 90 new TextInputEntryRepetitionsEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 61 Optional<UsabilityDefect> recommendation = new TextInputEntryRepetitionsMetric(taskTree).check(); 91 62 // Then 92 63 assertThat(recommendation).is(present()).has(infoRecommendationSeverityLevel()); … … 101 72 ITaskTree taskTree = createTaskTree(spec); 102 73 // When 103 Optional<UsabilityDefect> recommendation = 104 new TextInputEntryRepetitionsEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 74 Optional<UsabilityDefect> recommendation = new TextInputEntryRepetitionsMetric(taskTree).check(); 105 75 // Then 106 76 assertThat(recommendation).is(present()).has(lowRecommendationSeverityLevel()); … … 121 91 ITaskTree taskTree = createTaskTree(spec); 122 92 // When 123 Optional<UsabilityDefect> recommendation = 124 new TextInputEntryRepetitionsEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 93 Optional<UsabilityDefect> recommendation = new TextInputEntryRepetitionsMetric(taskTree).check(); 125 94 // Then 126 95 assertThat(recommendation).is(present()).has(mediumRecommendationSeverityLevel()); … … 141 110 ITaskTree taskTree = createTaskTree(spec); 142 111 // When 143 Optional<UsabilityDefect> recommendation = 144 new TextInputEntryRepetitionsEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 112 Optional<UsabilityDefect> recommendation = new TextInputEntryRepetitionsMetric(taskTree).check(); 145 113 // Then 146 114 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 13 13 // limitations under the License. 14 14 15 package de.ugoe.cs.autoquest.usability. evaluation.rule.evaluator;15 package de.ugoe.cs.autoquest.usability.rules.metrics; 16 16 17 import static de.ugoe.cs.autoquest.usability.evaluation.rule.set.RulesetFactory.textInputUsabiliyRuleset;18 17 import static de.ugoe.cs.autoquest.usability.testutil.FestConditionUtil.absent; 19 18 import static de.ugoe.cs.autoquest.usability.testutil.FestConditionUtil.highRecommendationSeverityLevel; … … 24 23 import static org.fest.assertions.api.Assertions.assertThat; 25 24 26 import java.util.EnumSet;27 28 import org.junit.After;29 import org.junit.Before;30 25 import org.junit.Test; 31 26 32 27 import com.google.common.base.Optional; 33 import com.google.common.base.Predicate;34 import com.google.common.collect.Iterables;35 28 36 29 import 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; 30 import de.ugoe.cs.autoquest.usability.result.UsabilityDefect; 31 import de.ugoe.cs.autoquest.usability.rules.metrics.TextInputRatioMetric; 40 32 41 33 /** … … 48 40 public class TextInputRatioEvaluatorTest extends AbstractUsabilityEvaluationTC { 49 41 50 private UsabilityRule ruleUnderTest;51 52 @Before53 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 @After65 public void clearFilterStatisticCache() {66 FilterStatisticCache.instance().clear();67 }68 69 42 @Test 70 43 public void should_return_no_recommendation() { … … 76 49 ITaskTree taskTree = createTaskTree(spec); 77 50 // When 78 Optional<UsabilityDefect> recommendation = 79 new TextInputRatioEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 51 Optional<UsabilityDefect> recommendation = new TextInputRatioMetric(taskTree).check(); 80 52 // Then 81 53 assertThat(recommendation).is(absent()); … … 90 62 ITaskTree taskTree = createTaskTree(spec); 91 63 // When 92 Optional<UsabilityDefect> recommendation = 93 new TextInputRatioEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 64 Optional<UsabilityDefect> recommendation = new TextInputRatioMetric(taskTree).check(); 94 65 // Then 95 66 assertThat(recommendation).is(present()).has(infoRecommendationSeverityLevel()); … … 104 75 ITaskTree taskTree = createTaskTree(spec); 105 76 // When 106 Optional<UsabilityDefect> recommendation = 107 new TextInputRatioEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 77 Optional<UsabilityDefect> recommendation = new TextInputRatioMetric(taskTree).check(); 108 78 // Then 109 79 assertThat(recommendation).is(present()).has(lowRecommendationSeverityLevel()); … … 118 88 ITaskTree taskTree = createTaskTree(spec); 119 89 // When 120 Optional<UsabilityDefect> recommendation = 121 new TextInputRatioEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 90 Optional<UsabilityDefect> recommendation = new TextInputRatioMetric(taskTree).check(); 122 91 // Then 123 92 assertThat(recommendation).is(present()).has(mediumRecommendationSeverityLevel()); … … 130 99 ITaskTree taskTree = createTaskTree(spec); 131 100 // When 132 Optional<UsabilityDefect> recommendation = 133 new TextInputRatioEvaluator(this.ruleUnderTest, taskTree).evaluationResult(); 101 Optional<UsabilityDefect> recommendation = new TextInputRatioMetric(taskTree).check(); 134 102 // Then 135 103 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 19 19 import com.google.common.base.Optional; 20 20 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; 21 import de.ugoe.cs.autoquest.usability.result.UsabilityDefect; 22 import de.ugoe.cs.autoquest.usability.result.UsabilityDefectSeverityLevel; 23 import de.ugoe.cs.autoquest.usability.rules.UsabilityResult; 25 24 26 25 /** … … 37 36 } 38 37 39 public static Condition<Usability EvaluationReport> noUsabilityGuidlineRecommendations() {40 return new Condition<Usability EvaluationReport>() {38 public static Condition<UsabilityResult> noUsabilityGuidlineRecommendations() { 39 return new Condition<UsabilityResult>() { 41 40 42 41 @Override 43 public boolean matches(Usability EvaluationReport usabilityEvaluationReport) {44 return usabilityEvaluationReport.evaluationResults().isEmpty();42 public boolean matches(UsabilityResult usabilityResult) { 43 return !usabilityResult.hasDefects(); 45 44 } 46 45 }; 47 46 } 48 47 49 public static Condition<Usability EvaluationReport> usabilityGuidlineRecommendations() {50 return new Condition<Usability EvaluationReport>() {48 public static Condition<UsabilityResult> usabilityGuidlineRecommendations() { 49 return new Condition<UsabilityResult>() { 51 50 52 51 @Override 53 public boolean matches(Usability EvaluationReport usabilityEvaluationReport) {54 return !usabilityEvaluationReport.evaluationResults().isEmpty();52 public boolean matches(UsabilityResult usabilityResult) { 53 return usabilityResult.hasDefects(); 55 54 } 56 };57 }58 59 public static Condition<UsabilityRuleset> noUsabilityRules() {60 return new Condition<UsabilityRuleset>() {61 62 @Override63 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 @Override74 public boolean matches(UsabilityRuleset usabilityRuleset) {75 return !usabilityRuleset.evaluationRules().isEmpty();76 }77 78 55 }; 79 56 } -
trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/testutil/GenerateTaskTreeUtil.java
r1040 r1141 24 24 import de.ugoe.cs.autoquest.commands.usability.CMDgenerateTaskTree; 25 25 import de.ugoe.cs.autoquest.plugin.jfc.commands.CMDparseJFC; 26 import de.ugoe.cs.autoquest.tasktrees.TaskTreeInstantiator; 26 27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTree; 28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode; 29 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeBuilder; 30 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeNodeFactory; 27 31 import de.ugoe.cs.autoquest.test.CommandRunner; 28 import de.ugoe.cs.util.console.Console;29 32 import de.ugoe.cs.util.console.GlobalDataContainer; 30 33 import de.ugoe.cs.util.console.TextConsole; … … 42 45 43 46 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 45 54 public static ITaskTree getTaskTreeFromFile(String filename) { 46 new TextConsole(Level. FINEST);55 new TextConsole(Level.OFF); 47 56 parseTraceFile(filename); 48 57 condenseGuiModel(); … … 55 64 56 65 static private void parseTraceFile(String filetoparse) { 57 Console.println("parsing trace file");58 66 CommandRunner.runCommand(CMDparseJFC.class, ClassLoader.getSystemResource(filetoparse) 59 67 .getFile(), seqName); … … 61 69 62 70 private static void condenseGuiModel() { 63 Console.println("condensing GUI model");64 71 CommandRunner.runCommand(CMDcondenseGuiModel.class, seqName); 65 72 } 66 73 67 74 private static void sortKeyInteractions() { 68 Console.println("sorting key interactions");69 75 CommandRunner.runCommand(CMDsortKeyInteractions.class, seqName); 70 76 } 71 77 72 78 private static void correctKeyInteractionTargets() { 73 Console.println("correcting key interaction targets");74 79 CommandRunner.runCommand(CMDcorrectKeyInteractionTargets.class, seqName); 75 80 } 76 81 77 82 private static void detectTextInputEvents() { 78 Console.println("detecting text input events");79 83 CommandRunner.runCommand(CMDdetectTextInputEvents.class, seqName); 80 84 } 81 85 82 86 private static void condenseMouseClicks() { 83 Console.println("condensing mouse click events");84 87 CommandRunner.runCommand(CMDcondenseMouseClicks.class, seqName); 85 88 }
Note: See TracChangeset
for help on using the changeset viewer.