Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One rerun prefix #1519

Merged
merged 5 commits into from
Jul 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading