Because UI tests run as a separate process from the main app, I'm using UI tests as an opportunity to learn Swift.
The project is Objective C++ (there are a handful of .mm files), and the UI tests are a contained in a separate target, with nothing but a single .swift file containing tests.
My understanding is that no bridging header is necessary because the UI tests are not talking to the Objective-C code in the host application.
(and at any rate, adding such a file result in absolutely no change to the below-written behavior)
In Xcode 8.3.3, I found that the Swift 3.1 tests ran fine in all Simulators, but entering a breakpoint and running
po app.debugDescription
(app is a local var initialized as XCUIApplication.init()
worked properly in Simulator 10.x, but in Simulator 9.x returned the error
error: in auto-import:
failed to get module '<REDACTED>UITests' from AST context:
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "UIKitOverlayShims.h"
With Xcode 9 (up to and including Beta 5), the above error happens in every Simulator regardless of how trivial the Swift UI test code.
override func setUp() {
super.setUp()
continueAfterFailure = false
let app = XCUIApplication.init()
app.launch()
}
Adding a line into the setUp() method (for example) works fine...
print(app.debugDescription)
The Variables View shows proper output. And in the console running
fr v app
at least doesn't complain and attempts to spit out some useful information.
But trying to po anything from the Swift REPL now shows the above errors.
This makes for a huge productivity block, as I cannot rely on an interactive debugging session to understand failures in XCUIElement discovery.