All quizzes
Free quiz · 20 questions in the bank

XCTest quiz

Test your XCTest knowledge with a free interactive quiz — 20 questions with answers and explanations. No signup needed to play.

Question 1/12Score 0

How does XCTest handle testing asynchronous code, such as a network request completion handler?

In this round
  1. How does XCTest handle testing asynchronous code, such as a network request completion handler?
  2. What is the significance of writing tests as part of the same Xcode project/workspace as the application code, using a dedicated test target?
  3. What is the purpose of `XCTAssertThrowsError`?
  4. What is a "mock" or "stub" object typically used for when testing a class with XCTest, and why might a protocol be involved?
  5. What is the distinction between an XCTest "unit test" and a "UI test" (XCUITest)?
  6. What does `XCTAssertEqual` do?
  7. How can XCTest be used to write a "regression test" for a previously-fixed bug?
  8. What is `measure { }` used for in an XCTest performance test?
  9. What is the benefit of dependency injection (passing a class's dependencies in via its initializer, rather than the class creating them internally) specifically for writing effective XCTest unit tests?
  10. How do you define a test case in XCTest?
  11. How does XCTest handle running tests from the command line, outside of the Xcode IDE (e.g. as part of a CI pipeline)?
  12. What is `XCTUnwrap` used for, and what problem does it solve compared to force-unwrapping an optional directly?
Gaps to close?
Read the curated XCTest notes — core concepts, patterns, interview prep.
XCTest notes

More quizzes

.NET.NET MAUIAbsintheAccessibilityActixActix Web