Something like Spock "@Unroll" for Unit theories?

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

Is there something similar for JUnit @Theory ? When the @Theory testing @Theory run multiple times (with different parameters), it still looks like one of the methods launched in the IDE. I would like each of them to be performed separately.

+6
source share
3 answers

Now there is a small JUnit tool called spockito from tools4j that offers an Unroll annotation similar to Spock's unlock feature.

Disclaimer: I participate in tools4j and the spockito project.

+1
source

There is currently no way to do this starting with JUnit 4.12.

0
source

this github project does this.

junit-theory-suite is a simple library that replaces JUnitโ€™s default running theory with one that treats each individual combination of parameters as a separate test case.

0
source

Source: https://habr.com/ru/post/974599/


All Articles