-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update xctest
test result parsing for Xcode 16
#431
Conversation
xctest
test result parsing for Xcode 16
@@ -30,13 +30,17 @@ def disabled(self) -> int: | |||
return sum(suite.disabled for suite in self.test_suites if suite.disabled) | |||
|
|||
@property | |||
def errors(self) -> int: | |||
def errors(self) -> Optional[int]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate why we should introduce Optional[int]
here, instead just return 0
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Errors and failures in JUnit XML format are optional. By having optional integer value for those here we can more closely represent the reality. Xcode 16+ does not tell anything about failed
test cases, there are only errored
tests. So the corresponding JUnit XML test suite should not include failures
at all for such cases. But if we'd always return 0
then it is not possible to differentiate the cases where test suite does not specify this value from those where it is defined but legitemately 0
.
Ultimately it is to omit undefined failures or errors from the test result overview tables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I just suggest to add a comment on CHANGELOG about statistics treatment as new Xcode versions does not use "failure" status for tests.
Changelog was updated in e0fd0ef to reflect modifications of JUnit |
This PR is a follow up to issue #423 and its fix in #424.
Xcode 16.0 introduced changes to
xcresulttool
API which deprecatedxcresult
parsing options that were previously working:was replaced with
where subcommand is any of
summary
,tests
,test-details
,activities
,insights
.Along with the CLI change, the output format was also significantly altered.
This PR adds Python mappings for
xcresulttool get test-results
outputs and uses those to generate JUnit test suites. In most cases the conversion results are identical to what it used to be with legacy options, but for some time already Xcode does not differentiate test cases that errored from those for which some assertions failed. While the legacy implementation kept track of failed results separately, this is not possible with newxcresulttool
output and now all test cases that failed due to whatever reasons are counted aserrored
.Examples of
xcresulttool get test-result
JSON outputs can be seen under mocks intests/models/xctests/mocks
directory.Conversion from
xcresult
to JUnit compatible test suite is still done inXcResultConverter
class whose API remained fully backwards compatible. Now when selected Xcode version is 16+ then new conversion implementation is used, and the legacy one otherwise.Models JSON schemas
xcrun xcresulttool get test-results tests
outputxcrun xcresulttool get test-results summary
outputQA notes:
Tested with the following Xcode versions:
Updated actions:
xcode-project run-tests
xcode-project test-summary
xcode-project junit-test-results