Last active
March 17, 2022 03:13
-
-
Save baronfel/519accae0222388d99fe098e29654d29 to your computer and use it in GitHub Desktop.
expecto dependent tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r "nuget: Expecto" | |
open Expecto | |
let dependentTest testName condition testCase = | |
test testName { | |
if condition then | |
testCase () | |
else | |
skiptestf "Expecto: condition failed" | |
} | |
let test = | |
testSequenced | |
<| testList | |
"does the thing" | |
[ let mutable shouldExecuteFollowOnTests = true | |
test "condition" { | |
shouldExecuteFollowOnTests <- false | |
failwith "condition test failed" | |
} | |
testList | |
"dependent tests" | |
[ dependentTest | |
"follow on test" | |
shouldExecuteFollowOnTests | |
(fun () -> Expect.equal true true "yup this is defintiely true") ] ] | |
let config = | |
{ defaultConfig with | |
verbosity = Logging.LogLevel.Debug | |
printer = Expecto.Impl.TestPrinters.summaryPrinter (Impl.TestPrinters.defaultPrinter) } | |
runTests config test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment