How do I run xctest from the command-line with Xcode 5?

后端 未结 1 638
我寻月下人不归
我寻月下人不归 2020-12-29 06:27

I found a command-line tool called \"xctest\" that apparently can run the unit tests in your project. This executable lives here:

/Applications/Xcode.app/Co         


        
相关标签:
1条回答
  • 2020-12-29 07:21

    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.

    0 讨论(0)
提交回复
热议问题