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
How does XCTest handle testing asynchronous code, such as a network request completion handler?
What is the significance of writing tests as part of the same Xcode project/workspace as the application code, using a dedicated test target?
What is the purpose of `XCTAssertThrowsError`?
What is a "mock" or "stub" object typically used for when testing a class with XCTest, and why might a protocol be involved?
What is the distinction between an XCTest "unit test" and a "UI test" (XCUITest)?
What does `XCTAssertEqual` do?
How can XCTest be used to write a "regression test" for a previously-fixed bug?
What is `measure { }` used for in an XCTest performance test?
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?
How do you define a test case in XCTest?
How does XCTest handle running tests from the command line, outside of the Xcode IDE (e.g. as part of a CI pipeline)?
What is `XCTUnwrap` used for, and what problem does it solve compared to force-unwrapping an optional directly?