On this page:
13.1 Test Configuration by Submodule
13.2 Test Configuration by "info.rkt"
13.3 Responsible-Party and Varying-Output Logging

13 raco test: Run tests

The raco test command requires and runs the (by default) test submodule associated with each path given on the command line. Command-line flag can control which submodule is run, whether to run the main module if no submodule is found, and whether to run tests directly, in separate processes (the default), or in separate places. The current directory is set to a test file’s directory before running the file.

When an argument path refers to a directory, the tool recursively discovers and runs all files within the directory that end in ".rkt", end in ".scrbl", or have a (possibly empty) list of arguments-line provided by test-command-line-arguments in an "info.rkt" file.

A test is counted as failing if it logs a failing test code via test-log!, causes Racket to exit with a non-zero exit code, or (when -e or --check-stderr is specified) if it produces output on the error port.

The raco test command accepts several flags:

13.1 Test Configuration by Submodule

When raco test runs a test in a submodule, a config sub-submodule can provide additional configuration for running the test. The config sub-submodule should use the info module language to define the following identifiers:

13.2 Test Configuration by "info.rkt"

Submodule-based test configuration is preferred (see Test Configuration by Submodule). In particular, to prevent raco test from running a particular file, normally the file should contain a submodule that takes no action.

In some cases, however, adding a submodule is inconvenient or impossible (e.g., because the file will not always compile). Thus, raco test also consults any "info.rkt" file in the candidate test file’s directory. In the case of a file within a collection, "info.rkt" files from any enclosing collection directories are also consulted for test-omit-paths. Finally, for a file within a package, the package’s "info.rkt" is consulted for pkg-authors to set the default responsible parties (see Responsible-Party and Varying-Output Logging) for all files in the package.

The following "info.rkt" fields are recognized:

13.3 Responsible-Party and Varying-Output Logging

When a test has a declared responsible party, then the test’s output is prefixed with a

  raco test:which @(test-responsible 'responsible)

line, where which is a space followed by an exact non-negative number indicating a parallel task when parallelism is enabled (or empty otherwise), and responsible is a string, symbol, or list datum.

When a test’s output (as written to stdout) is expected to vary across runs—aside from varying output that has the same form as produced by timethen it should be declared as varying. In that case, the test’s output is prefixed with a

  raco test:which @(test-random #t)

line.