How Do I Test an API With Swift Concurrency

I'm trying to test an API I'm writing with Structured Concurrency. I prefer to run my tests with continueAfterFailure = false so that I may establish preconditions on my tests. At the moment my test is:

    func testRssUrl() async throws {
        self.continueAfterFailure = false
        let xml = PodcastXml.url(url)
        let feed = try await xml.feed
        let rssFeed: RSSFeed? = feed.rssFeed
        XCTAssertNil(rssFeed) // Included for this sample
        XCTAssertNotNil(rssFeed) 
        validate(zebraFeed: rssFeed!)
    }

My expectation of Swift Concurrency is that the try await should hold the method, until xml.feed resolves to a value or throws. Either of the XCTAssertNil or XCTAssertNotNil should fail (in the actual test, I'm not using NotNil). As written, between the two asserts and the try, validate(zebraFeed: ) should never be called because of continueAfterFailure.

Yet it is. The test still fails because XCTAssertNil is failing, which is my actual expectation. Test execution should also be stopping there.

What am I missing?

Clarification: In the actual test I am using XCTAssertNil, the XCTAssertNotNil was added for testing that the test exits on assertion failure. Sorry for the confusion. Either way, validate shouldn't be reached.

This is not an answer but an expanded example:

class TestAwaitTests: XCTestCase {

    struct Thing {
        let value = true
        func doSomething() async throws -> Int? {
            try await Task.sleep(nanoseconds: 5_000_000_000)
            return 1
        }
    }

    func validation(thing: Thing, file: StaticString = #file, line: UInt = #line) {
        XCTAssertFalse(thing.value)
        XCTAssertTrue(thing.value) // Breakpoint here
    }

    func testTest() async throws {
        continueAfterFailure = false
        let thing = Thing()
        let result = try await thing.doSomething()
        print("print 1")
        XCTAssertNil(result)
        print("print 2")
        XCTAssertNotNil(result)
        print("print 3")
        validation(thing: thing)
        enum Err: Error { case oops }
        throw Err.oops
        print("print 4")
    }
}

Results in the console output

print 1
print 2
print 3

The test fails, as expected. What is unexpected is that the statements print 2 and print 3 are produced. The line marked Breakpoint here should never execute. I can see it hit even in the debugger continueAfterFailure should be stopping the test first assertion.

How Do I Test an API With Swift Concurrency
 
 
Q