| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Test.Framework.TestManager
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
- module Test.Framework.TestTypes
- htfMain :: TestableHTF t => t -> IO ()
- htfMainWithArgs :: TestableHTF t => [String] -> t -> IO ()
- runTest :: TestableHTF t => t -> IO ExitCode
- runTest' :: TestableHTF t => t -> IO (IO (), ExitCode)
- runTestWithArgs :: TestableHTF t => [String] -> t -> IO ExitCode
- runTestWithArgs' :: TestableHTF t => [String] -> t -> IO (IO (), ExitCode)
- runTestWithOptions :: TestableHTF t => CmdlineOptions -> t -> IO ExitCode
- runTestWithOptions' :: TestableHTF t => CmdlineOptions -> t -> IO (IO (), ExitCode)
- runTestWithConfig :: TestableHTF t => TestConfig -> t -> IO (ExitCode, TestHistory)
- runTestWithConfig' :: TestableHTF t => TestConfig -> t -> IO (IO (), ExitCode, TestHistory)
- class TestableHTF t
- class WrappableHTF t where
- makeQuickCheckTest :: TestID -> Location -> Assertion -> Test
- makeUnitTest :: AssertionWithTestOptions a => TestID -> Location -> a -> Test
- makeBlackBoxTest :: TestID -> Assertion -> Test
- makeTestSuite :: TestID -> [Test] -> TestSuite
- makeAnonTestSuite :: [Test] -> TestSuite
- addToTestSuite :: TestSuite -> [Test] -> TestSuite
- testSuiteAsTest :: TestSuite -> Test
- flattenTest :: Test -> [FlatTest]
- wrappableTests :: [(String, IO ())]
Re-exports
module Test.Framework.TestTypes
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.
Arguments
| :: TestableHTF t | |
| => t | Testable thing |
| -> IO ExitCode | See |
Run something testable using the defaultCmdlineOptions.
Arguments
| :: TestableHTF t | |
| => t | Testable thing |
| -> IO (IO (), ExitCode) |
|
Run something testable using the defaultCmdlineOptions.
Arguments
| :: TestableHTF t | |
| => [String] | Commandline arguments |
| -> t | Testable thing |
| -> IO ExitCode | See |
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.
Arguments
| :: TestableHTF t | |
| => [String] | Commandline arguments |
| -> t | Testable thing |
| -> IO (IO (), ExitCode) |
|
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 Test Source # | |
Defined in Test.Framework.TestManager | |
| TestableHTF TestSuite Source # | |
Defined in Test.Framework.TestManager | |
| TestableHTF (IO a) Source # | |
Defined in Test.Framework.TestManager | |
| TestableHTF t => TestableHTF [t] Source # | |
Defined in Test.Framework.TestManager | |
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
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.
makeAnonTestSuite :: [Test] -> TestSuite Source #
flattenTest :: Test -> [FlatTest] Source #
Tests (for internal use)
wrappableTests :: [(String, IO ())] Source #