Skip to content

Commit

Permalink
Use error for test cases instead of failure
Browse files Browse the repository at this point in the history
  • Loading branch information
priitlatt committed Oct 15, 2024
1 parent a81273f commit cfc033a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/codemagic/models/xctests/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,15 @@ def _get_test_suite_name(cls, xc_test_suite: XcTestSuite) -> str:
return name or device_info

@classmethod
def _get_test_case_failure(cls, xc_test_case: XcTestCase) -> Optional[Failure]:
def _get_test_case_error(cls, xc_test_case: XcTestCase) -> Optional[Error]:
if not xc_test_case.is_failed():
return None

messages = xc_test_case.get_failure_messages()
return Failure(
return Error(
message=messages[0] if messages else "",
type="Error" if any("caught error" in m for m in messages) else "Failure",
failure_description="\n".join(messages) if len(messages) > 1 else None,
error_description="\n".join(messages) if len(messages) > 1 else None,
)

@classmethod
Expand All @@ -235,7 +235,7 @@ def _get_test_case(cls, xc_test_case: XcTestCase) -> TestCase:
return TestCase(
name=xc_test_case.get_method_name(),
classname=xc_test_case.get_classname(),
failure=cls._get_test_case_failure(xc_test_case),
error=cls._get_test_case_error(xc_test_case),
time=xc_test_case.get_duration(),
status=xc_test_case.result,
skipped=cls._get_test_case_skipped(xc_test_case),
Expand Down

0 comments on commit cfc033a

Please sign in to comment.