When creating Swift tests in
XCTest, the files being tested need to have
Target Membership in the test target. If the test file throw an error
Cannot find _ in scope, the solution is to add the file you intend to test to the test target.
- Open the file you intend to test.
- On the Right Panel click the paper page
Target Membershipselect your test target
- Product > Clean
For a guide on how to set up testing on a swift project read iOS Unit Testing and UI Testing Tutorial.