Skip to content

Commit

Permalink
One rerun prefix (#1519)
Browse files Browse the repository at this point in the history
Co-authored-by: Eqerem-Hena <t8210164@aueb.gr>
  • Loading branch information
fhoeben and Eqerem-Hena committed Jul 7, 2024
1 parent a3c0ce3 commit eab5fab
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
5 changes: 3 additions & 2 deletions FitNesseRoot/FitNesse/ReleaseNotes/content.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
!2 Pending Changes
* Allow usage of JDK > 18 ([[1513][https://github.com/unclebob/fitnesse/pull/1513]]).
* Added a new configuration to limit the total amount of test histories per page. ([[1510][https://github.com/unclebob/fitnesse/pull/1510]])
* Allow usage of JDK > 18 ([[1513][https://github.com/unclebob/fitnesse/pull/1513]]).
* Added a new configuration to limit the total amount of test histories per page. ([[1510][https://github.com/unclebob/fitnesse/pull/1510]])
* Do not add 'RerunLastFailures_' prefix on failure of re-run ([[1519][https://github.com/unclebob/fitnesse/pull/1519]])/

!2 20240219
* Added the defined values to the overview of all variables in scope. ([[1472][https://github.com/unclebob/fitnesse/pull/1472]])
Expand Down
7 changes: 6 additions & 1 deletion src/fitnesse/responders/run/SuiteResponder.java
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,12 @@ protected String getRerunPageName() {
PageCrawler pageCrawler = page.getPageCrawler();
WikiPagePath fullPath = pageCrawler.getFullPath();
String fullPathName = PathParser.render(fullPath);
return "RerunLastFailures_"+fullPathName.replace(".","-");
if (fullPathName.startsWith("RerunLastFailures_")) {
String newFullPathName = fullPathName.replace(".", "-");
return newFullPathName;
} else {
return "RerunLastFailures_" + fullPathName.replace(".", "-");
}
}

protected String getTitle() {
Expand Down
30 changes: 30 additions & 0 deletions test/fitnesse/responders/run/SuiteResponderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,36 @@ public void loadsCustomFormatters() throws Exception {
assertTrue(FooFormatter.initialized);
}

@Test
public void testGetRerunPageName_withRerunPrefix() throws Exception {
String rerunPageName = "RerunLastFailures_SuitePage";
suite = WikiPageUtil.addPage(root, PathParser.parse(rerunPageName), "This is a rerun page\n");
request.setResource(rerunPageName);
responder.makeResponse(context, request);

String result = responder.getRerunPageName();
assertEquals(rerunPageName, result);
}

@Test
public void testGetRerunPageName_ReplacesPeriod() throws Exception {
addTestToSuite("TestTwo", "|!-fitnesse.testutil.FailFixture-!|\n\n|!-fitnesse.testutil.FailFixture-!|\n");
request.setResource("SuitePage.TestTwo");
responder.makeResponse(context, request);

String result = responder.getRerunPageName();
assertEquals("RerunLastFailures_SuitePage-TestTwo", result);
}

@Test
public void testGetRerunPageName_withoutRerunPrefix() throws Exception {
request.setResource("SuitePage");
responder.makeResponse(context, request);

String result = responder.getRerunPageName();
assertEquals("RerunLastFailures_SuitePage", result);
}

private String runSuite() throws Exception {
Response response = responder.makeResponse(context, request);

Expand Down

0 comments on commit eab5fab

Please sign in to comment.