Skip to content

Instantly share code, notes, and snippets.

@baronfel
Last active March 17, 2022 03:13
Show Gist options
  • Save baronfel/519accae0222388d99fe098e29654d29 to your computer and use it in GitHub Desktop.
Save baronfel/519accae0222388d99fe098e29654d29 to your computer and use it in GitHub Desktop.
expecto dependent tests
#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