Skip to content

Commit 6ad307f

Browse files
committed
Add section to README about how to build XCTest
1 parent 8b8156b commit 6ad307f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,22 @@ You can find all kinds of useful information on using XCTest in [Apple's documen
2222

2323
The rest of this document will focus on how this version of XCTest differs from the one shipped with Xcode.
2424

25+
## Working on XCTest
26+
27+
XCTest can be built as part of the overall Swift package. When following [the instructions for building Swift](http://www.github.com/apple/swift), pass the `--xctest` option to the build script:
28+
29+
```
30+
swift/utils/build-script --xctest
31+
```
32+
33+
If you want to build just XCTest, use the `build_xctest.py` script at the root of the project. The `master` version of XCTest must be built with the `master` version of Swift.
34+
35+
If your install of swift is located at `/swift` and you wish to install XCTest into that same location, here is a sample invocation of the build script:
36+
37+
```
38+
./build_script.py --swiftc="/swift/usr/bin/swiftc" --build-dir="/tmp/XCTest_build" --swift-build-dir="/swift/usr" --library-install-path="/swift/usr/lib/swift/linux" --module-install-path="/swift/usr/lib/swift/linux/x86_64"
39+
```
40+
2541
### Additional Considerations for Swift on Linux
2642

2743
When running on the Objective-C runtime, XCTest is able to find all of your tests by simply asking the runtime for the subclasses of `XCTestCase`. It then finds the methods that start with the string `test`. This functionality is not currently present when running on the Swift runtime. Therefore, you must currently provide an additional property called `allTests` in your `XCTestCase` subclass. This method lists all of the tests in the test class. The rest of your test case subclass still contains your test methods.

0 commit comments

Comments
 (0)