I have no idea what's going on. I'm using an expectation
in my test and it will not timeout. I've removed so much of my test that now I'm just left with:
func testItem() {
let expec = expectation(description: "expection")
wait(for: [expec], timeout: 3.0)
}
And it won't fail. It just hangs. Does anyone know why this might be happening?
If you are using
XCTestCase.expectation(description:)
, which adds the returnedXCTestExpectation
toself.expectations
, you should usewaitForExpectations
instead ofwait(for:)
.When using
wait(for:)
you should be creating your expectations usingXCTestExpectation(description:)
.