test-framework-0.8.1.1: Framework for running and organising tests, with HUnit and QuickCheck support

Safe Haskell | None
Language | Haskell98

Test.Framework

Description

A generic test framework for all types of Haskell test.

For an example of how to use test-framework, please see http://github.com/batterseapower/test-framework/raw/master/example/Test/Framework/Example.lhs

Synopsis

- class (Show i, Show r) => TestResultlike i r | r -> i where
- class TestResultlike i r => Testlike i r t | t -> i r, r -> i where
- type TestName = String
- type TestTypeName = String
- data Test
  - = (Testlike i r t, Typeable t) => Test TestName t
  - | TestGroup TestName [Test]
  - | PlusTestOptions TestOptions Test
  - | BuildTestBracketed (IO (Test, IO ()))
- testGroup :: TestName -> [Test] -> Test
- plusTestOptions :: TestOptions -> Test -> Test
- buildTest :: IO Test -> Test
- buildTestBracketed :: IO (Test, IO ()) -> Test
- data MutuallyExcluded t = ME (MVar ()) t
- mutuallyExclusive :: Test -> Test
- module Test.Framework.Options
- module Test.Framework.Runners.Console
- module Test.Framework.Runners.Options
- module Test.Framework.Seed

# Documentation

class (Show i, Show r) => TestResultlike i r | r -> i where #

Something like the result of a test: works in concert with `Testlike`. The type parameters are the type that is used for progress reports and the type of the final output of the test respectively.

Minimal complete definition

testSucceeded

Methods

testSucceeded :: r -> Bool #

class TestResultlike i r => Testlike i r t | t -> i r, r -> i where #

Something test-like in its behaviour. The type parameters are the type that is used for progress reports, the type of the final output of the test and the data type encapsulating the whole potential to do a test respectively.

Minimal complete definition

runTest, testTypeName

Methods

runTest :: CompleteTestOptions -> t -> IO (i :~> r, IO ()) #

testTypeName :: t -> TestTypeName #

Instances

Testlike i r t => Testlike i r (MutuallyExcluded t) # |
Methods runTest :: CompleteTestOptions -> MutuallyExcluded t -> IO (i :~> r, IO ()) # testTypeName :: MutuallyExcluded t -> TestTypeName #

type TestName = String #

Test names or descriptions. These are shown to the user

type TestTypeName = String #

The name of a type of test, such as Properties or "Test Cases". Tests of types of the same names will be grouped together in the test run summary.

data Test #

Main test data type: builds up a list of tests to be run. Users should use the utility functions in e.g. the test-framework-hunit and test-framework-quickcheck packages to create instances of `Test`, and then build them up into testsuites by using `testGroup` and lists.

For an example of how to use test-framework, please see http://github.com/batterseapower/test-framework/raw/master/example/Test/Framework/Example.lhs

Constructors

(Testlike i r t, Typeable t) => Test TestName t | A single test of some particular type
TestGroup TestName [Test] | Assemble a number of tests into a cohesive group
PlusTestOptions TestOptions Test | Add some options to child tests
BuildTestBracketed (IO (Test, IO ())) | Convenience for creating tests from an `IO` action, with cleanup

testGroup :: TestName -> [Test] -> Test #

Assemble a number of tests into a cohesive group

plusTestOptions :: TestOptions -> Test -> Test #

Add some options to child tests

buildTest :: IO Test -> Test #

Convenience for creating tests from an `IO` action

buildTestBracketed :: IO (Test, IO ()) -> Test #

Convenience for creating tests from an `IO` action, with a cleanup handler for when tests are finished

data MutuallyExcluded t #

Constructors

ME (MVar ()) t |

Instances

Testlike i r t => Testlike i r (MutuallyExcluded t) # |
Methods runTest :: CompleteTestOptions -> MutuallyExcluded t -> IO (i :~> r, IO ()) # testTypeName :: MutuallyExcluded t -> TestTypeName #

mutuallyExclusive :: Test -> Test #

Mark all tests in this portion of the tree as mutually exclusive, so only one runs at a time

module Test.Framework.Options

module Test.Framework.Runners.Console

module Test.Framework.Runners.Options

module Test.Framework.Seed