XCode 5 unit testing: starts my app

前端 未结 7 1773
挽巷
挽巷 2020-11-29 23:04

When I run my tests in XCode 5, the main window of my OS X app appears on the screen for a couple of seconds while running the tests. Why? Even if I uncomment all my tests i

7条回答
  •  抹茶落季
    2020-11-29 23:44

    If the tests are for code that can run on desktop and mobile, you can run them without a simulator or hosting them within your app.

    The trouble is that you cannot use the scheme chooser for your normal target (desktop or iOS) to run the test.

    The following worked for me in Xcode6.

    File > New Target...
    

    Select Cocoa Testing Bundle from the OS X category.

    enter image description here

    Take care to select None from the target drop-down.

    Specify new test target

    Click Finish. Add the relevant files to the new target as described above.

    Now create a scheme to run the test.

    Click the schemes chooser top-right and choose New Scheme..., click the drop-down and navigate down the list to the new target. Now you can choose the scheme from the schemes chooser, and use ⌘U to run the tests.

    enter image description here

提交回复
热议问题