Skip to content

XCTest vs Swift Testing

yuncheol-AHN edited this page Nov 4, 2024 · 1 revision

XCTest vs Swift Testing

문제 상황

  • Swift 6 도입에 따른, 테스트 프레임워크 결정
  • XCTest vs Swift Testing

문제 해결

XCTest 장단점

  • 4명 모두 경험이 있음

  • 비동기 처리하려면 timer 작업 해줘야 함

  • XCTAssert 메소드 너무 많음

    XCTAssertTrue()

    XCTAssertFalse()

    XCTAssertEqual()

    XCTAssertNil()

    XCTAssertNotNil()

    XCTAssertLessThan()

    XCTAssertGreaterThan()

    XCTAssertLessThanOrEqual()

    XCTAssertGreaterThanOrEqual()

    ...

Swift Testing 장단점

  • Swift 6.0 도입해야 쓸 수 있음 → 어차피 우린 도입함
  • 비동기 처리가 쉽다..?
  • Swift Native 테스트 작업
  • struct와 @를 통해 가독성 좋게 작성 가능 약간 스유처럼 MZ함
  • Swift Testing #expect()

결론

Why? Swift Testing

  • Swift 6.0

  • Expressive and Intuitive (직관적이다)

  • Swift Testing 쓰다가 안되면, XCTest로 병행 가능 ^_^

  • all tests integrate seamlessly with Swift Concurrency and run in parallel by default

참조 링크

https://blogs.infosys.com/digital-experience/mobility/swift-testing-vs-xctest-a-comprehensive-comparison.html

https://medium.com/@dhananjayshchauhan/comparing-xctest-and-swift-testing-ab7d897f012b

https://leocoout.medium.com/welcome-swift-testing-goodbye-xctest-7501b7a5b304

https://developer.apple.com/xcode/swift-testing/

https://developer.apple.com/documentation/xctest/

Clone this wiki locally