Skip to content

Conversation

@carlos-granados
Copy link
Contributor

@carlos-granados carlos-granados commented Sep 19, 2025

When printing the summary of the run with any failed steps/scenarios, the pretty formatter prints a short summary which just lists the failed scenarios while the progress formatter prints a longer summary which lists all failed steps in detail. If you are running a long list of tests with the pretty formatter, you may want to see the longer summary so that you could see the details of the failure without having to scroll up a lot. Conversely, if you are running the progress formatter, in some environments (for example in CI) you may want to just see a smaller summary.

This PR adds a new short_summary formatter option which can be used to decide if you want to show the short summary (with just a list of scenarios) or the long summary (with a list of steps). It defaults to true for the pretty formatter and to false for the progress formatter so that by default they keep the current functionality

$scenarioStats = $statistics->getSkippedScenarios();
$this->listPrinter->printScenariosList($printer, 'skipped_scenarios_title', TestResult::SKIPPED, $scenarioStats);
$shortSummary = $formatter->getParameter('short_summary');
if ($shortSummary) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In both printers we print the list of scenarios or the list of steps depending on the new option

$value = ShowOutputOption::from($value);
$name = ShowOutputOption::PARAMETER_NAME;
}
if ($name === self::SHORT_SUMMARY_SETTING) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name of the option is short_summary but the name of the parameter is shortSummary so we need to convert it

],
], $profile->toArray());
}

Copy link
Contributor Author

@carlos-granados carlos-granados Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is not needed any longer because now we accept the InSummary option for the pretty formatter

bool $shortSummary = true,
...$baseOptions,
) {
if ($showOutput === ShowOutputOption::InSummary) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pretty formatter can now show step output in its summary if the short summary option is set to false, so now this option is valid for this formatter and we can remove this check

Copy link
Contributor

@acoulton acoulton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super helpful, thanks @carlos-granados - one tiny comment on the feature file.

@carlos-granados carlos-granados merged commit 53a3031 into Behat:master Sep 20, 2025
19 checks passed
@carlos-granados
Copy link
Contributor Author

Thanks @acoulton I will soon add documentation for this and also for the remove prefixes option that was merged recently

@carlos-granados carlos-granados deleted the add-short-summary-option branch September 26, 2025 03:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants