This step uses xcodebuild & xcpretty to run the macOS tests for the Swift Package Manager. The final files are output in a structure compatible with the "Test Report" plugin and can be configured to be JUnit or HTML as output, so the generated files are compatible with tools like Danger.
The Code coverage is always exported as a JSON file.
- git::https://github.com/igorcferreira/bitrise-step-run-spm-test-with-coverage.git@main:
title: Run Swift Package Manager Tests
inputs:
- TEST_NAME: BitriseTest
- PROJECT_DIR: $BITRISE_SOURCE_DIR
- SKIP_BUILD: 'NO'
- REPORTER: junit
This step will run the package tests and expose the test result and code coverage on:
- TEST_RESULT: XML file with the result of the tests
- CODE_COVERAGE_RESULT: JSON file with the result of the code coverage report
By default, the tests will run on macOS, but a different sdk can be selected by changing the SDK
and DESTINATION
inputs. Example:
- git::https://github.com/igorcferreira/bitrise-step-run-spm-test-with-coverage.git@main:
title: Run Swift Package Manager Tests
inputs:
- TEST_NAME: BitriseTest
- PROJECT_DIR: $BITRISE_SOURCE_DIR
- SKIP_BUILD: 'NO'
- REPORTER: junit
- SDK: 'iphonesimulator'
- DESTINATION: 'platform=iOS Simulator,name=iPhone 8 Plus'