Unit testing big legacy code bases

When you enter big legacy code bases that do not have yet a lot of unit tests, it can become a hassle to link all the relevant files for a certain refactor or fix to the test target. Because of all this hassle, it can be handy to add the following line on top of your test file. All the public and internal symbols from the app target will become available for testing.

import XCTestCase
@testable import TestProduct

This approach has a small downside. It’s a little bit slower than just linking the needed files to the test target. So always do a trade off and choose wisely.