HORIZON HASKELLDocslts/ghc-9.14.x7a6c33e2026-10-12Search packagesCtrl K
Theme: |

GHC 9.14.1 · lts/ghc-9.14.x · 7a6c33e · 2026-10-12

  • Packagesandwich-0.3.1.0
  • Exports31
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceSandwich.hs

Sandwich is a test framework for Haskell. See the documentation for details and usage examples.

Running tests with command line args

These functions will read command line arguments when setting up your tests. These flags allow you filter the test tree, configure formatters, and pass your own custom options.

# Run using the terminal UI formatter, webdriver headless mode, filtering to nodes matching "Login"
stack run my-tests -- --tui --headless -f Login

Running tests

Basic nodes

The basic building blocks of tests.

Context manager nodes

For introducing new contexts into tests and doing setup/teardown.

Parallel nodes

Timing

For timing actions within your tests. Test tree nodes are timed by default.

valuetimeActionByProfile
  1. :: (MonadUnliftIO m, MonadReader context m, HasTestTimer context)
  2. => ProfileName

    Profile name

  3. -> EventName

    Event name

  4. -> m a
  5. -> m a

Time a given action with a given profile name and event name. Use when you want to manually specify the profile name.

valuetimeAction
  1. :: (MonadUnliftIO m, HasBaseContextMonad context m, HasTestTimer context)
  2. => EventName

    Event name

  3. -> m a
  4. -> m a

Time a given action with a given event name. This name will be the "stack frame" of the given action in the profiling results. This function will use the current timing profile name.

Managed async

If you want to run asyncs within your tests, we can help keep track of them and make sure they get cleaned up.

Exports