Testing
Testing async code
How do you test an async/await API in a unit test?
How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
How do you test an async/await API in a unit test?
Since Xcode 13 you declare the test method async throws, await it like let result = try await sut.load(), and assert right after. Remove time dependence by injecting a Clock, and don't wait with sleep.
TestingShort answerAdvanced
How is Swift Testing different from XCTest?
#swift-testing
TestingMultiple choiceBasics
Which statements about Swift Testing's #expect and #require are correct? Select all that…
#swift-testing
TestingMultiple choiceExpert
In a suite written with Swift Testing, several tests write to and read from the same file…
#swift-testing
ConcurrencyMultiple choiceIntro
Which of the following statements about sync/async and serial/concurrent queues are…
#async