Skip to content

Commit

Permalink
Bug Fix: Order of test execution
Browse files Browse the repository at this point in the history
* The pages should be excuted in the below order
SuiteExecution.ExecutionLogOfSuitePage
SuiteExecution.SuiteExecutionCleansUpHistory
SuiteExecutionLog.ExecutionLogOfSuitePage
SuiteExecutionLog.ExecutionLogOfTestPage
* The order below would result without this commit
SuiteExecution.ExecutionLogOfSuitePage
SuiteExecutionLog.ExecutionLogOfSuitePage
SuiteExecutionLog.ExecutionLogOfTestPage
SuiteExecution.SuiteExecutionCleansUpHistory
  • Loading branch information
six42 committed Mar 31, 2015
1 parent 244ffa7 commit 937e0c2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/fitnesse/wiki/WikiPagePath.java
Expand Up @@ -136,8 +136,8 @@ public WikiPagePath relativePath() {
public int compareTo(Object o) {
if (o instanceof WikiPagePath) {
WikiPagePath p = (WikiPagePath) o;
String compressedName = StringUtils.join(names, "");
String compressedArgumentName = StringUtils.join(p.names, "");
String compressedName = StringUtils.join(names, ".");
String compressedArgumentName = StringUtils.join(p.names, ".");
return compressedName.compareTo(compressedArgumentName);
}
return 1; // we are greater because we are the right type.
Expand Down
24 changes: 24 additions & 0 deletions test/fitnesse/wiki/WikiPagePathTest.java
Expand Up @@ -156,6 +156,30 @@ public void testCompareTo() throws Exception {
assertTrue(bb.compareTo(ba) == 1); // bb > ba
}

@Test
public void testCompareToWithRealWorldNames() throws Exception {
//if a suite name is a substring of another suite name the order must still be correct
WikiPagePath a = PathParser.parse("SuiteExecution.ExecutionLogOfSuitePage");
WikiPagePath b = PathParser.parse("SuiteExecution.SuiteExecutionCleansUpHistory");
WikiPagePath c = PathParser.parse("SuiteExecutionLog.ExecutionLogOfSuitePage");

assertTrue(a.compareTo(b) < 0); // a < b
assertTrue(a.compareTo(c) < 0); // a < b
assertTrue(b.compareTo(c) < 0); // a < b
/*
* The join must add a separator (dot) between the path parts to sort names as the below correctly
SuiteExecution.ExecutionLogOfSuitePage
SuiteExecution.SuiteExecutionCleansUpHistory
SuiteExecutionLog.ExecutionLogOfSuitePage
SuiteExecutionLog.ExecutionLogOfTestPage
* The order below would result without the separator.
SuiteExecution.ExecutionLogOfSuitePage
SuiteExecutionLog.ExecutionLogOfSuitePage
SuiteExecutionLog.ExecutionLogOfTestPage
SuiteExecution.SuiteExecutionCleansUpHistory
*/
}

@Test
public void testMakeAbsolute() throws Exception {
WikiPagePath p = PathParser.parse("PathOne");
Expand Down

0 comments on commit 937e0c2

Please sign in to comment.