Testng 我们如何在使用诱惑报告的数据提供程序时动态命名测试用例

Testng 我们如何在使用诱惑报告的数据提供程序时动态命名测试用例,testng,allure,Testng,Allure,我们在data provider中有测试用例名称,并希望在Allure报告中打印相同的名称。目前,它为数据提供程序的所有情况重复打印相同的默认测试方法名称请参见下面的示例,说明如何在使用@DataProvider时动态设置Allure中的描述和测试名称 @Test(dataProvider = "getListOfCredentials", dataProviderClass = AuthenticationDataProvider.class) public void lo

我们在data provider中有测试用例名称,并希望在Allure报告中打印相同的名称。目前,它为数据提供程序的所有情况重复打印相同的默认测试方法名称

请参见下面的示例,说明如何在使用@DataProvider时动态设置Allure中的描述和测试名称

@Test(dataProvider = "getListOfCredentials", dataProviderClass = AuthenticationDataProvider.class)
public void loginUser(AuthenticationData authenticationData) {
    AllureLifecycle lifecycle = Allure.getLifecycle();
    lifecycle.updateTestCase(testResult -> testResult.setName("Test wrong login with username: "+authenticationData.getUsername()));
    lifecycle.updateTestCase(testResult -> testResult.setDescription("Test wrong login with password: "+authenticationData.getPassword()));
}
因此,我的诱惑描述和测试标题动态基于每次使用对象authenticationData运行测试时我的数据提供程序方法将返回的凭据