Xcode 7.3
Open Radar: rdar://25456632
In my app I have a string enum which I use to define some accessibility identifiers. For example
enum AccessibilityIds:String {
case ButtonFoo
}
I've built some UI tests where I want to search for controls. So I do something like this:
XCUIApplication().buttons[AccessibilityIds.ButtonFoo.rawValue]
XCode thinks this is fine and does not indicate any errors on the line. However when I compile the UI tests I get this compiler error:
Undefined symbols for architecture x86_64:
"myApp.AccessibilityIds.rawValue.getter : Swift.String", referenced from:
(extension in myAppUITests):__ObjC.XCTestCase.fooButton (myApp.AccessibilityIds) -> Swift.Bool in TestCaseExtensions.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Cross referencing the UI test target with the unit test target (Which compiles fine and uses the enum), I found that the UI tests did not have the Test Host set. Setting it meant that the UI test code would now compile, however the test itself then failed with a SIGKILL and the error:
testFooButton() encountered an error (Lost connection to test manager service. If you believe this error represents a bug, ...
So it appears that I cannot access enum rawValues in UI test code. Has anyone else come across this and managed to figure it out?