Skip to content

Commit

Permalink
config: table vertical separator and disable summary console report (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
MykolaGolubyev committed Apr 18, 2023
1 parent 5ddb569 commit 9ecb4b1
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ public class WebTauConfig implements PrettyPrintable {
"0 - no output; 1 - test names; 2 - first level steps; etc", () -> Integer.MAX_VALUE);
private final ConfigValue fullStackTrace = declare("fullStackTrace", "print full stack trace to console",
() -> false);
private final ConfigValue disableConsoleOverallReport = declare("disableConsoleOverallReport", "do not print failed tests, overall summary and path to the generated report at the end", () -> false);

private final ConfigValue tableVerticalSeparator = declare("tableVerticalSeparator", "string to use as a vertical separator when print TableData", () -> " \u2502 ");

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

public boolean isConsoleOverallReportDisabled() {
return disableConsoleOverallReport.getAsBoolean();
}

public String getTableVerticalSeparator() {
return tableVerticalSeparator.getAsString();
}

public void acceptConfigValues(String source, Map<String, ?> values) {
acceptConfigValues(source, Persona.DEFAULT_PERSONA_ID, values);
}
Expand Down Expand Up @@ -447,6 +458,8 @@ private Map<String, ConfigValue> enumerateRegisteredConfigValues() {
httpProxy,
verbosityLevel,
fullStackTrace,
disableConsoleOverallReport,
tableVerticalSeparator,
workingDir,
waitTick,
waitTimeout,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.testingisdocumenting.webtau.data.render;

import org.apache.commons.lang3.StringUtils;
import org.testingisdocumenting.webtau.cfg.WebTauConfig;
import org.testingisdocumenting.webtau.console.ansi.Color;
import org.testingisdocumenting.webtau.data.ValuePath;
import org.testingisdocumenting.webtau.data.table.Record;
Expand All @@ -30,7 +31,7 @@
public class TablePrettyPrinter {
private static final Color COLUMN_NAME_KEY_INDICATOR_COLOR = Color.YELLOW;
private static final Color COLUMN_NAME_COLOR = Color.PURPLE;
private static final String COLUMNS_DELIMITER = " │ ";
private static final String COLUMNS_DELIMITER = WebTauConfig.getCfg().getTableVerticalSeparator();

private final TableData tableData;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Add: `disableConsoleOverallReport` option to disable printing of overall test summary and report link
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Add: `tableVerticalSeparator` option to override what vertical separator to use when printing `TableData`
4 changes: 4 additions & 0 deletions webtau-docs/znai/release-notes/2023.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
title: 2023 Releases
---

# 1.52.1

:include-markdowns: 1.52.1

# 1.52

:include-markdowns: 1.52
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ public class ConsoleReportGenerator implements ReportGenerator {

@Override
public void generate(WebTauReport report) {
if (WebTauConfig.getCfg().isConsoleOverallReportDisabled()) {
return;
}

ConsoleOutputs.out();

printTestsWithStatus(report, TestStatus.Errored, NUMBER_OF_ERRORED_TESTS_TO_DISPLAY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ public void generate(WebTauReport report) {
Path reportPath = reportPath(report);

FileUtils.writeTextContent(reportPath, generateHtml(report));
ConsoleOutputs.out(Color.BLUE, "report is generated: ", Color.PURPLE, reportPath);

if (!getCfg().isConsoleOverallReportDisabled()) {
ConsoleOutputs.out(Color.BLUE, "report is generated: ", Color.PURPLE, reportPath);
}
}

private Path reportPath(WebTauReport report) {
Expand Down

0 comments on commit 9ecb4b1

Please sign in to comment.