Group Group Group Group Group Group Group Group Group Forums

Unit Testing on macOS: Part 2/2

In the second part of our Unit testing tutorial for macOS you'll learn about UI tests and code coverage and you learn how to test asynchronous code.

This is a companion discussion topic for the original entry at


Thank you so much for creating this tutorial! I’ve worked through the first tutorial yet hit a snag early on part 2 and was wondering if you could help:
Added the new ViewControllerTests file and set the Storyboard ID in the Identity Inspector, only to find that I get an NSInvalidArgumentException (??) Tried to check against the completed version and didn’t notice any difference. Is there possibly something else which may have been overlooked?

Thank you again!


Glad you are enjoying the tutorial.

I have encountered this problem with Xcode several times in various projects. I have a number of things I try and eventually one works :]

  1. In Xcode: Product menu -> Clean
  2. In Xcode: Product menu, hold down Option -> Clean Build Folder
  3. In Finder: go to ~/Library/Developer/Xcode/DerivedData and delete any folders relating to this project
  4. In Xcode: clear the Storyboard ID, build the app, then re-enter the Storyboard ID making sure there are no invisible characters (I usually just copy & paste from the Class field).

Hopefully one of all of these will solve the problem.

1 Like

This tutorial is more than six months old so questions are no longer supported at the moment for it. We will update it as soon as possible. Thank you! :]