sydtest-0.13.0.1: 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.13.0.1-55Gc5hcyKHH3AZQfAi7Nha" '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.

data Parallelism Source #

Constructors

Parallel 
Sequential 

Instances

Instances details
Generic Parallelism Source # 
Instance details

Defined in Test.Syd.SpecDef

Associated Types

type Rep Parallelism :: Type -> Type #

Show Parallelism Source # 
Instance details

Defined in Test.Syd.SpecDef

Eq Parallelism Source # 
Instance details

Defined in Test.Syd.SpecDef

type Rep Parallelism Source # 
Instance details

Defined in Test.Syd.SpecDef

type Rep Parallelism = D1 ('MetaData "Parallelism" "Test.Syd.SpecDef" "sydtest-0.13.0.1-55Gc5hcyKHH3AZQfAi7Nha" 'False) (C1 ('MetaCons "Parallel" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Sequential" 'PrefixI 'False) (U1 :: Type -> Type))

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.

Modifying the number of retries

modifyRetries :: (Word -> Word) -> TestDefM a b c -> TestDefM a b c Source #

Modify the number of retries to use in flakiness diagnostics.

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

Turn off retries

withRetries :: Word -> TestDefM a b c -> TestDefM a b c Source #

Make the number of retries this constant

Declaring flakiness

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

Mark a test suite as "potentially flaky" with a given number of retries.

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 :: Word -> 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.

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

Mark a test suite as 'potentially flaky', such that it will not fail if it is flaky but passes at least once.

potentiallyFlakyWith :: String -> TestDefM a b c -> TestDefM a b c Source #

Like potentiallyFlaky, but with a message.

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

Annotate a test group with FlakinessMode.

data FlakinessMode Source #

Instances

Instances details
Generic FlakinessMode Source # 
Instance details

Defined in Test.Syd.SpecDef

Associated Types

type Rep FlakinessMode :: Type -> Type #

Show FlakinessMode Source # 
Instance details

Defined in Test.Syd.SpecDef

Eq FlakinessMode Source # 
Instance details

Defined in Test.Syd.SpecDef

type Rep FlakinessMode Source # 
Instance details

Defined in Test.Syd.SpecDef

type Rep FlakinessMode = D1 ('MetaData "FlakinessMode" "Test.Syd.SpecDef" "sydtest-0.13.0.1-55Gc5hcyKHH3AZQfAi7Nha" 'False) (C1 ('MetaCons "MayNotBeFlaky" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MayBeFlaky" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe String))))

Declaring expectations

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

Mark a test suite as 'should pass'

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

Mark a test suite as 'should fail'

withExpectationMode :: ExpectationMode -> TestDefM a b c -> TestDefM a b c Source #

Annotate a test suite with ExpectationMode

data ExpectationMode Source #

Instances

Instances details
Generic ExpectationMode Source # 
Instance details

Defined in Test.Syd.SpecDef

Associated Types

type Rep ExpectationMode :: Type -> Type #

Show ExpectationMode Source # 
Instance details

Defined in Test.Syd.SpecDef

Eq ExpectationMode Source # 
Instance details

Defined in Test.Syd.SpecDef

type Rep ExpectationMode Source # 
Instance details

Defined in Test.Syd.SpecDef

type Rep ExpectationMode = D1 ('MetaData "ExpectationMode" "Test.Syd.SpecDef" "sydtest-0.13.0.1-55Gc5hcyKHH3AZQfAi7Nha" 'False) (C1 ('MetaCons "ExpectPassing" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ExpectFailing" 'PrefixI 'False) (U1 :: Type -> Type))