我有如下简单的参数化测试用例
@ParameterizedTest @ValueSource(strings = { "Hello", "World","Test" }) void withFixValues(String word) { System.out.println(word); assertNotNull(word); }
但在测试失败的情况下,不容易检查哪个参数值测试失败。我们是否可以根据参数来命名参数化测试用例?
我们可以使用名称属性提供名称。
@ParameterizedTest(name = "withSomeName #{index} with Value [{arguments}]") @ValueSource(strings = { "Hello", "World","Test" }) void withFixValues(String word) { System.out.println(word); assertNotNull(word); }