mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Show list of failed tests in the summary // Resolve #4251
This commit is contained in:
@ -48,6 +48,11 @@ class StdoutTestReport(TestReportBase):
|
||||
)
|
||||
|
||||
if tabular_data:
|
||||
util.print_labeled_bar(
|
||||
"SUMMARY",
|
||||
is_error=is_error,
|
||||
fg="red" if is_error else "green",
|
||||
)
|
||||
click.echo(
|
||||
tabulate(
|
||||
tabular_data,
|
||||
@ -59,6 +64,9 @@ class StdoutTestReport(TestReportBase):
|
||||
err=is_error,
|
||||
)
|
||||
|
||||
if failed_nums:
|
||||
self.print_failed_test_cases()
|
||||
|
||||
util.print_labeled_bar(
|
||||
"%d test cases: %s%s%d succeeded in %s"
|
||||
% (
|
||||
@ -71,3 +79,21 @@ class StdoutTestReport(TestReportBase):
|
||||
is_error=is_error,
|
||||
fg="red" if is_error else "green",
|
||||
)
|
||||
|
||||
def print_failed_test_cases(self):
|
||||
click.echo()
|
||||
for test_suite in self.test_result.suites:
|
||||
if test_suite.status != TestStatus.FAILED:
|
||||
continue
|
||||
util.print_labeled_bar(
|
||||
click.style(
|
||||
f"{test_suite.env_name}:{test_suite.test_name}", bold=True, fg="red"
|
||||
),
|
||||
is_error=True,
|
||||
sep="_",
|
||||
)
|
||||
for test_case in test_suite.cases:
|
||||
if test_case.status != TestStatus.FAILED:
|
||||
continue
|
||||
click.echo(test_case.stdout)
|
||||
click.echo()
|
||||
|
@ -45,7 +45,7 @@ def test_calculator_example(tmp_path: Path):
|
||||
|
||||
# test JUnit output
|
||||
junit_testsuites = ET.parse(junit_output_path).getroot()
|
||||
assert int(junit_testsuites.get("tests")) == 11
|
||||
assert int(junit_testsuites.get("tests")) == 10
|
||||
assert int(junit_testsuites.get("errors")) == 2
|
||||
assert int(junit_testsuites.get("failures")) == 1
|
||||
assert len(junit_testsuites.findall("testsuite")) == 6
|
||||
|
Reference in New Issue
Block a user