Xcode 5: Unit Tests not running

前端 未结 5 2649
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-20 05:15

I created a few test cases and they all passed... That\'s because they are not being run.

From Xcode, I get:

Test Suite \'All tests\' started at...
Test Suite          


        
相关标签:
5条回答
  • 2021-02-20 05:29

    Xcode 5 now used XCTestCase, not SenTest. Apple is now supporting Unit Testing more directly including their own version of SenTest named XCTestCase. Additionally the UI is much improved, allowing individual tests to be run, a Test Navigator and no longer creating .h test files. Note that the test macros are not renames with an XC prefix.

    See the WWDC-13 video 409: "Testing in Xcode 5".

    If you use the Xcode 5 template to create the testing environment the project will include a test target and a working (and failing) test.

    0 讨论(0)
  • 2021-02-20 05:37

    For me worked changing "Wrapper extension" from "octest" to "xctest" in Build Settings for tests target

    enter image description here

    0 讨论(0)
  • 2021-02-20 05:43

    I had this problem with Xcode 7.3, what worked for me was running the application on the device once and then running the tests.

    0 讨论(0)
  • 2021-02-20 05:45

    Try this:

    1. Clean Project Derived Data
    2. Product > Clean
    3. Run the app
    4. Wait for Xcode indexing to finish

    By this point the tests should reappear on the Test Navigator pane

    0 讨论(0)
  • 2021-02-20 05:51

    If you are creating a new test target in Xcode 5+ and planning to use SenTestKit for unit tests, changing the 'Wrapper Extension' build setting of your test target to 'octest' from the default 'xctest' will help execute the test cases.

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