sydtest-0.11.0.2: A modern testing framework for Haskell with good defaults and advanced testing features.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Syd.Modify

Description

This module defines functions for declaring different test settings

Synopsis

Declaring different test settings

modifyMaxSuccess :: (Int -> Int) -> TestDefM a b c -> TestDefM a b c Source #

modifyMaxSize :: (Int -> Int) -> TestDefM a b c -> TestDefM a b c Source #

modifyMaxShrinks :: (Int -> Int) -> TestDefM a b c -> TestDefM a b c Source #

data TestRunSettings Source #

Instances

Instances details
Generic TestRunSettings Source # 
Instance details

Defined in Test.Syd.Run

Associated Types

type Rep TestRunSettings :: Type -> Type #

Show TestRunSettings Source # 
Instance details

Defined in Test.Syd.Run

Eq TestRunSettings Source # 
Instance details

Defined in Test.Syd.Run

type Rep TestRunSettings Source # 
Instance details

Defined in Test.Syd.Run

type Rep TestRunSettings = D1 ('MetaData "TestRunSettings" "Test.Syd.Run" "sydtest-0.11.0.2-6lzl1C70a4kGcpgBB3rc7j" 'False) (C1 ('MetaCons "TestRunSettings" 'PrefixI 'True) ((S1 ('MetaSel ('Just "testRunSettingSeed") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SeedSetting) :*: (S1 ('MetaSel ('Just "testRunSettingMaxSuccess") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "testRunSettingMaxSize") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int))) :*: ((S1 ('MetaSel ('Just "testRunSettingMaxDiscardRatio") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "testRunSettingMaxShrinks") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int)) :*: (S1 ('MetaSel ('Just "testRunSettingGoldenStart") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "testRunSettingGoldenReset") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool)))))

Declaring parallelism

sequential :: TestDefM a b c -> TestDefM a b c Source #

Declare that all tests below must be run sequentially

parallel :: TestDefM a b c -> TestDefM a b c Source #

Declare that all tests below may be run in parallel. (This is the default.)

withParallelism :: Parallelism -> TestDefM a b c -> TestDefM a b c Source #

Annotate a test group with Parallelism.

Declaring randomisation order

randomiseExecutionOrder :: TestDefM a b c -> TestDefM a b c Source #

Declare that the order of execution of all tests below may be randomised.

doNotRandomiseExecutionOrder :: TestDefM a b c -> TestDefM a b c Source #

Declare that the order of execution of all tests below must not be randomised.

Declaring flakiness

flaky :: Int -> TestDefM a b c -> TestDefM a b c Source #

Mark a test suite as "potentially flaky".

This will retry any test in the given test group up to the given number of tries, and pass a test if it passes once. The test output will show which tests were flaky.

WARNING: This is only a valid approach to dealing with test flakiness if it is true that tests never pass accidentally. In other words: tests using flaky must be guaranteed to fail every time if an error is introduced in the code, it should only be added to deal with accidental failures, never accidental passes.

flakyWith :: Int -> String -> TestDefM a b c -> TestDefM a b c Source #

Like flaky, but also shows the given message to the user whenever the test is flaky.

You could use it like this:

>>> flakyWith 3 "Something sometimes goes wrong with the database, see issue 6346" ourTestSuite

notFlaky :: TestDefM a b c -> TestDefM a b c Source #

Mark a test suite as "must not be flaky".

This is useful to have a subgroup of a group marked as flaky that must not be flaky afteral.

withFlakiness :: FlakinessMode -> TestDefM a b c -> TestDefM a b c Source #

Annotate a test group with FlakinessMode.