HTF- The Haskell Test Framework

Safe HaskellNone




This module defines types (and small auxiliary functions) for organizing tests, for configuring the execution of tests, and for representing and reporting their results.


Organizing tests

type TestID = String Source #

Type for naming tests.

data Test Source #

Abstract type for tests and their results.

data TestSuite Source #

Abstract type for test suites and their results.

data TestPath Source #

A type denoting the hierarchical name of a test.

data GenFlatTest a Source #

Generic type for flattened tests and their results.




type FlatTest = GenFlatTest (WithTestOptions Assertion) Source #

Flattened representation of tests.

type TestFilter = FlatTest -> Bool Source #

A filter is a predicate on FlatTest. If the predicate is True, the flat test is run.

testPathToList :: TestPath -> [Maybe TestID] Source #

Splits a TestPath into a list of test identifiers.

flatName :: TestPath -> String Source #

Creates a string representation from a TestPath.

finalName :: TestPath -> String Source #

Returns the final name of a TestPath

prefixName :: TestPath -> String Source #

Returns the name of the prefix of a test path. The prefix is everything except the last element.

withOptions :: (TestOptions -> TestOptions) -> a -> WithTestOptions a Source #

Shortcut for constructing a WithTestOptions value.

historyKey :: GenFlatTest a -> Text Source #

Key of a flat test for the history database.

Executing tests

type TR = RWST TestConfig () TestState IO Source #

The TR (test runner) monad.

data TestState Source #

The state type for the TR monad.




initTestState :: TestState Source #

The initial test state.

data TestConfig Source #

Configuration of test execution.




data TestOutput Source #

The destination of progress and result messages from HTF.


TestOutputHandle Handle Bool

Output goes to Handle, boolean flag indicates whether the handle should be closed at the end.

TestOutputSplitted FilePath

Output goes to files whose names are derived from FilePath by appending a number to it. Numbering starts at zero.

Reporting results

type ReportAllTests = [FlatTest] -> TR () Source #

Reports the IDs of all tests available.

type ReportGlobalStart = [FlatTest] -> TR () Source #

Signals that test execution is about to start.

type ReportTestStart = FlatTest -> TR () Source #

Reports the start of a single test.

type ReportTestResult = FlatTestResult -> TR () Source #

Reports the result of a single test.

type ReportGlobalResults = ReportGlobalResultsArg -> TR () Source #

Reports the overall results of all tests.

data TestReporter Source #

A TestReporter provides hooks to customize the output of HTF.




type CallStack = [(Maybe String, Location)] Source #

A type for call-stacks

Specifying results.

type FlatTestResult = GenFlatTest RunResult Source #

The result of running a FlatTest

type Milliseconds = Int Source #

A type synonym for time in milliseconds.

data RunResult Source #

The result of a test run.