Search code examples
iosxcodeunit-testingcommand-line-interfacexcodebuild

How to run all unit tests for iOS workspace?


I have one host iOS project named MyProject under workspace named MyWorkspace. The workspace also have two linked projects named MyFramework1 and MyFramework2. When I run unit test only host project's (i.e. MyProject's) unit tests are getting run but I have unit tests for both frameworks. How can I run all the unit tests for all projects (including host app and frameworks) under workspace MyWorkspace from CLI xcodebuild command?

I am currently using,

xcodebuild -xctestrun some.xctestrun -destination "platform=iOS Simulator,name=iPhone 11" test-without-building

Solution

  • Finally, I am able to run all tests for my workspace. I just needed to,

    1. Open workspace in Xcode
    2. Select Host app Target -> Edit Scheme -> Build
    3. Enable test for all unit test suites showing in the list
    4. Have a clean build and test