Skip to content
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

Xcode Test Results as Bitrise environment variables #245

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

markst
Copy link

@markst markst commented May 15, 2024

Checklist

  • I've read and followed the Contribution Guidelines
  • step.yml and README.md are updated with the changes (if needed)
  • Updated bitrise.yml with necessary environment variables

Version

Context

This PR adds functionality to parse .xcresult files and set the number of tests passed and failed as environment variables (BITRISE_XCODE_TESTS_PASSED_COUNT and BITRISE_XCODE_TESTS_FAILED_COUNT).

Resolves: https://discuss.bitrise.io/t/surface-xcode-test-results-as-bitrise-output-variable/1630

Changes

  • Added structs TestSummary and TestResults to main.go for parsing .xcresult JSON output.
  • Added ExportTestResults method in main.go to parse the .xcresult file and set the environment variables for the number of tests passed and failed.
  • Updated ExportXCResultBundle method to call ExportTestResults.

Investigation details

Alternative solutions involved parsing the .xcresult files using different tools, but xcresulttool was chosen for its reliability and ease of use with Xcode-generated files.

Decisions

  • Decided to use xcresulttool for parsing .xcresult files.
  • Chose to add environment variables BITRISE_XCODE_TESTS_PASSED_COUNT and BITRISE_XCODE_TESTS_FAILED_COUNT to provide clear metrics on test results.

@markst markst marked this pull request as draft May 15, 2024 03:36
@markst
Copy link
Author

markst commented May 15, 2024

Will need to add tests to validate this, I wonder if we have an .xcresult file on the repo can validate against?

@markst
Copy link
Author

markst commented May 15, 2024

@markst markst changed the title Add ExportTestResults function to output number of tests passed or … Xcode Test Results as Bitrise Output Variable May 15, 2024
@markst markst changed the title Xcode Test Results as Bitrise Output Variable Xcode Test Results as Bitrise environment variables May 15, 2024
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.

1 participant