I am trying to figure out if I can create parametrized tests with MUnit or ScalaCheck. ScalaCheck allows me to create property-based tests. However, the only way I have seen that I can create parametrized tests is with ScalaTest. See here: https://www.scalatest.org/user_guide/table_driven_property_checks.
My test suite already depends on MUnit and ScalaCheck, I would not like to add another library on the mix. Otherwise, I think I am going to get rid of MUnit and replace it with ScalaTest.
It doesn't seem that MUnit offers something like Table-driven property checks.
MUnit
has integration with scalacheck, but doesn't add anything similar to what you are looking for.One possible approach could be something like
the output will be
It's not exactly the same. Doing this, instead of having just one use case where the error message of a failed test shows what is the set of values that make the test fails, you will be generating new test cases per each group of values you have in the list. Using the
Table
class also lets put a label for each value, which something useful when you get an error. Even title of the test could be wrong.This could be improved with some helper, but I think that would be trying to recreate what is offered by
ScalaTest