Those of you who are regular visitors to qualitycoding.org may have already read Jon’s article outlining the life cycle of XCTestCase objects during the execution of a test suite. If you haven’t, or you want to refresh your memory, take a moment to read the original article.
Jon discusses the importance of the setUp and tearDown methods. And, more specifically, why we should be deallocating our properties in the tearDown method.
Writing a tear down method is one of those repetitive tasks. It follows a specific pattern: all properties should be set to nil. It doesn’t really require any brain power. It’s just one of those annoying tasks that you have to remember to do when writing a test.
It’s tasks like this that should be automated. And now with the Swift tear down inspection AppCode plugin, we can.