How to Write Unit Tests for Storyboard-based Buttons in Swift

I’m writing unit tests for my Storyboard-based view controllers. Button interaction can be tested in view automation tests, but that’s slow, and it’s complicated, and it’s not even necessary for most cases.

Then you have to add a usual unit test for the action method, finishExercise: in this case. And then you’re set: there’s nothing left UIAutomation tests can do for you to verify the basic behavior of the button.