EVERYTHING XIAOMI
Get listed
Hspec logo

Hspec

Hspec is a free testing framework for Haskell, distributed as a Cabal source package on Hackage under the MIT license.

Place
#15 of 32
Score
6.2
Hspec's website

What Hspec is

Hspec is a free testing framework for Haskell, distributed as a Cabal source package on Hackage under the MIT license. Its domain-specific language organizes tests with nested describe and it blocks, while expectations cover equality, predicates, and exceptions. Hspec can run QuickCheck properties as examples and integrates with QuickCheck, SmallCheck, and HUnit. Existing HUnit suites can run alongside ordinary specs, and HUnit assertions can be used within Hspec specifications. The hspec-discover preprocessor scans specification files and generates test-driver boilerplate; automatic discovery expects filenames ending in Spec.hs with a top-level spec binding. Runner controls support filtering or skipping examples, random order, fail-fast behavior, rerunning failures, and formatter selection. Configuration can come from user or project files, environment variables, or command-line options. Specs marked parallel can use multiple CPUs with the documented threaded runtime setup.

Good

  • Free Haskell testing framework
  • Readable nested describe and it DSL
  • QuickCheck, SmallCheck, and HUnit integration
  • Automatic test-driver generation
  • Filtering, randomization, and rerun controls

Watch out

  • Supports Haskell only
  • Parallel execution requires threaded runtime setup
  • Discovery depends on filename and binding conventions

Who it suits

It suits Haskell developers who want readable specification-style tests with property testing and compatibility with HUnit. Projects using Cabal, Stack, or GHCi can pass Hspec options through those tools.

Verdict

Hspec provides a structured Haskell testing DSL alongside property checks and established HUnit suites. Its discovery tool and configurable runner suit projects that want generated boilerplate and controllable test execution.

Plans and prices

From Hspec's own pricing page, checked 9 Oct 2001.

All about pricing
PlanPriceWhat it gives you
HspecFreeHaskell testing framework · source package available on Hackage

The facts

Each one read from Hspec's own pages, with the date it was checked.

What it does

Configuration
Hspec can read options from `~/.hspec`, a project `.hspec` file, environment variables, or command-line arguments, with command-line options taking highest precedence.checked 9 Oct 2001
Discovery
The `hspec-discover` tool can generate a test driver for automatically discovered spec files.checked 9 Oct 2001
Discovery convention
Hspec's automatic discovery expects spec files to end in `Spec.hs` and export a top-level `spec` binding.checked 8 Oct 2001
Distribution
The Hspec package is available as a Cabal source package from Hackage.checked 9 Oct 2001
Expectations
Hspec includes combinators for equality, predicates, and expected exceptions.checked 9 Oct 2001
HUnit compatibility
Hspec can run existing HUnit test suites, and HUnit assertions can be used in Hspec specs.checked 8 Oct 2001
Integrations
Hspec integrates with QuickCheck, SmallCheck, and HUnit.checked 8 Oct 2001
Legacy tests
Hspec can run existing HUnit tests alongside ordinary spec items through `fromHUnitTest` from `hspec-contrib`.checked 9 Oct 2001
License
The GitHub repository identifies the project license as MIT.checked 9 Oct 2001
Parallel execution
Specs can be marked for parallel execution to use multiple CPUs; the documented example links with `-threaded` and runs with `+RTS -N -RTS`.checked 9 Oct 2001
Property testing
Hspec can run QuickCheck properties as test examples.checked 8 Oct 2001
Purpose
Hspec is a testing framework for Haskell.checked 9 Oct 2001
Supported build tools
The manual documents passing Hspec options through Cabal, Stack, and GHCi.checked 9 Oct 2001
Test controls
Runner options include matching or skipping examples, randomizing execution order, failing fast, rerunning failures, and choosing a formatter.checked 9 Oct 2001
Test descriptions
Hspec provides a domain-specific language for organizing tests with nested `describe` and `it` blocks.checked 8 Oct 2001
Test discovery
The `hspec-discover` preprocessor scans for spec files and generates test driver boilerplate.checked 8 Oct 2001
Test DSL
Hspec provides a friendly DSL for defining and organizing tests with `describe` and `it`.checked 9 Oct 2001
Test integrations
Hspec integrates with QuickCheck, SmallCheck, and HUnit.checked 9 Oct 2001

The company

Maker and headquarters
The opened Hspec pages identify Hspec as a project but do not state a maker organization or headquarters.checked 9 Oct 2001

Alternatives to Hspec

All alternatives
  1. 1QUnit logo

    QUnit

    Free planAndroidiOSWebAPI
    7.3Free plan
  2. 2

    Kotest

    Free planAndroidiOSWebLinux
    6.6Free plan
  3. 3NUnit logo

    NUnit

    Free planAndroidiOSAPILinux
    6.6Free plan
  4. 4

    ScalaCheck

    Free planLinuxmacOSWindows
    6.6Free plan
  5. 5PHPUnit logo

    PHPUnit

    Free planLinuxmacOSSelf-hostedWindows
    6.5Free plan
  6. 6Vitest logo

    Vitest

    Free planWebLinuxmacOSWindows
    6.5Free plan