Xcode 7 Tests don't run but reports success

For anyone else facing this issue, check to make sure that your test class is inheriting from XCTestCase as opposed to XCTest. I was going crazy trying all of these solutions until I realized that I was inheriting from the wrong class. Xcode doesn't complain, it will simply say tests succeeded without running them. Hope this helps someone.


If you are building for iOS do you usually have Xcode set to run on a physical device? If so try setting it to run on the iOS simulator.

I found that if you have Xcode 7 set to on a physical device unit testing will behave exactly as you've described. Setting Xcode to run on the iOS simulator temporarily for unit testing fixed the problem right up, and now it works like a charm.

I hope this helps anyone running into the same problem. :D


Worth mentioning for anyone who's stuck on this in the future: Xcode only runs XCTestCase functions that start with 'test'. This is contrary to other platforms, and confused me when I started testing in iOS.

The reason for this is so that you can have some convenient helpful methods inside you test classes which you don't necessarily want to call as tests themselves.

In the following test class:

class MyBigTest: XCTestCase {

    func testSensibleInputReturnSensibleAnswer() {
        XCTAssert(/* stuff */)
    }

    func setupSomeKindOfData() {
        // does some data setup here
    }

}

Only testSensibleInputReturnSensibleAnswer() will be called by the test suite. The setupSomeKindOfData() function may have some shared setup logic that lots of test functions will call.

Additionally, some people like to format their test method names with _s to make them more readable. For example: test_sensibleAnswer_sensibleResult().