Xcode 11.0 beta 4 - Unable to compile test target

This is an xcode not a "swift" issue; the tests compile and run fine from the command line. I've posted in the developer xcode forum; I'm cross posting here on the off chance someone has bumped into this and knows a work around.

I get the following errors when attempting to compile and run my tests within XCode:

XCUIElement' is not a member type of 'XCTest'
'XCUIKeyboardKey' is not a member type of 'XCTest'
'XCTActivity' is not a member type of 'XCTest'
Failed to load module 'XCTest'

The procedure I used:

swift -version
Apple Swift version 5.1 (swiftlang-1100.0.212.5 clang-1100.0.28.2)
Target: x86_64-apple-darwin18.6.0

In Xcode 11.0 beta 4:

  1. Delete derived data
  2. rm -rf .build
  3. rm -rf projectName.xcodeproj
  4. swift package update
  5. swift test (tests compile, run and pass)
  6. swift package generate-xcodeproj
  7. Open project in xcode-beta
  8. [Cmd]-U

Hi, @neallester. I think this is a known issue around XCTest's module interface. Can you check that you're using the Xcode toolchain to compile when in the IDE? (Xcode menu > Toolchains)

Yes, using the Xcode 11.0 toolchain works. Thank you. I can't remember why I switched to the snapshot toolchain yesterday (with Beta 3), but apparently it was a mistake.

Terms of Service

Privacy Policy

Cookie Policy