Home    |    Articles    |    Talks
—————————————————————————————————————————————

iOS Code Review #2: Adding Tests to an Existing App (Networking)

Adding tests to an existing app can be challenging and sometimes intimidating. In this episode of iOS Code Review, I go through the process step-by-step.

You’ll see how to refactor existing code to make it testable by identifying dependencies and side-effects; how to write elementary tests to “lock” the current configuration of simple elements; how to mock network calls using a custom URLProtocol subclass. Finally, I’ll show how to easily mock dependencies using in-line closures.

Don’t forget to submit a project to the next iOS code review using https://vojtastavik.typeform.com/to/Y5p1BU.