IssueRaiser

One issue with the XCTestExpectation note is that you can't wait for something if you don't know exactly how long it will take.

One issue with the XCTestExpectation note is that you can't wait for something if you don't know exactly how long it will take. Hard-coding in a timeout, essentially, can make your tests very brittle. Take, for instance, testing loading content from a local web server. Ideally your UI should be decoupled enough form your web server that you can mock it. That way you only have to wait for animation delays, and your tests don't fail if your server is down. That is if mocks fit in your testing philosophy, of course, but I think this is a place were the advantage of this approach is quite clear. And this clearly doesn't work for end-to-end tests, but those are inherently brittle.

Posted by Fargren on Jun 30, 2015, 12:15 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.5,500 issues0 comments

reliability (EdTech)

One issue with the XCTestExpectation note is that you can't wait for something if you don't know exactly how long it will take.

FargrenJun 30, 2015, 12:15 PM

One issue with the XCTestExpectation note is that you can't wait for something if you don't know exactly how long it will take. Hard-coding in a timeout, essentially, can make your tests very brittle. Take, for instance, testing loading content from a local web server. Ideally your UI should be decoupled enough form your web server that you can mock it. That way you only have to wait for animation delays, and your tests don't fail if your server is down. That is if mocks fit in your testing philosophy, of course, but I think this is a place were the advantage of this approach is quite clear. And this clearly doesn't work for end-to-end tests, but those are inherently brittle.

Comments (0)

No comments yet. Start the discussion.

Comment on this issue