I have several different implementations of a trait that I would like to test, and the test only uses the method signatures of the trait, so it seems like I should be able to use parameterized tests. However, the specs2 website doesn't seem to describe a straightforward way of writing parameterized tests. The closest is how to "share examples" but you still need to write every combination of tests and tested code, where I want to be able to specify:
A. Tests
B. Classes to test
That can be specified separately, but will test the cartesian product of the two.
Also don't forget that you can use for loops:
class MySpecification extends mutable.Specification {
Seq(new Foo, new Bar) foreach { tested =>
"it should do this" >> { tested must doThis }
"it should do that" >> { tested must doThat }
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With