| Copyright | (C) 2017 ATS Advanced Telematic Systems GmbH |
|---|---|
| License | BSD-style (see the file LICENSE) |
| Maintainer | Stevan Andjelkovic <stevan@advancedtelematic.com> |
| Stability | provisional |
| Portability | non-portable (GHC extensions) |
| Safe Haskell | None |
| Language | Haskell2010 |
Test.StateMachine
Description
The main module for state machine based testing.
- sequentialProperty :: CommandConstraint ix cmd => Monad m => Show (model ConstIntRef) => StateMachineModel model cmd -> Gen (Untyped cmd (RefPlaceholder ix)) -> (forall resp refs'. Shrinker (cmd refs' resp)) -> (forall resp. cmd refs resp -> m (Response_ refs resp)) -> (m Property -> Property) -> Property
- sequentialProperty' :: CommandConstraint ix cmd => Show (model ConstIntRef) => Monad m => StateMachineModel model cmd -> StateT s Gen (Untyped cmd (RefPlaceholder ix)) -> s -> (forall resp refs'. Shrinker (cmd refs' resp)) -> (forall resp. model ConstIntRef -> MayResponse_ ConstIntRef resp -> cmd refs resp -> m (Response_ refs resp)) -> (m Property -> Property) -> Property
- parallelProperty :: CommandConstraint ix cmd => StateMachineModel model cmd -> Gen (Untyped cmd (RefPlaceholder ix)) -> (forall resp refs'. Shrinker (cmd refs' resp)) -> (forall resp. cmd refs resp -> IO (Response_ refs resp)) -> Property
- parallelProperty' :: CommandConstraint ix cmd => StateMachineModel model cmd -> StateT genState Gen (Untyped cmd (RefPlaceholder ix)) -> genState -> (forall resp refs'. Shrinker (cmd refs' resp)) -> (forall resp. cmd refs resp -> IO (Response_ refs resp)) -> IO () -> Property
- module Test.StateMachine.Types
Sequential property helper
Arguments
| :: CommandConstraint ix cmd | |
| => Monad m | |
| => Show (model ConstIntRef) | |
| => StateMachineModel model cmd | Model |
| -> Gen (Untyped cmd (RefPlaceholder ix)) | Generator |
| -> (forall resp refs'. Shrinker (cmd refs' resp)) | Shrinker |
| -> (forall resp. cmd refs resp -> m (Response_ refs resp)) | Semantics |
| -> (m Property -> Property) | |
| -> Property |
This function builds a property that tests if your model is agrees with your semantics when running commands sequentially.
Arguments
| :: CommandConstraint ix cmd | |
| => Show (model ConstIntRef) | |
| => Monad m | |
| => StateMachineModel model cmd | Model |
| -> StateT s Gen (Untyped cmd (RefPlaceholder ix)) | Generator |
| -> s | Generator state |
| -> (forall resp refs'. Shrinker (cmd refs' resp)) | Shrinker |
| -> (forall resp. model ConstIntRef -> MayResponse_ ConstIntRef resp -> cmd refs resp -> m (Response_ refs resp)) | Semantics |
| -> (m Property -> Property) | |
| -> Property |
Same as above, except it provides more flexibility.
Parallel property helper
Arguments
| :: CommandConstraint ix cmd | |
| => StateMachineModel model cmd | Model |
| -> Gen (Untyped cmd (RefPlaceholder ix)) | Generator |
| -> (forall resp refs'. Shrinker (cmd refs' resp)) | Shrinker |
| -> (forall resp. cmd refs resp -> IO (Response_ refs resp)) | Semantics |
| -> Property |
This function builds a property that tests your semantics for race conditions, by runnings commands in parallel and then trying to linearise the resulting history.
Note: Make sure that your model passes the sequential property first.
Arguments
| :: CommandConstraint ix cmd | |
| => StateMachineModel model cmd | Model |
| -> StateT genState Gen (Untyped cmd (RefPlaceholder ix)) | Generator |
| -> genState | |
| -> (forall resp refs'. Shrinker (cmd refs' resp)) | Shrinker |
| -> (forall resp. cmd refs resp -> IO (Response_ refs resp)) | Semantics |
| -> IO () | Cleanup |
| -> Property |
module Test.StateMachine.Types