Section 9/121 menit
9. Kapan Tidak Digunakan
9. Kapan Tidak Digunakan
Tetap Gunakan XCTest untuk:
1. UI Testing (XCUITest)
swift
// Swift Testing tidak punya pengganti untuk XCUITest
class UITests: XCTestCase {
func testLoginFlow() {
let app = XCUIApplication()
app.launch()
// ... UI interactions
}
}
2. Performance Testing
swift
// XCTest punya measure {} yang belum ada di Swift Testing
func testParsingPerformance() {
measure {
_ = parser.parse(largeDataset)
}
}
3. Test yang harus integrate dengan CI yang hanya support XCTest
swift
// Beberapa CI tools dan coverage tools belum support Swift Testing sepenuhnya
// Cek kompatibilitas toolchain sebelum migrasi total
4. Codebase yang harus support Swift 5.9 atau lebih lama
swift
// Swift Testing membutuhkan Swift 5.10+ (stabil di Swift 6)
// Gunakan #if canImport(Testing) untuk conditional compilation
#if canImport(Testing)
import Testing
@Test func newTest() { }
#else
import XCTest
class NewTests: XCTestCase {
func testNewTest() { }
}
#endif