Testing error code paths in Swift — Swift by Sundell


When writing automated tests, such as unit tests, many of us have a tendency to focus mostly on verifying that our code behaves correctly under ideal conditions, but we should ideally also test how our code behaves when something goes wrong. John Sundell takes a look at how unit tests can be used not only to verify correct outcomes — but to verify the correctness of the errors that our code can produce as well.


Want to receive more content like this in your inbox?