OS Manuals

/usr/bin/swift-test

Swift is a high-performance system programming language. It has a clean and modern syntax, offers seamless access to existing C and Objective-C code and frameworks, and is memory-safe by default.

From swift 6.4.2-r0 (enterprise-packages), captured 2026-11-08 by running swift-test --help (exit 0). permalink

OVERVIEW: Build and run tests.

SEE ALSO: swift build, swift run, swift package

USAGE: swift test <options> <subcommand>

PATHS & LOCATIONS:
  --package-path <package-path>
                          Specify the package path to operate on (default current directory). This
                          changes the working directory before any other operation.
  --cache-path <cache-path>
                          Specify the shared cache directory path.
  --config-path <config-path>
                          Specify the shared configuration directory path.
  --security-path <security-path>
                          Specify the shared security directory path.
  --scratch-path <scratch-path>
                          Specify a custom scratch directory path. (default .build)
  --swift-sdks-path <swift-sdks-path>
                          Path to the directory containing installed Swift SDKs.
  --toolset <toolset>     Specify a toolset JSON file to use when building for the target platform.
                          Use the option multiple times to specify more than one toolset. Toolsets
                          will be merged in the order they're specified into a single final toolset
                          for the current build.
  --pkg-config-path <pkg-config-path>
                          Specify alternative path to search for pkg-config `.pc` files. Use the
                          option multiple times to
                          specify more than one path.

CACHING:
  --enable-dependency-cache/--disable-dependency-cache
                          Determines whether dependency fetching uses a shared cache. (default:
                          --enable-dependency-cache)
  --enable-build-manifest-caching/--disable-build-manifest-caching
                          (default: --enable-build-manifest-caching)
  --manifest-cache <manifest-cache>
                          Caching mode of Package.swift manifests. Valid values are: (shared:
                          shared cache, local: package's build directory, none: disabled) (default:
                          shared)
  --enable-experimental-prebuilts/--disable-experimental-prebuilts
                          Determines whether macros use prebuilt swift-syntax libraries. (default:
                          --enable-experimental-prebuilts)

LOGGING:
  -v, --verbose           Increase verbosity to include informational output.
  --very-verbose, --vv    Increase verbosity to include debug output.
  -q, --quiet             Decrease verbosity to only include error output.
  --color-diagnostics/--no-color-diagnostics
                          Determines whether color diagnostics appear when printing to a TTY.
                          By default, the terminal enables color diagnostics when connected to a
                          TTY and disables them otherwise. (default: --no-color-diagnostics)

SECURITY:
  --disable-sandbox       Disable the sandbox when executing subprocesses.
  --netrc                 Use netrc file even in cases where other credential stores are preferred.
  --enable-netrc/--disable-netrc
                          Determines whether SwiftPM loads credentials from a netrc file. (default:
                          --enable-netrc)
  --netrc-file <netrc-file>
                          Specify the netrc file path.
  --resolver-fingerprint-checking <resolver-fingerprint-checking>
                          (default: strict)
  --resolver-signing-entity-checking <resolver-signing-entity-checking>
                          (default: warn)
  --enable-signature-validation/--disable-signature-validation
                          Determines whether SwiftPM validates signatures on package releases
                          downloaded from the registry. (default: --enable-signature-validation)

RESOLUTION:
  --enable-prefetching/--disable-prefetching
                          (default: --enable-prefetching)
  --force-resolved-versions, --disable-automatic-resolution, --only-use-versions-from-resolved-file
                          Only use versions from the Package.resolved file and fail resolution if
                          it is out-of-date.
  --skip-update           Skip updating dependencies from their remote during a resolution.
  --disable-scm-to-registry-transformation
                          Disable source control to registry transformation. (default:
                          --disable-scm-to-registry-transformation)
  --use-registry-identity-for-scm
                          Look up source control dependencies in the registry and use their
                          registry identity when possible to help deduplicate across the two
                          origins.
  --replace-scm-with-registry
                          Look up source control dependencies in the registry and use the registry
                          to retrieve them instead of source control when possible.
  --default-registry-url <default-registry-url>
                          Default registry URL to use, instead of the registries.json configuration
                          file.

