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

[scan] Add testPlan option to scan #16043

Merged
merged 3 commits into from Mar 23, 2020
Merged

Conversation

esteluk
Copy link
Contributor

@esteluk esteluk commented Feb 18, 2020

Adds a configuration option that specifies a testplan to execute Scan
with. As with test parallelisation, using this can cause a few problems
with other integrations (such as xcpretty's ability to parse the test
output). This change isn't intended as a holistic change to address
incompatible combinations of options when using the new test report
formats, just a simple option to pass in a command line option.

Checklist

  • I've run bundle exec rspec from the root directory to see all new and existing tests pass
  • I've followed the fastlane code style and run bundle exec rubocop -a to ensure the code style is valid
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary.

Motivation and Context

Xcode 11 introduced testplans as a new way to specify groups of tests that can be run together independently of the project's schemes. eg. I can specify separate test plans for my pre-merge pipeline and nightly builds.

Per #15462 there's clearly some desire for Fastlane to support test plans properly. At the moment the any use of them with scan requires passing a custom xcarg configuration.

Description

This change just adds a simple Scan configuration option that gets passed into xcodebuild as a command line option.

closes #15462

Adds a configuration option that specifies a testplan to execute Scan
with. As with test parallelisation, using this can cause a few problems
with other integrations (such as xcpretty's ability to parse the test
output). This change isn't intended as a holistic change to address
incompatible combinations of options when using the new test report
formats, just a simple option to pass in a command line option.
scan/lib/scan/options.rb Outdated Show resolved Hide resolved
@iainsmith
Copy link

CI size-label looks like it's failing due to a missing GITHUB_TOKEN.

@janpio
Copy link
Member

janpio commented Mar 6, 2020

@iainsmith It's failing because it can't handle forks - we will remove that action again soon. For now here this can be ignored.

@@ -45,6 +45,7 @@ def options # rubocop:disable Metrics/PerceivedComplexity
options << "-enableCodeCoverage #{config[:code_coverage] ? 'YES' : 'NO'}" unless config[:code_coverage].nil?
options << "-enableAddressSanitizer #{config[:address_sanitizer] ? 'YES' : 'NO'}" unless config[:address_sanitizer].nil?
options << "-enableThreadSanitizer #{config[:thread_sanitizer] ? 'YES' : 'NO'}" unless config[:thread_sanitizer].nil?
options << "-testPlan #{config[:testplan]}" if config[:testplan]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work with Xcode 10, or we don't care about older versions?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, this should be wrapped in the if FastlaneCore::Helper.xcode_at_least?(11) block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense!

@spadafiva
Copy link

Hey all, maybe this isn't the right place to ask, but is there a potential timeline on when this action might. be available in fastlane? Our team would really love to use test plans instead of rolling our own solution for creating the test plans with ruby scripts.

@iainsmith
Copy link

iainsmith commented Mar 12, 2020

Our team would really love to use test plans instead of rolling our own solution for creating the test plans with ruby scripts.

@spadafiva you can use xcargs: "-testPlan plan-name" today

@spadafiva
Copy link

@iainsmith Thanks! I appreciate the help.

@iainsmith
Copy link

cc @joshdholtz is anything else needed to merge this?

Copy link
Member

@joshdholtz joshdholtz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad! I totally thought I approved and merged this one already 😔 Sorry about that! Really appreciate the contribution ❤️

@joshdholtz joshdholtz merged commit eb2e217 into fastlane:master Mar 23, 2020
@fastlane-bot
Copy link

Hey @esteluk 👋

Thank you for your contribution to fastlane and congrats on getting this pull request merged 🎉
The code change now lives in the master branch, however it wasn't released to RubyGems yet.
We usually ship about once a week, and your PR will be included in the next one.

Please let us know if this change requires an immediate release by adding a comment here 👍
We'll notify you once we shipped a new release with your changes 🚀

Copy link

@fastlane-bot fastlane-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congratulations! 🎉 This was released as part of fastlane 2.144.0 🚀

@Sherlouk
Copy link
Contributor

Hey @joshdholtz - noticed a very small issue with this MR which I've fixed in #16205. Hope that's okay!

@joshdholtz
Copy link
Member

Of course! I’m just waking up but I’ll take a look once I get some coffee in me 😊

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[scan] Support for -testPlan and .xctestplan
9 participants