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

Allow running XCTest bundle with multiple comma-separated tests #268

Merged
merged 1 commit into from Dec 12, 2019
Merged

Allow running XCTest bundle with multiple comma-separated tests #268

merged 1 commit into from Dec 12, 2019

Conversation

egorzhdan
Copy link
Contributor

This improves consistency with macOS version of XCTest which supports such behavior.

Right now any tool which runs a subset of tests is required to invoke the XCTest bundle N times, which forces the tool to spawn a lot of processes, and part of the work will be performed over and over again. This is especially painful if any expensive initialization is required (such as starting a web server), since class func setUp() will be called every time a new test method is called instead of once per test case.

From user's point of view statistics in this scenario will be shown in a more human-friendly format as Executed 100 tests, with 0 failures instead of Executed 1 tests, with 0 failures printed 100 times.

@briancroom
Copy link
Collaborator

Great find @egorzhdan! I forgot that Xcode’s version of the tool supported this.

/// Run tests or test cases, printing results to stdout and exiting with
/// a non-0 return code if any tests failed. The names of tests or test cases
/// may be provided to only run a subset of them.
case run(selectedTestNames: [String]?)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess we should prefer to use a Set for this for efficiency when filtering during execution?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We will iterate over this array in TestFiltering.selectedTestFilter anyway for mapping into SelectedTests, but using a Set in the filter itself is indeed faster. Fixed.

@briancroom
Copy link
Collaborator

@swift-ci please test

@egorzhdan
Copy link
Contributor Author

Just fixed the recently arisen conflicts, @stmontgomery could you please take a look?

@spevans
Copy link
Collaborator

spevans commented Oct 29, 2019

@swift-ci please test

This improves consistency with macOS version of XCTest which supports such behavior
@briancroom
Copy link
Collaborator

@swift-ci Please test

@egorzhdan
Copy link
Contributor Author

egorzhdan commented Nov 8, 2019

The failure on Linux is probably unrelated to this PR. I don't think the changes here could have caused a SwiftPM build script error (the build finished successfully a few days ago and I didn't make any changes since then)

@spevans
Copy link
Collaborator

spevans commented Nov 8, 2019

@swift-ci test linux

@stmontgomery
Copy link
Contributor

@swift-ci Please test

@yeswolf
Copy link

yeswolf commented May 20, 2020

Hi, could you please share any ETA for these changes to be included into the Swift toolchain on Swift.org? It's essential to have this fix to run separate tests and as I can see they are still not included into the latest DEV.

@stmontgomery
Copy link
Contributor

Hi, could you please share any ETA for these changes to be included into the Swift toolchain on Swift.org? It's essential to have this fix to run separate tests and as I can see they are still not included into the latest DEV.

What specific toolchain are you using? This has been in master since before the 5.3 branch so it should be included in recent snapshots.

@yeswolf
Copy link

yeswolf commented May 21, 2020

@stmontgomery Sorry, it was my mistake during testing. Found it, everything works with 5.3 branch.

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.

None yet

5 participants