Skip to content

New test runner reports are really weird for parameterized tests #1296

Closed
@Artur-

Description

Consider for instance this test where method is run twice and will once pass and once fail.

@RunWith(Parameterized.class)
public class MyTest {

    @Parameters
    public static Integer[] data() {
        return new Integer[] { 1, 2 };
    }

    private Integer id;

    public MyTest(Integer id) {
        this.id = id;
    }

    @Test
    public void method() {
        Assert.assertEquals(Integer.valueOf(1), id);
    }
}

Running in VS Code gives me
Screenshot 2021-08-27 at 15 53 26

Changing the method to assert the value is 2 gives
Screenshot 2021-08-27 at 15 53 52

At this point I no longer have any idea of what is going on. The is no indication anywhere about two tests being run as far as I can see.

If I add

    @Rule
    public TestName testName = new TestName();

and

        System.out.println("Name: " + testName.getMethodName());

I can see that the tests are actually named

Name: method[0]
Name: method[1]

but the popup only shows method

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions