At some point in my app's development, my Unit Tests and UI Tests lost access to my app's main module:
🛑 Cannot find type 'FileVacuumViewController' in scope
They worked with the xctestplan before. I don't know at what point it happened. I tried not importing @testable
, including the tests.swift
in the main module's "Target Membership".
Maybe I need to open the workspace instead of the xcproject? When I try to open the workspace there was an error message and no files show in the tree:
Here's my xctestplan config:
When I clicked to run one the UI tests individually, about 20 of these code sign dialogs showed:
Looks like your test file is included in both your app target and test bundle. Make sure to uncheck it from app target and try clean & build.
Select file "FileVacuumViewController" in Project Navigator and, in File Inspector, in the section Target Membership, check field which ends with Tests and UITests. Clean and build project, if necessary.
I ran into this recently with XCode 13 while following a blog post on creating unit tests. For some reason, XCode didn't automatically add the ViewController to the Test target.
My solution was to make sure that the ViewController was included in the Target Membership for the test suite. I had to also make the same Target Membership change for the Main storyboard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With