Add the Helper Framework to the Project
Presenting an alert is normally a difficult dependency (see Identify Difficult Dependencies). For unit tests, it’s a side effect. For UI tests, it interrupts the flow of control, waiting for input. To make it easier to unit test alerts, I wrote a framework called ViewControllerPresentationSpy.
The framework is a collection of three verifiers. One is to capture alerts and action sheets, which we’ll use here. The other two are to capture how view controllers are presented or dismissed.
Find the latest release by going to its GitHub page[20] and clicking “releases.” Download the versioned zip file, which GitHub shows with a size. Drag ViewControllerPresentationSpy.framework to the open Xcode project, ...
Get iOS Unit Testing by Example now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.