BUILD OPTIONS:
  -c, --configuration <configuration>
                          Build with the specified configuration. (values: debug, release)
  -Xcc <Xcc>              Pass flag through to all C compiler invocations.
  -Xswiftc <Xswiftc>      Pass flag through to all Swift compiler invocations.
  -Xlinker <Xlinker>      Pass flag through to all linker invocations.
  -Xcxx <Xcxx>            Pass flag through to all C++ compiler invocations.
  --triple <triple>
  --sdk <sdk>
  --toolchain <toolchain>
  --swift-sdk <swift-sdk> Filter for selecting a specific Swift SDK to build with.
  --sanitize <sanitize>   Turn on runtime checks for erroneous behavior. (values: address, thread,
                          undefined, scudo, fuzzer)
  --auto-index-store/--enable-index-store/--disable-index-store
                          Determines whether to automatically index while building. (default:
                          --auto-index-store)
  --enable-parseable-module-interfaces
  -j, --jobs <jobs>       The number of jobs to spawn in parallel during the build process.
                          (default: 64)
  --use-integrated-swift-driver
  --explicit-target-dependency-import-check <explicit-target-dependency-import-check>
                          Check that targets only import their explicitly declared dependencies.
                          (values: none, warn, error; default: none)
  --build-system <build-system>
                          Specify the build system to use. (default: swiftbuild)
        native            - Native Build System (deprecated)
        swiftbuild        - Swift Build build engine (default)
        xcode             - Xcode build system integration (deprecated)
  -debug-info-format <debug-info-format>
                          The Debug Information Format to use. (values: dwarf, codeview, none)
  --experimental-enable-codesize-profile
                          Generate SIL, LLVM IR, and optimization record files for code size
                          profiling.
  --experimental-codesize-profile-output-dir <experimental-codesize-profile-output-dir>
                          Directory to store code size profiling output files.
  --enable-experimental-strip-products/--disable-experimental-strip-products
                          Whether or not to strip debug symbols from the final binary.
  --enable-dead-strip/--disable-dead-strip
                          Determines whether the linker strips unused code. (default:
                          --enable-dead-strip)
  --disable-local-rpath   Disable adding $ORIGIN/@loader_path to the rpath by default.

TRAIT OPTIONS:
  --traits <traits>       Enable the specified traits of the package. Specify multiple traits as a
                          comma-separated list, for example: `--traits Trait1,Trait2`. When
                          enabling specific traits, you must also explicitly enable the default
                          traits by passing `defaults` to this option.
  --enable-all-traits     Enable all traits of the package.
  --disable-default-traits
                          Disable all default traits of the package.

OPTIONS:
  --skip-build            Skip building the test target.
  --enable-xctest/--disable-xctest
                          Determines whether the build includes XCTest support.
  --enable-swift-testing/--disable-swift-testing
                          Determines whether the build includes Swift Testing support.
  --attachments-path <attachments-path>
                          Path where attachments should be written (Swift Testing only). This path
                          must be an existing directory the current user can write to. If not
                          specified, any attachments created during testing are discarded.
  --parallel/--no-parallel
                          Determines whether tests run in parallel. (default: --no-parallel)
  --num-workers <num-workers>
                          The number of tests to execute in parallel.
  --maximum-repetitions <maximum-repetitions>
                          The maximum number of times each test will repeat. Only supported for
                          Swift Testing test suites.
  --repeat-until <repeat-until>
                          The condition upon which to stop repeating a test. Must be either `pass`
                          or `fail`. Only supported for Swift Testing test suites.
  -l, --list-tests        List test methods in specifier format.
  --show-codecov-path, --show-code-coverage-path, --show-coverage-path
                          Print the path of the exported code coverage JSON file.
  -s, --specifier <specifier>
  --filter <filter>       Run test cases that match a regular expression, for example,
                          <test-target>.<test-case> or <test-target>.<test-case>/<test>.
  --skip <skip>           Skip test cases that match a regular expression. For example: '--skip
                          PerformanceTests'.
  --xunit-output <xunit-output>
                          The path where the test command generates the xUnit XML.
  --enable-testable-imports/--disable-testable-imports
                          Determines whether test modules use @testable imports. (default:
                          --enable-testable-imports)
  --enable-code-coverage/--disable-code-coverage
                          Determines whether testing measures code coverage. (default:
                          --disable-code-coverage)
  --debugger              Launch the tests in a debugger session. Use the `failbreak` alias to
                          attach breakpoints that will trigger on test failures.
  --version               Show the version.
  -h, -help, --help       Show help information.

