Reputation: 2327
I have a JUnit test, which uses the Parameterized runner. I have two parameters to be passed (country names) Once this Junit runs in the HTML report for each parameter it gives the result. But it gives the result with testname1[0], testname1[1]..... and so forth for parameter. (for each parameter it will add [] after test name )
I want to customize the result for example 2 parameters are Country names. I would like to have something like CountryName1 - under that testName1. Then CountryName2.. testName.
Is there a way? Thanks in advance.
Upvotes: 4
Views: 2659
Reputation: 3161
With version 4.11 of JUnit, it is now possible to rename the parameterized tests. See this answer which tells how to get this done.
Upvotes: 1
Reputation: 14540
recently i started zohhak project. it lets you write:
@TestWith({
"25 USD, 7",
"38 GBP, 2",
"null, 0"
})
public void testMethod(Money money, int anotherParameter) {
...
}
and each invocation is reported with parameters - check screenshot on main page
Upvotes: 0
Reputation: 24520
There is already an issue for JUnit, which proposes to extend the Parameterized runner to support better test names. Unfortunately the issue is not solved yet.
An alternative is to use CallbackParams.
Upvotes: 2