Skip to content

Commit f352a83

Browse files
committed
[README] Explain how to run functional tests
1 parent 8890f6d commit f352a83

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,23 @@ If your install of Swift is located at `/swift` and you wish to install XCTest i
3838
./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"
3939
```
4040

41+
To run the tests on Linux, pass the `--test` option in combination with options to
42+
install XCTest in your active version of Swift:
43+
44+
```sh
45+
./build_script.py \
46+
--swiftc="/swift/usr/bin/swiftc" \
47+
--build-dir="/tmp/XCTest_build" \
48+
--swift-build-dir="/swift/usr" \
49+
--library-install-path="/swift/usr/lib/swift/linux" \
50+
--module-install-path="/swift/usr/lib/swift/linux/x86_64" \
51+
--test
52+
```
53+
54+
To run the tests on OS X, build and run the `SwiftXCTestFunctionalTests` target in the Xcode project.
55+
56+
You may add tests for XCTest by including them in the `Tests/Functional/` directory. For an example, see `Tests/Functional/SingleFailingTestCase`.
57+
4158
### Additional Considerations for Swift on Linux
4259

4360
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)