In my case Xcode added the test file to list of compiled sources for the main target. I had to go to app target -> Compile Sources, and delete the test file from there.