Xcode: (CMAKE_XCODE_GENERATE_SCHEME) - Can't run automated tests of iOS App on iPhoneSimulator, generated scheme incomplete
Goal: Run automated XCTests of an iOS App in iPhone Simulator with cmake generated Xcode projects and schemes.
Problem: With the cmake generated project the app can be built and run on iOS Simulator but the tests cannot be invoked either manually (Xcode menu Product->Test is disabled) or automated using xcodebuild command.
The reason is the empty <Testable/>
element and a missing <MacroExpansion>
element in the TestAction block in the generated scheme of the app.
When the empty Testable element is replaced with a Testable and MacroExpansion element of an Xcode generated scheme with adapted BlueprintIdentifier and ReferencedContainer values it works as expected.
Steps to reproduce:
Create new Xcode project for iOS using "Single View Application" template with:
Product Name: iOSTestWithCMakeXCSchemes Organisation Name: Foo.org Organisation Identifier: org.foo
Copy attached CMakeLists.txt in the root directory of the new project.
Copy attached plist.in in the subdirectory iOSTestWithCMakeXCSchemes of the project root dir.
Generate Xcode project with cmake GUI version 3.9.0-rc2
Check output view of cmake GUI to verify that XCTest framework was found in .../Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/... and not in .../Xcode.app/Contents/Developer/Platforms/MacOSX.platform/...
Start Xcode and open project generated with cmake. The Xcode Menu item Product->Test is disabled.