How can I run XCTest for a swift application from the command line?
I was able to get your XCTestCase compiling with the following command:
swiftc \-F/Applications/Xcode6-Beta5.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks \-Xlinker -rpath -Xlinker /Applications/Xcode6-Beta5.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks \-lswiftCore LeapTest.swift \-o LeapTests
Then you can execute the tests with xctest
:
xcrun xctest LeapTests
And to break down those swiftc
command line options:
-F...
adds XCTest.framework to the framework search paths, enabling it to be imported from Swift-Xlinker -rpath ...
makes sure the XCTest shared library can be found at load time- Without explicitly specifying
-lswiftCore
, I found thatxctest
would crash when it tried to run the test suite
Hope that helps!