SUBCOMMANDS:
  list                    Lists test methods in specifier format
  last

  See 'swift help test <subcommand>' for detailed help.
Options (58)
OptionDescriptionSource
--package-path package-pathSpecify the package path to operate on (default current directory).help
--cache-path cache-pathSpecify the shared cache directory path.help
--config-path config-pathSpecify the shared configuration directory path.help
--security-path security-pathSpecify the shared security directory path.help
--scratch-path scratch-pathSpecify a custom scratch directory path.help
--swift-sdks-path swift-sdks-pathPath to the directory containing installed Swift SDKs.help
--toolset toolsetSpecify a toolset JSON file to use when building for the target platform.help
--pkg-config-path pkg-config-pathSpecify alternative path to search for pkg-config `.pc` files.help
--manifest-cache manifest-cacheCaching mode of Package.swift manifests.help
-v, --verboseIncrease verbosity to include informational output.help
--very-verbose, --vvIncrease verbosity to include debug output.help
-q, --quietDecrease verbosity to only include error output.help
--disable-sandboxDisable the sandbox when executing subprocesses.help
--netrcUse netrc file even in cases where other credential stores are preferred.help
--netrc-file netrc-fileSpecify the netrc file path.help
--resolver-fingerprint-checking resolver-fingerprint-checking(default: strict)help
--resolver-signing-entity-checking resolver-signing-entity-checking(default: warn)help
--force-resolved-versions, --disable-automatic-resolution, --only-use-versions-from-resolved-fileOnly use versions from the Package.resolved file and fail resolution if it is out-of-date.help
--skip-updateSkip updating dependencies from their remote during a resolution.help
--disable-scm-to-registry-transformationDisable source control to registry transformation.help
--use-registry-identity-for-scmLook up source control dependencies in the registry and use their registry identity when possible to help deduplicate across the two origins.help
--replace-scm-with-registryLook up source control dependencies in the registry and use the registry to retrieve them instead of source control when possible.help
--default-registry-url default-registry-urlDefault registry URL to use, instead of the registries.json configuration file.help
-c, --configuration configurationBuild with the specified configuration.help
-Xcc XccPass flag through to all C compiler invocations.help
-Xswiftc XswiftcPass flag through to all Swift compiler invocations.help
-Xlinker XlinkerPass flag through to all linker invocations.help
-Xcxx XcxxPass flag through to all C++ compiler invocations.help
--triple triplehelp
--sdk sdkhelp
--toolchain toolchainhelp
--sanitize sanitizeTurn on runtime checks for erroneous behavior.help
--enable-parseable-module-interfaceshelp
-j, --jobs jobsThe number of jobs to spawn in parallel during the build process.help
--use-integrated-swift-driverhelp
--explicit-target-dependency-import-check explicit-target-dependency-import-checkCheck that targets only import their explicitly declared dependencies.help
--build-system build-systemSpecify the build system to use.help
-debug-info-format debug-info-formatThe Debug Information Format to use.help
--experimental-enable-codesize-profileGenerate SIL, LLVM IR, and optimization record files for code size profiling.help
--experimental-codesize-profile-output-dir experimental-codesize-profile-output-dirDirectory to store code size profiling output files.help
--disable-local-rpathDisable adding $ORIGIN/@loader_path to the rpath by default.help
--traits traitsEnable the specified traits of the package.help
--enable-all-traitsEnable all traits of the package.help
--disable-default-traitsDisable all default traits of the package.help
--skip-buildSkip building the test target.help
--attachments-path attachments-pathPath where attachments should be written (Swift Testing only).help
--num-workers num-workersThe number of tests to execute in parallel.help
--maximum-repetitions maximum-repetitionsThe maximum number of times each test will repeat.help
--repeat-until repeat-untilThe condition upon which to stop repeating a test.help
-l, --list-testsList test methods in specifier format.help
--show-codecov-path, --show-code-coverage-path, --show-coverage-pathPrint the path of the exported code coverage JSON file.help
-s, --specifier specifierhelp
--filter filterRun test cases that match a regular expression, for example, <test-target>.<test-case> or <test-target>.<test-case>/<test>.help
--skip skipSkip test cases that match a regular expression.help
--xunit-output xunit-outputThe path where the test command generates the xUnit XML.help
--debuggerLaunch the tests in a debugger session.help
--versionShow the version.help
-h, -help, --helpShow help information.help

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.