Unit tests let you test classes in the main target using “@testable import TargetAppName”. UI tests are a little different since they test at an arm’s length away.
“Since UI tests are an entirely separate module from the app and are not run inside the app as logic tests are, the only way for them to share code is to compile in all the app files we need to share between the two.”
So if you have an AccessibilityIDs.swift file that you want to use in both your app target and UI test target, just make sure AccessibilityIDs.swift is added to both your app target and UI test target, and don’t use “@testable import TargetAppName”.
(To use AccessibilityIDs.swift in a unit test, don’t include AccessibilityIDs.swift in the unit test target, and do use “@testable import TargetAppName”.
https://www.bignerdranch.com/blog/ui-testing-in-xcode-7-part-1-ui-testing-gotchas/