Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Something like Spock's "@Unroll" for JUnit theories?

I used Spock, and there is this brilliant @Unroll annotation, which makes all the runs of test method look like separate tests.

Is there something like that for JUnit @Theory? When @Theory test method is run multiple times (with different parameters), it still looks like one method run in the IDE. I'd like to see each run separately.

like image 464
amorfis Avatar asked Aug 31 '14 04:08

amorfis


2 Answers

this github project does this.

junit-theory-suite is a simple library that replaces the default JUnit theories runner with one that treats each individual combination of parameters as a distinct test case.

like image 159
soru Avatar answered Sep 28 '22 07:09

soru


There is now a small JUnit tool tellingly called spockito from tools4j which offers an Unroll annotation similar to Spock's unroll feature.

Disclaimer: I am involved in tools4j and the spockito project.

like image 45
marco Avatar answered Sep 28 '22 08:09

marco