JUnit Parameterized Runner and mvn Surefire Report integration

Posted by fraido on Stack Overflow See other posts from Stack Overflow or by fraido
Published on 2010-04-07T09:59:05Z Indexed on 2010/04/07 10:03 UTC
Read the original article Hit count: 1066

Filed under:
|
|
|
|

I'm using the Junit Parameterized Runner and the Maven Plugin Surefire Report to generate detailed reports during the mvn site phase.
I've something like this

@RunWith(Parameterized.class)
public class MyTest {
   private String string1;
   private String string2;

   @Parameterized.Parameters
   public static Collection params() {
       return Arrays.asList(new String[][] {
            { "1", "2"},
            { "3", "4"},
            { "5", "6"}
       });
   }

   public MyTest(String string1, String string2) {
       this.string1 = string1; 
       this.string2 = string2;
   }

   @Test
   public void myTestMethod() { ... }

   @Test
   public void myOtherTestMethod() { ... }

The report shows something like

myTestMethod[0]      0.018
myTestMethod[1]      0.009
myTestMethod[2]      0.009
...
myOtherTestMethod[0]      0.018
myOtherTestMethod[1]      0.009
myOtherTestMethod[2]      0.009
...

Is there a way to display something else rather than the iteration number [0]..[1]..etc..
The constructor parameters would be a much better information.
For example

myTestMethod["1", "2"]      0.018
...

© Stack Overflow or respective owner

Related posts about junit

Related posts about runner