HTF-0.13.1.0: The Haskell Test Framework

Safe HaskellNone
LanguageHaskell2010

Test.Framework.TestTypes

Contents

Description

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

Synopsis

Organizing tests

type TestID = String #

Type for naming tests.

data Test #

Abstract type for tests and their results.

Instances

class AssertionWithTestOptions a where #

A type class for an assertion with TestOptions.

Minimal complete definition

testOptions, assertion

data TestSuite #

Abstract type for test suites and their results.

Instances

data TestSort #

Type for distinguishing different sorts of tests.

data TestPath #

A type denoting the hierarchical name of a test.

Instances

data GenFlatTest a #

Generic type for flattened tests and their results.

Constructors

FlatTest 

Fields

type FlatTest = GenFlatTest (WithTestOptions Assertion) #

Flattened representation of tests.

type TestFilter = FlatTest -> Bool #

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

testPathToList :: TestPath -> [Maybe TestID] #

Splits a TestPath into a list of test identifiers.

flatName :: TestPath -> String #

Creates a string representation from a TestPath.

finalName :: TestPath -> String #

Returns the final name of a TestPath

prefixName :: TestPath -> String #

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

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

Shortcut for constructing a WithTestOptions value.

historyKey :: GenFlatTest a -> Text #

Key of a flat test for the history database.

Executing tests

type TR = RWST TestConfig () TestState IO #

The TR (test runner) monad.

data TestState #

The state type for the TR monad.

Constructors

TestState 

Fields

initTestState :: TestState #

The initial test state.

data TestConfig #

Configuration of test execution.

Constructors

TestConfig 

Fields

data TestOutput #

The destination of progress and result messages from HTF.

Constructors

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 () #

Reports the IDs of all tests available.

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

Signals that test execution is about to start.

type ReportTestStart = FlatTest -> TR () #

Reports the start of a single test.

type ReportTestResult = FlatTestResult -> TR () #

Reports the result of a single test.

type ReportGlobalResults = ReportGlobalResultsArg -> TR () #

Reports the overall results of all tests.

data TestReporter #

A TestReporter provides hooks to customize the output of HTF.

Constructors

TestReporter 

Fields

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

A type for call-stacks

Specifying results.

type FlatTestResult = GenFlatTest RunResult #

The result of running a FlatTest

type Milliseconds = Int #

A type synonym for time in milliseconds.

data RunResult #

The result of a test run.

Constructors

RunResult 

Fields