Skip to content

Commit 9ecb4b1

Browse files
config: table vertical separator and disable summary console report (#1449)
1 parent 5ddb569 commit 9ecb4b1

File tree

7 files changed

+29
-2
lines changed

7 files changed

+29
-2
lines changed

webtau-core/src/main/java/org/testingisdocumenting/webtau/cfg/WebTauConfig.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ public class WebTauConfig implements PrettyPrintable {
5555
"0 - no output; 1 - test names; 2 - first level steps; etc", () -> Integer.MAX_VALUE);
5656
private final ConfigValue fullStackTrace = declare("fullStackTrace", "print full stack trace to console",
5757
() -> false);
58+
private final ConfigValue disableConsoleOverallReport = declare("disableConsoleOverallReport", "do not print failed tests, overall summary and path to the generated report at the end", () -> false);
59+
60+
private final ConfigValue tableVerticalSeparator = declare("tableVerticalSeparator", "string to use as a vertical separator when print TableData", () -> " \u2502 ");
5861

5962
private final ConfigValue consolePayloadOutputLimit = declare("consolePayloadOutputLimit",
6063
"max number of lines to display in console for outputs (e.g. http response)", () -> 500);
@@ -164,6 +167,14 @@ public int getConsolePayloadOutputLimit() {
164167
return consolePayloadOutputLimit.getAsInt();
165168
}
166169

170+
public boolean isConsoleOverallReportDisabled() {
171+
return disableConsoleOverallReport.getAsBoolean();
172+
}
173+
174+
public String getTableVerticalSeparator() {
175+
return tableVerticalSeparator.getAsString();
176+
}
177+
167178
public void acceptConfigValues(String source, Map<String, ?> values) {
168179
acceptConfigValues(source, Persona.DEFAULT_PERSONA_ID, values);
169180
}
@@ -447,6 +458,8 @@ private Map<String, ConfigValue> enumerateRegisteredConfigValues() {
447458
httpProxy,
448459
verbosityLevel,
449460
fullStackTrace,
461+
disableConsoleOverallReport,
462+
tableVerticalSeparator,
450463
workingDir,
451464
waitTick,
452465
waitTimeout,

webtau-core/src/main/java/org/testingisdocumenting/webtau/data/render/TablePrettyPrinter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.testingisdocumenting.webtau.data.render;
1818

1919
import org.apache.commons.lang3.StringUtils;
20+
import org.testingisdocumenting.webtau.cfg.WebTauConfig;
2021
import org.testingisdocumenting.webtau.console.ansi.Color;
2122
import org.testingisdocumenting.webtau.data.ValuePath;
2223
import org.testingisdocumenting.webtau.data.table.Record;
@@ -30,7 +31,7 @@
3031
public class TablePrettyPrinter {
3132
private static final Color COLUMN_NAME_KEY_INDICATOR_COLOR = Color.YELLOW;
3233
private static final Color COLUMN_NAME_COLOR = Color.PURPLE;
33-
private static final String COLUMNS_DELIMITER = " │ ";
34+
private static final String COLUMNS_DELIMITER = WebTauConfig.getCfg().getTableVerticalSeparator();
3435

3536
private final TableData tableData;
3637

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* Add: `disableConsoleOverallReport` option to disable printing of overall test summary and report link
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* Add: `tableVerticalSeparator` option to override what vertical separator to use when printing `TableData`

webtau-docs/znai/release-notes/2023.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
title: 2023 Releases
33
---
44

5+
# 1.52.1
6+
7+
:include-markdowns: 1.52.1
8+
59
# 1.52
610

711
:include-markdowns: 1.52

webtau-report/src/main/java/org/testingisdocumenting/webtau/report/ConsoleReportGenerator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ public class ConsoleReportGenerator implements ReportGenerator {
4141

4242
@Override
4343
public void generate(WebTauReport report) {
44+
if (WebTauConfig.getCfg().isConsoleOverallReportDisabled()) {
45+
return;
46+
}
47+
4448
ConsoleOutputs.out();
4549

4650
printTestsWithStatus(report, TestStatus.Errored, NUMBER_OF_ERRORED_TESTS_TO_DISPLAY);

webtau-report/src/main/java/org/testingisdocumenting/webtau/report/HtmlReportGenerator.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ public void generate(WebTauReport report) {
4949
Path reportPath = reportPath(report);
5050

5151
FileUtils.writeTextContent(reportPath, generateHtml(report));
52-
ConsoleOutputs.out(Color.BLUE, "report is generated: ", Color.PURPLE, reportPath);
52+
53+
if (!getCfg().isConsoleOverallReportDisabled()) {
54+
ConsoleOutputs.out(Color.BLUE, "report is generated: ", Color.PURPLE, reportPath);
55+
}
5356
}
5457

5558
private Path reportPath(WebTauReport report) {

0 commit comments

Comments
 (0)