How to use XCTest on Linux/Windows?

I noticed there's a version of XCTest on Github, but so far I've been unable to configure Package.swift to make use of it. I have some Swift code that needs to run on Mac, Linux and Windows and I want to use XCTest for testing, if possible. The usual way, of specifying the URL to the repo and specifying XCTest as a dependency, is not working. Is there a tutorial somewhere that explains the process?

XCTest is included with Swift toolchains, adding it as a dependency in Package.swift has no (positive) effect. It's usable on all platforms the same way: just import XCTest in your test target's source code and you're good to go.

Thanks. It works when I use Package.swift (on a Mac). I haven't tried it on Linux/Win yet.
When I use "swift source.swift" though, I get: error: no such module 'XCTest'

swift source.swift is a Swift Driver invocation. You should expect XCTest to be available in those kind of invocations on any platform.

Testing is not a feature of Swift Driver, but a feature of SwiftPM invoked via the swift test command on a whole package instead of a specific file, since it has to know what is a test module, what is a library module etc.