Is it possible to run individual test cases, or individual test suites, from an iOS app test target, instead of all the test cases, from a command line interface?
You can run tests from command line with xcodebuild, out of the box. When you do so, you run all of the test cases contained in the test target you've selected.
You can also do so with scan from Fastlane, though I believe you're restricted to running all of the tests of the build scheme you select (as above), so it's not different from xcodebuild.
You can run specific tests with xctool from Facebook, but it doesn't use xcodebuild, and is restricted to running on simulators only, not actual iOS test devices.
I found a reference to running the xctest command line utility directly, but it seems to be an undocumented feature and targets DerivedData. This is complicated by the fact that UI Tests, have their *xctest files in a separate XCTRunner bundle.
It is now possible with Xcode 8 using the -only-testing
parameter with xcodebuild
:
xcodebuild test -workspace <path> -scheme <name> -destination <specifier> -only-testing:TestBundle/TestSuite/TestCase
You can edit the scheme to run only specific tests. Select the scheme, then edit scheme. In the appearing window, select the Test phase and disable/enable individual tests.
You can also add schemes to run subsets of tests. When running the tests from command line you can specify the scheme to use for the test (at least in fastlane).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With