Hspec: Haskell Testing Framework Review
hspec.github.io · checked 9 Oct 2026
Free Haskell software for readable specifications, expectations, and optional test discovery.
How it plugs in
Signal on Unit Testing Frameworks6.2#21 of 32
Hspec is a free, MIT-licensed testing framework for Haskell on Linux. Its nested `describe` and `it` blocks organize cases, while expectations cover equality, predicates, and exceptions; QuickCheck properties can also serve as examples. SmallCheck and HUnit integrations, `hspec-discover`, and configurable runner controls round out its testing workflow.

Review
In a line
Hspec is a testing framework for Haskell. Linux is the listed platform, and Hackage distributes the package as Cabal source.
What it does
Tests can be grouped hierarchically with `describe` and `it`, and expectations cover equal values, predicates, and exceptions.
QuickCheck properties may appear as test examples. The runner can filter or omit examples, shuffle execution, stop on failure, repeat failed cases, and select a formatter.
How it connects
QuickCheck, SmallCheck, and HUnit are among Hspec's integrations. Existing HUnit suites can run there, while HUnit assertions can appear in Hspec specifications.
The `hspec-discover` preprocessor generates test-driver boilerplate from spec files. Its automatic convention requires filenames ending in `Spec.hs` and a top-level `spec` binding.
Hspec reads options from `~/.hspec`, a project `.hspec`, environment variables, or command-line arguments, with command-line settings taking priority. The manual documents passing options through Cabal, Stack, and GHCi. Specs marked `parallel` can use multiple CPUs with the documented threaded runtime setup.
The package is listed under the MIT license.
Good fit
Hspec suits Haskell developers who want tests arranged in readable groups and examples. It is useful when a project needs ordinary expectations alongside property-based checks.
It also fits projects that already have HUnit tests or use QuickCheck, SmallCheck, Cabal, Stack, or GHCi.
Watch for
Hspec is listed for Linux, so check your target platform before adopting it. Automatic discovery follows a fixed naming convention: spec files must end in `Spec.hs` and provide a top-level `spec` binding.
Parallel runs need the documented -threaded link option and +RTS -N -RTS runtime arguments. Projects that do not follow this setup may prefer ordinary serial execution.
Pricing
Hspec is free. There is a free plan and no free trial because the package itself has no paid plan listed.
Verdict
Choose Hspec if you write Haskell on Linux and want a structured specification style with built-in expectations. Its QuickCheck, SmallCheck, and HUnit connections make it practical for mixed testing approaches, including older HUnit suites.
Look elsewhere if you need a different operating system, or if your team cannot follow Hspec's discovery naming rules or threaded setup for parallel specs.
Our take
Hspec is a sensible pick for Haskell projects that value readable test organization and need several testing styles in one runner. Its free MIT-licensed package, HUnit compatibility, and QuickCheck support lower the barrier for both new and existing suites. The main checks before adoption are platform support and workflow fit: automatic discovery depends on specific file and binding names, while parallel execution needs extra runtime settings. Teams working on Linux and comfortable with those conventions can use Hspec without a subscription.
- Free package under the MIT license
- Nested `describe` and `it` blocks for readable test organization
- Integrations with QuickCheck, SmallCheck, and HUnit
- Automatic discovery for `Spec.hs` files
- Filtering, randomized order, reruns, and formatter choices
- Listed platform support is Linux
- Discovery requires `Spec.hs` files and a top-level `spec` binding
- Parallel specs need threaded linking and RTS options
- No free trial is offered, though the plan is free
- Pick it ifHaskell developers on Linux; Projects combining example tests and QuickCheck properties; Teams with existing HUnit suites
- Skip it ifYou need a platform other than Linux; Your project cannot follow Hspec's discovery or parallel-run conventions
Pricing
Hspec has one free plan, with no paid tier or free trial listed.
- HspecHaskell testing framework · source package available on HackageFree
As hspec.github.io lists them, checked 9 Oct 2026.
Questions
What is Hspec?
Hspec is a Haskell testing framework that structures cases with nested `describe` and `it` blocks.
Which systems does Hspec run on?
The listed platform is Linux.
Can Hspec use QuickCheck?
Yes. QuickCheck integrates with Hspec, and its properties can run as test examples.
Can I run HUnit tests in Hspec?
Yes. Existing HUnit suites can run in Hspec, and HUnit assertions are usable in its specifications.
How does automatic test discovery work?
`hspec-discover` creates test-driver boilerplate by scanning spec files. Those files must end in `Spec.hs` and expose a top-level `spec` binding.
Can Hspec run tests in parallel?
Specs marked `parallel` can use multiple CPUs when linked with `-threaded` and run with `+RTS -N -RTS`.
How much does Hspec cost?
Hspec is free. Its package is available as a Cabal source package on Hackage, and no free trial is listed.