HUnit-Plus-0.3.0: A test framework building on HUnit.

Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.HUnitPlus.Reporting

Description

Reporting functionality for HUnit-Plus. Test reporting is now defined using a set of events. A Reporter contains handlers for these events, which have access to and update a Reporter-defined state value. The handlers in a Reporter are called at appropriate points during text execution.

This module also contains a basic defaultReporter that simply passes the state value through unchanged. It also defines combinedReporter, which facilitates "gluing" two Reporters together.

Synopsis

Documentation

data Node Source

Composed into Paths.

Constructors

Label String 

Instances

data State Source

Keeps track of the remaining tests and the results of the performed tests. As each test is performed, the path is removed and the counts are updated as appropriate.

Constructors

State 

Fields

stName :: !String

The name of the case or suite currently being run.

stPath :: !Path

The path to the test case currently being run.

stCounts :: !Counts

The current test statistics.

stOptions :: !(Map String String)

The current option values.

stOptionDescs :: ![OptionDescr]

The current option descriptions we know about.

Instances

data Counts Source

A record that holds the results of tests that have been performed up until this point.

Constructors

Counts 

Fields

cCases :: !Word

Number of total cases.

cTried :: !Word

Number of cases tried.

cErrors :: !Word

Number of cases that failed with an error.

cFailures :: !Word

Number of cases that failed.

cSkipped :: !Word

Number of cases that were skipped.

cAsserts :: !Word

Total number of assertions checked.

data Reporter us Source

Report generator. This record type contains a number of functions that are called at various points throughout a test run.

Constructors

Reporter 

Fields

reporterStart :: IO us

Called at the beginning of a test run.

reporterEnd :: Double -> Counts -> us -> IO us

Called at the end of a test run.

reporterStartSuite :: State -> us -> IO us

Called at the start of a test suite run.

reporterEndSuite :: Double -> State -> us -> IO us

Called at the end of a test suite run.

reporterStartCase :: State -> us -> IO us

Called at the start of a test case run.

reporterCaseProgress :: String -> State -> us -> IO us

Called to report progress of a test case run.

reporterEndCase :: Double -> State -> us -> IO us

Called at the end of a test case run.

reporterSkipCase :: State -> us -> IO us

Called when skipping a test case.

reporterSystemOut :: String -> State -> us -> IO us

Called to report output printed to the system output stream.

reporterSystemErr :: String -> State -> us -> IO us

Called to report output printed to the system error stream.

reporterFailure :: String -> State -> us -> IO us

Called when a test fails.

reporterError :: String -> State -> us -> IO us

Called when a test reports an error.

type Path = [Node] Source

Uniquely describes the location of a test within a test hierarchy. Node order is from test case to root.

zeroCounts :: Counts Source

A Counts with all zero counts.

showPath :: Path -> String Source

Converts a test case path to a string, separating adjacent elements by a dot ('.'). An element of the path is quoted (as with show) when there is potential ambiguity.

defaultReporter :: Reporter a Source

A reporter containing default actions, which are to do nothing and return the user state unmodified.

combinedReporter :: Reporter us1 -> Reporter us2 -> Reporter (us1, us2) Source

Combines two Reporters into a single reporter that calls both.