Test.Tasty.Providers

tasty-1.5.3: Modern and extensible testing framework

Safe Haskell | None
Language | Haskell2010

Test.Tasty.Providers

Description

API for test providers.

Since: 0.1

Synopsis

- class Typeable t => IsTest t where
  - run :: OptionSet -> t -> (Progress -> IO ()) -> IO Result
  - testOptions :: Tagged t [OptionDescription]
- testPassed :: String -> Result
- testFailed :: String -> Result
- testFailedDetails :: String -> ResultDetailsPrinter -> Result
- data Result
- data Progress = Progress {
  - progressText :: String
  - progressPercent :: Float
  }
- type TestName = String
- data TestTree
- singleTest :: IsTest t => TestName -> t -> TestTree

# Documentation

class Typeable t => IsTest t where #

The interface to be implemented by a test provider.

The type `t` is the concrete representation of the test which is used by the provider.

Since: 0.1

Methods

run #

Arguments

:: OptionSet | options
-> t | the test to run
-> (Progress -> IO ()) | a callback to report progress.
-> IO Result |

Run the test

This method should cleanly catch any exceptions in the code to test, and return them as part of the `Result`, see `FailureReason` for an explanation. It is ok for `run` to raise an exception if there is a problem with the test suite code itself (for example, if a file that should contain example data or expected output is not found).

testOptions :: Tagged t [OptionDescription] #

The list of options that affect execution of tests of this type

testPassed #

Arguments

:: String | description (may be empty)
-> Result |

`Result` of a passed test.

Since: 0.8

testFailed #

Arguments

:: String | description
-> Result |

`Result` of a failed test.

Since: 0.8

testFailedDetails #

Arguments

:: String | description
-> ResultDetailsPrinter | details printer
-> Result |

`Result` of a failed test with custom details printer

Since: 1.3.1

data Result #

A test result.

Since: 0.1

#### Instances

Instances details

Show Result # | Since: 1.2
Instance details Defined in Test.Tasty.Core Methods showsPrec :: Int -> Result -> ShowS # show :: Result -> String # showList :: [Result] -> ShowS #

data Progress #

Test progress information.

This may be used by a runner to provide some feedback to the user while a long-running test is executing.

Since: 0.1

Constructors

Progress |
Fields progressText :: String textual information about the test's progress progressPercent :: Float `progressPercent` should be a value between 0 and 1. If it's impossible to compute the estimate, use 0.

#### Instances

Instances details

Show Progress # | Since: 1.2
Instance details Defined in Test.Tasty.Core Methods showsPrec :: Int -> Progress -> ShowS # show :: Progress -> String # showList :: [Progress] -> ShowS #
Eq Progress # | Since: 1.5
Instance details Defined in Test.Tasty.Core Methods (==) :: Progress -> Progress -> Bool # (/=) :: Progress -> Progress -> Bool #

type TestName = String #

The name of a test or a group of tests.

Since: 0.1

data TestTree #

The main data structure defining a test suite.

It consists of individual test cases and properties, organized in named groups which form a tree-like hierarchy.

There is no generic way to create a test case. Instead, every test provider (tasty-hunit, tasty-smallcheck etc.) provides a function to turn a test case into a `TestTree`.

Groups can be created using `testGroup`.

Since: 0.1

singleTest :: IsTest t => TestName -> t -> TestTree #

Convert a test to a leaf of the `TestTree`.

Since: 0.1