XCTestCase
のプロパティで設定とかかなぁ。ちょっと気持ち悪いけど。func testFoo() async { timeout = 3.0 XCTAssertEqual(await foo(), 42) }
(edited)throws async
なら↓みたいな感じ? func testFoo() async { timeout = 3.0 do { XCTAssertEqual(await try foo(...), ...) XCTAssertEqual(await try foo(...), ...) XCTAssertEqual(await try foo(...), ...) } catch { XCTFail(...) } do { // error cases _ = await try foo(...) XCTFail(...) } catch error as FooError { XCTAssertEqual(error.bar, ...) } catch { XCTFail(...) } )