Skip to content

Commit

Permalink
Log the correct fail/error message (#252)
Browse files Browse the repository at this point in the history
Since we no longer collect information/events on subsuites
the logic for logging messages about failures in sub suites
was not working properly. This resulted in incorrect error
message when a suite successfully executed but had test case
failures in it.
  • Loading branch information
fredjn authored Aug 30, 2024
1 parent a6b932f commit c1f5ed5
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions cli/src/etos_client/test_results/test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,14 @@ def __test_result(self, test_suites: list[TestSuite]) -> tuple[bool, str]:
"""Build test results based on events retrieved."""
if not self.__has_failed(test_suites):
return True, "Test suite finished successfully."

failures = 0
sub_suites = 0
for test_suite in test_suites:
failures += self.__count_sub_suite_failures(test_suite.sub_suites)
sub_suites += len(test_suite.sub_suites)
messages = self.__fail_messages(test_suites)
if len(messages) == 1:
return False, messages[0]
if messages:
for message in messages[:-1]:
self.logger.error(message)
return False, messages[-1]
if sub_suites == 0:
return False, "ETOS failed to start any test suites"
return False, f"{failures}/{sub_suites} test suites failed."
return False, f"Test case failures during test suite execution"

def get_results(self, events: Events) -> tuple[Optional[bool], Optional[str]]:
"""Get results from an ETOS testrun."""
Expand Down

0 comments on commit c1f5ed5

Please sign in to comment.