Xcode 10.1 and super.tearDown

Hi,

Since Xcode 10.1(maybe 10) when I create a Unit test file I don't have calls super.tearDown() and super.setUp() .

I've not seen such changes in release notes.

In documentation https://developer.apple.com/documentation/xctest/xctestcase/understanding_setup_and_teardown_for_test_methods are still here.

So my question should I still write super.tearDown() and super.setUp()?



class SomethingTests: XCTestCase {

    override func setUp() {
        // Put setup code here. This method is called before the invocation of each test method in the class.
    }

    override func tearDown() {
        // Put teardown code here. This method is called after the invocation of each test method in the class.
    }

    func testExample() {
        // This is an example of a functional test case.
        // Use XCTAssert and related functions to verify your tests produce the correct results.
    }

    func testPerformanceExample() {
        // This is an example of a performance test case.
        self.measure {
            // Put the code you want to measure the time of here.
        }
    }
}
Answered by DTS Engineer in 348314022

I responded over on the thread that Soheil created.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I noticed the same thing and asked a similar question. I didn't notice it started in Xcode 10.x. I was always the impression that you must call super in those methods. Even Apple's documentation has the call to super in them (https://developer.apple.com/documentation/xctest/xctestcase/understanding_setup_and_teardown_for_test_methods ). I am also curious to find out what's the best practice now.

Accepted Answer

I responded over on the thread that Soheil created.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
Xcode 10.1 and super.tearDown
 
 
Q