Quick: Test filtering does not work with Quick
Someone with Xcode 8 installed should try the new xcodebuild test filters with Quick. Does everything work as expected?
xcodebuild test -only-testing:MyTestBundle/MyTestSuite/MySpec
xcodebuild test -only-testing:MyTestBundle/MyTestSuite
xcodebuild test -only-testing:MyTestBundle
xcodebuild test -skip-testing:MyOtherTestBundle/MyTestSuite/MySpec
About this issue
- Original URL
- State: open
- Created 8 years ago
- Reactions: 2
- Comments: 15 (6 by maintainers)
@jessesquires @phatblat I found out what the issue is, it may only happen on Linux, I don’t have access to a Mac computer to test on macOS.
Basically XCTest takes one argument for the list of tests to execute (which is what SwiftPM
--filteruses when invoking your test binary).The thing is, it’s not one argument = one test case, it’s one argument for all selected test cases, separated by a comma 🙃
So when you have a Quick test that’s called
Quick.QuickSpec/my thing, when doing this, also does that, XCTest sees "run 3 tests: “Quick.QuickSpec/my thing”, “when doing this”, “also does that”.The incriminating code is here: https://github.com/apple/swift-corelibs-xctest/blob/swift-5.7-DEVELOPMENT-SNAPSHOT-2022-06-26-a/Sources/XCTest/Private/ArgumentParser.swift#L69
When removing the split call it fixes the issue for me.
I’m not too sure where to go from there, I guess the real fix would be in XCTest to add quotes or whatever, but it’s useless if SwiftPM does not also add quotes when using
--filter… there is also the macOS version of XCTest to consider that I cannot make a PR to.What do you recommend? Should I make an XCTest issue? I guess it’s normal that commas are not handled properly since test functions are supposed to come from actual function names, but since XCTest allows making them dynamically (through
allTestCases) I guess it should be able to handle any string.In case the answer is “commas are not legal in test cases names”, should we consider a workaround in Quick as well?
If it adds anything, the issue is not stale or outdated: I confirm that filtering still doesn’t work on Swift 5.6 on Linux (I don’t know the associated XCTest version) using
swift test --filter. It shows the exact same behavior as outlined in the previous comments.I played around with this using
swift5.2.2 and the full test names can be found using the--list-testsoption.Providing the full test name (or just the ) to the
--filteroption seems to do less work because there is a lot less output than when running without the filter. However it doesn’t appear to actually run any tests due to the “Executed 0 tests” output.xcodebuild(v11.5) has the same issue when running a subset of tests. It runs a test suite called ‘Selected tests’ and the summary shows it “Executed 0 tests”.Something in the
swift testcommand is able to see the individual Quick tests. I wonder if that mechanism can be used to help expose the filtered set of “Selected tests” from Quick to the XCTest runtime.Bug filed with the open source XCTest: https://github.com/apple/swift-corelibs-xctest/issues/458
I also filed FB12489187 for the closed-source version, with contents:
I’ll leave this open until it’s fixed.
Hey there! 👋🏼
I’m a new maintainer for this project and I’m trying to get the next release out ASAP and also clean up old issues and old PRs. I’m closing all issues that no longer seem relevant or are very old / stale.
This does not mean this issue is necessarily being rejected. If you are still interested in contributing the changes specified in this issue, please comment to request it be reopened.
We appreciate you opening this issue and acknowledge the time and effort you put in to contribute! You’re awesome. 💯 However, we are all volunteers here with limited capacity working for free. Unfortunately, that means we must close out stale issues and PRs to move the project forward in a reasonable way.
We apologize for the inconvenience and appreciate your understanding! 😎 ✌🏼
Tested with XCode 14.2,
-only-testing,-skip-testingwork at suite level, not at individual test case level.Same is true in the XCode UI test navigator.
I can’t install betas on my main work partition, but I’m going to setup a partition with macOS and the beta Xcode to test soon.