specs2 has traits such as Before, After, Around, etc. in order to be able to wrap examples in setup/teardown code.
Is there anything to support setting up and tearing down testing infrastructure for each “iteration” of a ScalaCheck property, i.e. each value or set of values to be tested by ScalaCheck?
It looks like specs2’s various Before, After, Around traits are designed around returning or throwing specs2 Result instances, and a Prop isn’t a Result.
This is fixed now in the latest 1.12.2-SNAPSHOT. You can now write:
And this will execute code before and after the “body” of the Property.
You can also go a step further and create a support method to pass in an implicit
aroundto your Props: