Skip to content

Commit 92c8381

Browse files
committed
Added logic to use the DisableTestHistory property for Suites
1 parent e7e4f23 commit 92c8381

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

FitNesseRoot/FitNesse/UserGuide/WritingAcceptanceTests/TestHistory/content.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The test result files are named using the following scheme !style_code(YYYYMMDDH
1111

1212
The test files contain the XML that describes the test run. The format of this XML is identical to the XML packet returned by the format=xml flag when you run a test. (See <UserGuide.RestfulTests).
1313

14-
You also have the possibility to disable !style_code(Test Histories) for a selected page by going to the !style_code(?properties) page and check the ''!-DisableTestHistory-!'' option.
14+
You also have the possibility to disable !style_code(Test Histories) for a selected page by going to the !style_code(?properties) page and check the ''!-DisableTestHistory-!'' option. Setting this property on a Suite, will disable the !style_code(Test Histories) for the whole Suite.
1515

1616
!4 Purging
1717
There are buttons at the top of the ''Test History'' page that allow you to purge old history files. You have your choice of ''all'', ''>7 days'', or ''>30 days''. If you want to purge a different number of days, you can use the RESTful URL form. (See [[!-RestfulServices-!][<UserGuide.AdministeringFitNesse.RestfulServices]]).

src/fitnesse/reporting/history/TestXmlFormatter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,7 @@ protected void setTotalRunTimeOnReport(TimeMeasurement totalTimeMeasurement) {
175175
}
176176

177177
protected void writeResults() throws IOException {
178-
if (!getPage().getData().getProperties()
179-
.has(WikiPageProperty.DISABLE_TESTHISTORY)) {
178+
if (!getPage().getData().hasAttribute(WikiPageProperty.DISABLE_TESTHISTORY)) {
180179
writeResults(writerFactory.getWriter(context, getPage(), getPageCounts(),
181180
totalTimeMeasurement.startedAt()));
182181
}

src/fitnesse/responders/run/SuiteResponder.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import fitnesse.wiki.WikiImportProperty;
4545
import fitnesse.wiki.WikiPage;
4646
import fitnesse.wiki.WikiPagePath;
47+
import fitnesse.wiki.WikiPageProperty;
4748
import fitnesse.wiki.WikiPageUtil;
4849
import org.apache.commons.lang3.StringUtils;
4950
import util.FileUtil;
@@ -262,7 +263,8 @@ protected void addFormatters(MultipleTestsRunner runner) {
262263
}
263264

264265
private boolean withSuiteHistoryFormatter() {
265-
return !request.hasInput("nohistory");
266+
return !request.hasInput("nohistory")
267+
&& !page.getData().hasAttribute(WikiPageProperty.DISABLE_TESTHISTORY);
266268
}
267269

268270
protected void addHistoryFormatter(MultipleTestsRunner runner) {

test/fitnesse/responders/run/SuiteResponderTest.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import fitnesse.wiki.PageData;
1919
import fitnesse.wiki.PathParser;
2020
import fitnesse.wiki.WikiPage;
21+
import fitnesse.wiki.WikiPageProperty;
2122
import fitnesse.wiki.WikiPageUtil;
2223
import org.junit.After;
2324
import org.junit.Before;
@@ -483,6 +484,25 @@ public void NoHistory_avoidsProducingSuiteResultFile() throws Exception {
483484
assertFalse(xmlResultsFile.exists());
484485
}
485486

487+
@Test
488+
public void DisableHistory_avoidsProducingSuiteResultFile() throws Exception {
489+
File xmlResultsFile = expectedXmlResultsFile();
490+
491+
if (xmlResultsFile.exists())
492+
xmlResultsFile.delete();
493+
494+
PageData data = suite.getData();
495+
data.setAttribute(WikiPageProperty.DISABLE_TESTHISTORY);
496+
suite.commit(data);
497+
suite.getData();
498+
responder.page = suite;
499+
500+
addTestToSuite("SlimTestOne", simpleSlimDecisionTable);
501+
addTestToSuite("SlimTestTwo", simpleSlimDecisionTable);
502+
runSuite();
503+
assertFalse(xmlResultsFile.exists());
504+
}
505+
486506
@Test
487507
public void Includehtml_producesHTMLResultsInXMLSuite() throws Exception {
488508
request.addInput("format", "xml");

0 commit comments

Comments
 (0)