我想我理解继承的概念,但显然我不理解,因为如果 XCTest 在其类中提供 setup 方法,为什么在 XCTestCase 中有 setup 方法?XCTestCase 是 XCTest 的子类,但在阅读了 Apple 文档后,两者之间看起来并没有什么不同。
import XCTest
@testable import FirstDemo
class FirstDemoTests: XCTestCase {
override func setUp() {
super.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.
super.tearDown()
}
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.
}
}
}