haf / expecto

A smooth testing lib for F#. APIs made for humans! Strong testing methodologies for everyone!
Apache License 2.0
663 stars 96 forks source link

FsCheck observed functionality not shown in default `testProperty` functions #442

Open stijnmoreels opened 1 year ago

stijnmoreels commented 1 year ago

Is your issue related to a problem? Please describe: When using Expecto's testProperty functions, the FsCheck observed functionality like classification, trivial, and collection (info) to inspect test data distribution does not work. One has to call FsCheck's functionality via Check.Quick inside a regular test function before the observed data is shown.

What solution do you propose? Make use of FsCheck observation when running properties so that one could write the following without problem, and is written to Expecto's test output.

testProperty "addition is commutative" <| fun x y ->
  x + y = y + x
  |> Prop.classify (x = y) "equal"
  |> Prop.classify (x <> y) "not-equal"

Thx!