Safe Haskell | None |
---|
This module defines types (and small auxiliary functions) for organizing tests, for configuring the execution of tests, and for representing and reporting their results.
- type TestID = String
- data Test
- = BaseTest TestSort TestID (Maybe Location) TestOptions Assertion
- | CompoundTest TestSuite
- data TestOptions = TestOptions {
- to_parallel :: Bool
- class AssertionWithTestOptions a where
- testOptions :: a -> TestOptions
- assertion :: a -> Assertion
- data WithTestOptions a = WithTestOptions {
- wto_options :: TestOptions
- wto_payload :: a
- data TestSuite
- = TestSuite TestID [Test]
- | AnonTestSuite [Test]
- data TestSort
- data TestPath
- = TestPathBase TestID
- | TestPathCompound (Maybe TestID) TestPath
- data GenFlatTest a = FlatTest {
- ft_sort :: TestSort
- ft_path :: TestPath
- ft_location :: Maybe Location
- ft_payload :: a
- type FlatTest = GenFlatTest (WithTestOptions Assertion)
- type TestFilter = FlatTest -> Bool
- testPathToList :: TestPath -> [Maybe TestID]
- flatName :: TestPath -> String
- finalName :: TestPath -> String
- prefixName :: TestPath -> String
- defaultTestOptions :: TestOptions
- withOptions :: (TestOptions -> TestOptions) -> a -> WithTestOptions a
- historyKey :: GenFlatTest a -> Text
- type TR = RWST TestConfig () TestState IO
- data TestState = TestState {
- ts_results :: [FlatTestResult]
- ts_index :: Int
- initTestState :: TestState
- data TestConfig = TestConfig {
- tc_quiet :: Bool
- tc_threads :: Maybe Int
- tc_shuffle :: Bool
- tc_output :: TestOutput
- tc_outputXml :: Maybe FilePath
- tc_filter :: TestFilter
- tc_reporters :: [TestReporter]
- tc_useColors :: Bool
- tc_historyFile :: FilePath
- tc_history :: TestHistory
- tc_sortByPrevTime :: Bool
- tc_failFast :: Bool
- tc_timeoutIsSuccess :: Bool
- tc_maxSingleTestTime :: Maybe Milliseconds
- tc_prevFactor :: Maybe Double
- data TestOutput
- = TestOutputHandle Handle Bool
- | TestOutputSplitted FilePath
- type ReportAllTests = [FlatTest] -> TR ()
- type ReportGlobalStart = [FlatTest] -> TR ()
- type ReportTestStart = FlatTest -> TR ()
- type ReportTestResult = FlatTestResult -> TR ()
- type ReportGlobalResults = ReportGlobalResultsArg -> TR ()
- data ReportGlobalResultsArg = ReportGlobalResultsArg {}
- data TestReporter = TestReporter {}
- emptyTestReporter :: String -> TestReporter
- attachCallStack :: ColorString -> CallStack -> ColorString
- type CallStack = [(Maybe String, Location)]
- data TestResult
- type FlatTestResult = GenFlatTest RunResult
- type Milliseconds = Int
- data RunResult = RunResult {
- rr_result :: TestResult
- rr_location :: Maybe Location
- rr_callers :: CallStack
- rr_message :: ColorString
- rr_wallTimeMs :: Milliseconds
- rr_timeout :: Bool
Organizing tests
Abstract type for tests and their results.
data TestOptions Source
General options for tests
TestOptions | |
|
Eq TestOptions | |
Read TestOptions | |
Show TestOptions |
class AssertionWithTestOptions a whereSource
A type class for an assertion with TestOptions
.
testOptions :: a -> TestOptionsSource
AssertionWithTestOptions (IO a) | |
AssertionWithTestOptions (WithTestOptions (IO a)) |
data WithTestOptions a Source
Something with TestOptions
Eq a => Eq (WithTestOptions a) | |
Read a => Read (WithTestOptions a) | |
Show a => Show (WithTestOptions a) | |
AssertionWithTestOptions (WithTestOptions (IO a)) |
Abstract type for test suites and their results.
Type for distinguishing different sorts of tests.
A type denoting the hierarchical name of a test.
TestPathBase TestID | |
TestPathCompound (Maybe TestID) TestPath |
data GenFlatTest a Source
Generic type for flattened tests and their results.
FlatTest | |
|
type FlatTest = GenFlatTest (WithTestOptions Assertion)Source
Flattened representation of tests.
type TestFilter = FlatTest -> BoolSource
A filter is a predicate on FlatTest
. If the predicate is True
, the flat test is run.
testPathToList :: TestPath -> [Maybe TestID]Source
Splits a TestPath
into a list of test identifiers.
prefixName :: TestPath -> StringSource
Returns the name of the prefix of a test path. The prefix is everything except the last element.
defaultTestOptions :: TestOptionsSource
The default TestOptions
withOptions :: (TestOptions -> TestOptions) -> a -> WithTestOptions aSource
Shortcut for constructing a WithTestOptions
value.
historyKey :: GenFlatTest a -> TextSource
Key of a flat test for the history database.
Executing tests
The state type for the TR
monad.
TestState | |
|
initTestState :: TestStateSource
The initial test state.
data TestConfig Source
Configuration of test execution.
TestConfig | |
|
Show TestConfig |
data TestOutput Source
The destination of progress and result messages from HTF.
TestOutputHandle Handle Bool | Output goes to |
TestOutputSplitted FilePath | Output goes to files whose names are derived from |
Eq TestOutput | |
Show TestOutput |
Reporting results
type ReportAllTests = [FlatTest] -> TR ()Source
Reports the IDs of all tests available.
type ReportGlobalStart = [FlatTest] -> TR ()Source
Signals that test execution is about to start.
type ReportTestStart = FlatTest -> TR ()Source
Reports the start of a single test.
type ReportTestResult = FlatTestResult -> TR ()Source
Reports the result of a single test.
type ReportGlobalResults = ReportGlobalResultsArg -> TR ()Source
Reports the overall results of all tests.
data TestReporter Source
A TestReporter
provides hooks to customize the output of HTF.
TestReporter | |
|
Eq TestReporter | |
Show TestReporter |
emptyTestReporter :: String -> TestReporterSource
Specifying results.
data TestResult Source
The summary result of a test.
Eq TestResult | |
Read TestResult | |
Show TestResult | |
ToJSON TestResult | |
FromJSON TestResult |
type FlatTestResult = GenFlatTest RunResultSource
The result of running a FlatTest
type Milliseconds = IntSource
A type synonym for time in milliseconds.
The result of a test run.
RunResult | |
|