You can watch this episode by subscribing to Cocoacasts Plus.

Building a Modern Networking Layer in Swift

Writing Unit Tests for Private Methods

Code coverage is a very helpful tool to detect gaps in a test suite. In the previous episode, we enabled code coverage to learn how to write better unit tests for the APIClient class. The coverage report shows that the episodes() method is fully covered. It also reveals that the private request(_:) method lacks coverage. Even though the request(_:) method is private to the APIClient class, we can write unit tests to indirectly test it and increase coverage of the APIClient class. That is the focus of this episode.

Instant and Unlimited Access
to 500+ Cocoacasts Tutorials

Monthly

$19 / month

Pay Once a Month
30 Day Money Back Guarantee

Yearly

$8.25 / month (billed annually)

Pay Once a Year and Save $129
30 Day Money Back Guarantee