我创建了一个 Stream 方法,其中包含我想在测试中传递的参数。我从 3 个不同的实体获取数据。我创建了两个对象(电子邮件、密码),我想在其中保存这些参数的值并将它们传递给登录方法。问题是它们始终为空。
@ParameterizedTest
@MethodSource("adminCredentials")
@Test
void loginSysAdmin() {
adminWelcomePage.loginAdminParameters(email, password);
adminHomePage.verifyLoggedSysAdminNameAndRole(sysAdminEntity);
// by default
usersPage.verifyUsersPage();
adminHomePage.verifyUsersTabIsPresent();
adminHomePage.verifyScreeningsTabIsPresent();
adminHomePage.verifyAdminsTabIsPresent();
adminHomePage.verifyAccountsTabIsPresent();
adminHomePage.verifyLocationsTabIsPresent();
}
private Stream<Arguments> adminCredentials() {
return Stream.of(
Arguments.of(email = sysAdminEntity.getEmail(), password = sysAdminEntity.getPassword()),
Arguments.of(email = accAdminEntity.getEmail(), password = accAdminEntity.getPassword()),
Arguments.of(email = regularAdminEntity.getEmail(), password = regularAdminEntity.getPassword())
);
}
}