rules_apple
rules_apple copied to clipboard
How to disable tests in ios_unit_test?
In Xcode, we can disable tests in the file inspector. Those are recorded in xcscheme. Is there a way to do so with ios_unit_test?
This isn't currently supported. We normally prefix the test name with disabled_
@keith Thanks, but will this be supported at some point?
I haven't heard any plans, but someone from Google would have to answer that one.
@keith Thanks for the info! :)
IMO you can keep this issue open until there's input from someone from Google, since this might be a reasonable feature request
@keith Yeah you're right. Will post in Bazel's Google groups too. If there are any updates from them I will update this issue too.
Are you looking to disable the whole test or just a test method?
In stock Xcode you don't really "disable" a test, as much as schemes control what tests/test methods the scheme invokes, if you create a new scheme, all of the tests are still fair game as nothing marks them as disabled in the code.
The closest thing to this is Bazel's --test_filter
command line flag, but I believe it would be the responsibility of each test runner implementation to honor that setting and pass it through the underlying xctest
command.
Are you looking to disable the whole test or just a test method?
@thomasvl A whole test, but the test class is inherited by others which use the same test methods w/ different setup's. We have not found a way to exclude the methods in the base class yet.
In stock Xcode you don't really "disable" a test, as much as schemes control what tests/test methods the scheme invokes, if you create a new scheme, all of the tests are still fair game as nothing marks them as disabled in the code.
Yes. So is there an easy way to feed the xcscheme file to ios_unit_test
?
not really, we don't support xcschemes for running nor testing.
Do I understand it correctly that test_filter
is a no-op for XCTest? (If so, maybe this should be documented?).
I am looking to replicate this default Xcode feature:
...
So disabling entire files containing tests.
You can right click a test (suite) to disable it, not sure what this does:
--test_filter
is supported as of the more recent releases. But that's really more useful for a single one off test run where you want to disable a test, not disabling permanently like that in Xcode. AFAIUI that option in Xcode commits to your xctestrun file that a single test is disabled.