Learn how to test your Swift exercises on Exercism
When you are in the directory for an exercise, you should see two subdirectories:
Sources/<Exercise>
contains your solution to the exerciseTests/<Exercise>Tests
contains the tests to run for the exerciseIf you're in the right directory (i.e. the one containing Sources
and Tests
), you can run the tests for that exercise by running swift test
if you are using 5.4 or later:
$ pwd
/Users/johndoe/Code/exercism/swift/hello-world
$ ls
HELP.md Package.swift README.md Sources Tests
$ swift test
If you are using 5.1
through 5.3
you may have to add the --enable-test-discovery
flag:
$ swift test --enable-test-discovery
This will run all of the test files in the Test
directory.
For concept exercises, when you got a test passing change the true
in the XCTSkipIf
to false
to enable the next test.
To upload a solution to Exercism, you have to be in the directory containing the Sources
and Tests
directories.
$ exercism submit