tasty-bdd: BDD tests language and tasty provider

[ bsd3, library, test ] [ Propose Tags ] [ Report a vulnerability ]

A typed GivenWhenThen language and a free-monad interface for Tasty, with ordered setup, reverse-order teardown, recursive test decorators and structural equality diagnostics.


[Skip to Readme]

Flags

Manual Flags

NameDescriptionDefault
werror

Treat compiler warnings as errors during development and CI

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.2.0.0
Change log CHANGELOG.md
Dependencies base (>=4.7 && <5), exceptions (>=0.10 && <0.11), free (>=5 && <6), microlens (>=0.4 && <0.5), mtl (>=2.2 && <2.4), tagged (>=0.8 && <0.9), tasty (>=1.2 && <1.6), tasty-fail-fast (>=0.0.3 && <0.1), temporary (>=1.3 && <1.4), text (>=1.2 && <2.2), tree-diff (>=0.2 && <0.5) [details]
Tested with ghc ==9.12.3
License BSD-3-Clause
Copyright 2017 Paolo Veronelli
Author Paolo Veronelli, Pavlo Kerestey
Maintainer paolo.veronelli@gmail.com
Uploaded by PaoloVeronelli at 2026-10-01T21:06:36Z
Category Test
Home page https://github.com/lambdasistemi/tasty-bdd
Bug tracker https://github.com/lambdasistemi/tasty-bdd/issues
Source repo head: git clone https://github.com/lambdasistemi/tasty-bdd
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 461 total (9 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for tasty-bdd-0.2.0.0

[back to package description]

tasty-bdd

Typed Given/When/Then scenarios for Haskell's Tasty test framework.

User stories: write readable test scenarios

As a test author, you can express setup, an action and assertions using constructors or do notation. Successful assertions pass the Tasty test; failed equality assertions show structural differences.

flowchart LR
  Given -->|prepare input| When
  When -->|pass result| Then
  Then -->|report outcome| Tasty
import Test.BDD.LanguageFree (given, then_, when_)
import Test.Tasty (defaultMain)
import Test.Tasty.Bdd ((@?=), testBehaviorF)

main :: IO ()
main = defaultMain $ testBehaviorF id "addition" $ do
    initial <- given $ pure (40 :: Int)
    when_ (pure $ initial + 2) $ then_ (@?= 42)

This example is compiled and run by the example test suite. See scenario examples and the execution model for setup, teardown and fail-fast behavior.

Build and contribute

nix develop --accept-flake-config
just build
just unit
just ci

The locked flake uses GHC 9.12.3 on x86_64 Linux. nix flake check --accept-flake-config runs the packaged build, tests, lint, formatting and documentation checks. Other systems have not been verified. Read the published documentation. See development and the Spec Kit plan.

Published package

Hackage carries 0.1.0.0, 0.1.0.1, 0.1.0.2 and 0.2.0.0. GitLab history through January 2025 is retained here, including the source published in 0.1.0.1. Version 0.1.0.2 was uploaded with documentation on 2026-10-01 and is tagged v0.1.0.2. Version 0.2.0.0, uploaded on 2026-10-01 and tagged v0.2.0.0, renames the when lens to whenAction and releases resources when a scenario fails by exception; see the changelog. See how releases are prepared and published.

Licensed under BSD-3-Clause.