HTF-0.14.0.3: The Haskell Test Framework

Safe HaskellNone
LanguageHaskell2010

Test.Framework.TestManager

Contents

Description

This module defines function for running a set of tests. Furthermore, it provides functionality for organzing tests into a hierarchical structure. This functionality is mainly used internally in the code generated by the hftpp pre-processor.

Synopsis

Re-exports

Running tests

htfMain :: TestableHTF t => t -> IO () Source #

Runs something testable by parsing the commandline arguments as test options (using parseTestArgs). Exits with the exit code returned by runTestWithArgs. This function is the main entry point for running tests.

htfMainWithArgs :: TestableHTF t => [String] -> t -> IO () Source #

Runs something testable by parsing the commandline arguments as test options (using parseTestArgs). Exits with the exit code returned by runTestWithArgs.

runTest Source #

Arguments

:: TestableHTF t 
=> t

Testable thing

-> IO ExitCode

See runTestWithOptions for a specification of the ExitCode result

Run something testable using the defaultCmdlineOptions.

runTest' Source #

Arguments

:: TestableHTF t 
=> t

Testable thing

-> IO (IO (), ExitCode)

IO action for printing the overall test results, and exit code for the test run. See runTestWithOptions for a specification of the ExitCode result

Run something testable using the defaultCmdlineOptions.

runTestWithArgs Source #

Arguments

:: TestableHTF t 
=> [String]

Commandline arguments

-> t

Testable thing

-> IO ExitCode

See runTestWithConfig for a specification of the ExitCode result.

Run something testable, parse the CmdlineOptions from the given commandline arguments. Does not print the overall test results but returns an IO action for doing so.

runTestWithArgs' Source #

Arguments

:: TestableHTF t 
=> [String]

Commandline arguments

-> t

Testable thing

-> IO (IO (), ExitCode)

IO action for printing the overall test results, and exit code for the test run. See runTestWithConfig for a specification of the ExitCode result.

Run something testable, parse the CmdlineOptions from the given commandline arguments.

runTestWithOptions :: TestableHTF t => CmdlineOptions -> t -> IO ExitCode Source #

Runs something testable with the given CmdlineOptions. See runTestWithConfig for a specification of the ExitCode result.

runTestWithOptions' :: TestableHTF t => CmdlineOptions -> t -> IO (IO (), ExitCode) Source #

Runs something testable with the given CmdlineOptions. Does not print the overall test results but returns an IO action for doing so. See runTestWithConfig for a specification of the ExitCode result.

runTestWithConfig :: TestableHTF t => TestConfig -> t -> IO (ExitCode, TestHistory) Source #

Runs something testable with the given TestConfig. The result is ExitSuccess if all tests were executed successfully, ExitFailure otherwise. In the latter case, an error code of 1 indicates that failures but no errors occurred, otherwise the error code 2 is used.

A test is successful if the test terminates and no assertion fails. A test is said to fail if an assertion fails but no other error occur.

runTestWithConfig' :: TestableHTF t => TestConfig -> t -> IO (IO (), ExitCode, TestHistory) Source #

Runs something testable with the given TestConfig. Does not print the overall test results but returns an IO action for doing so. See runTestWithConfig for a specification of the ExitCode result.

Organzing tests

class TestableHTF t Source #

A type class for things that can be run as tests. Mainly used internally.

Minimal complete definition

flatten

Instances
TestableHTF TestSuite Source # 
Instance details

Defined in Test.Framework.TestManager

Methods

flatten :: TestSuite -> [FlatTest]

TestableHTF Test Source # 
Instance details

Defined in Test.Framework.TestManager

Methods

flatten :: Test -> [FlatTest]

TestableHTF t => TestableHTF [t] Source # 
Instance details

Defined in Test.Framework.TestManager

Methods

flatten :: [t] -> [FlatTest]

TestableHTF (IO a) Source # 
Instance details

Defined in Test.Framework.TestManager

Methods

flatten :: IO a -> [FlatTest]

class WrappableHTF t where Source #

Kind of specialised Functor type class for tests, which allows you to modify the Assertions of the WrappableHTF-thing without changing any test code.

E.g. if you want to add timeouts to all tests of a module, you could write:

addTimeout test = timeout 100 test >>= assertJustVerbose "Timeout exceeded"
testsWithTimeouts = wrap addTimeout htf_thisModulesTests

Methods

wrap :: (Assertion -> Assertion) -> t -> t Source #

Instances
WrappableHTF TestSuite Source # 
Instance details

Defined in Test.Framework.TestManager

WrappableHTF Test Source # 
Instance details

Defined in Test.Framework.TestManager

Methods

wrap :: (Assertion -> Assertion) -> Test -> Test Source #

makeQuickCheckTest :: TestID -> Location -> Assertion -> Test Source #

Construct a test where the given Assertion checks a quick check property. Mainly used internally by the htfpp preprocessor.

makeUnitTest :: AssertionWithTestOptions a => TestID -> Location -> a -> Test Source #

Construct a unit test from the given IO action. Mainly used internally by the htfpp preprocessor.

makeBlackBoxTest :: TestID -> Assertion -> Test Source #

Construct a black box test from the given Assertion. Mainly used internally.

makeTestSuite :: TestID -> [Test] -> TestSuite Source #

Create a named TestSuite from a list of Test values.

makeAnonTestSuite :: [Test] -> TestSuite Source #

Create an unnamed TestSuite from a list of Test values.

addToTestSuite :: TestSuite -> [Test] -> TestSuite Source #

Extend a TestSuite with a list of Test values

testSuiteAsTest :: TestSuite -> Test Source #

Turn a TestSuite into a proper Test.

Tests (for internal use)