Running individual XCTest (UI, Unit) test cases for iOS apps from the command line
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
Is it possible to run individual test cases/test classes on the command line with xcode 5?
Not that I know of, and it's not on the man page either. But you have such option in the excellent xctool (-only SomeTestTarget:SomeTestClass/testSomeMethod
).
iOS: Run a single unit test from the command line
Try using xctool which can run tests on devices https://github.com/facebook/xctool
Target individual XCTest unit test cases in Xcode 5 to a specific iOS device for a universal app?
To target device specific tests one would need to edit the schemes for a project. Under Product > Scheme > Edit Schemes one can choose to select device specific tests per device.
Can you run a specific Xcuitest from the command line?
You should be able to do that with xctool command line tool for running specific test class,
xctool -workspace YourWorkspace.xcworkspace -scheme YourScheme test -only myUITestTarget:UITestClass
You can also use xcodebuild
to run the entire test suite as explained here,
https://krausefx.com/blog/run-xcode-7-ui-tests-from-the-command-line
How do I run xctest from the command-line with Xcode 5?
Despite what the usage message says -XCTest is the argument you need:
xctest -XCTest MyAppTests/testExample testbundle.xctest
For a direct invocation of xctest to work you may also need to set DYLD_FRAMEWORK_PATH
and DYLD_LIBRARY_PATH
to your built products directory. In general you need to use the same arguments and environment as Xcode does, you can see this by putting a breakpoint in one of your tests, running them through Xcode, then printing out the values of arguments
and environment
for [NSProcessInfo processInfo]
.
To avoid messing with all that note you can also modify the scheme in Xcode to run only specific tests. Under Product > Scheme > Edit Scheme select the Test action and expand the test bundle. You can use the check boxes to select the tests to run and xcodebuild's test action will then run only these tests.
Related Topics
Xcode 6 with Swift Super Slow Typing and Autocompletion
Uiscrollview with Centered Uiimageview, Like Photos App
Add Shadow on Uiview Using Swift 3
Build Not Visible in Itunes Connect
How to Do Programmatically Gradient Border Color Uibutton with Swift
How to Combine Two Dictionary Instances in Swift
How to Make a Function Execute Every Second in Swift
What Size Should Tabbar Images Be
Iphone:How to Detect the End of Slider Drag
Swift - How to Dismiss All of View Controllers to Go Back to Root
Swift: How to Refresh Uicollectionview Layout After Rotation of the Device
Converting Utc Date Format to Local Nsdate
How to Set the Uinavigationbar with Gradient Color
Facebook Sdk: App Not Registered as a Url Scheme
Writing an iOS 8 Share Extension Without a Storyboard
Swift: How to Execute an Action When Uitabbaritem Is Pressed