liveBook · Manning

Evaluation suite

As explained in Learn Haskell by Example

A test suite is a collection of automated tests executed together to evaluate a program or component.

A test suite is a collection of automated tests executed together to evaluate a program or component. In a Stack project, test code lives under test, commonly starting with Spec.hs, and runs with stack test. section 9.5.3

A practical Haskell test suite connects several pieces:

  • Define properties with names beginning with prop_, allowing QuickCheck's quickCheckAll to discover and run them. section 9.5.3
  • Group properties into modules such as SuiteOne and SuiteTwo, each exporting a runTests action that returns whether its tests succeeded. section 9.5.3
  • Combine suite results in Main and return exitSuccess only when every suite succeeds; otherwise return exitFailure. section 9.5.3
  • Customize generated tests with QuickCheck controls such as withMaxSuccess, noShrinking, and cover. section 9.5.3

A failing property makes Stack fail

Suppose one suite contains prop_true, which passes, and prop_false, which always returns False. Running stack test reports the successful properties, identifies the falsifying case for prop_false, and ends with Test suite failure and ExitFailure 1.

How Learn Haskell by Example covers it

How deep it goes
Explains project placement, property discovery, suite aggregation, exit codes, and behavior modifiers, but not test framework internals beyond Template Haskell.
Examples
Uses multiple suite modules, discovered prop_ functions, controlled random tests, Stack commands, and console output showing success or failure.
What it assumes
Assumes a Stack project and basic Haskell modules, while introducing QuickCheck properties, random testing, and Template Haskell-based discovery.
What you can do after
Operate/configure Stack test runs, assemble multiple QuickCheck suites, and diagnose failures through exit codes and console reports.
How it connects
Connects test suites with Stack, QuickCheck, property testing, Template Haskell, and process exit codes.

Also explained in

Compare how 11 books explain evaluation suite →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Haskell by Example. The section links point to the parts of the book it draws on.