Refactor integrational testing engine and its interface
Clarification and motivation
There are some issues with Michelson.Test.Integrational
and similar modules (e. g. Lorentz
versions):
- If you expect some action to fail, you should do
validate . Left $ something
. That differs from the common approach where errors can be handled usingcatch
function (or something equivalent). Sincecatch
-approach is standard in Haskell, I think we should stick to it. -
IntegrationalScenario
returnsValidated
. That was done to avoid scenarios that don't callvalidate
(and thus don't check anything). However, over time it caused more troubles than profit, mostly when build tests from multiple blocks (IntegrationalScenarioM
). Moreover, currently it's quite ok to write a test that doesn't callvalidate
, because by default we expect each action to succeed.
Acceptance criteria
- When one expects an error in tests, they should use a function with the type and semantic similar to
catch
fromMonadCatch
. It replacesvalidate . Left
functionality. -
Validated
is removed,IntegrationalScenario
is changed toIntegrationalScenarioM ()
. - We still need a way to validate some positive scenarios, we can keep
validate
function (but removeEither
from its argument) or rename/refactor it in some way.