QAF 版本
2.1.13 和 2.1.14-RC1
我在 xml 文件中有以下 testdata -
<registration>
<existingdata>
<title>Mr</title>
<firstname>Narendra</firstname>
<lastname>Rajput</lastname>
<email>narendra.rajput@infostretch.com</email>
<password>Qwerty@123</password>
<confirmPassword>Qwerty@123</confirmPassword>
<message>${registration.existing.user.message}</message>
</existingdata>
</registration>
并且消息的值存储在appdata.en_GB
文件中 -
registration.existing.user.message = There is already an account with this email address. If you are sure that it is your email address, click here to get your password and access your account.
当我尝试访问 BDD 步骤中的消息值时,如下所示 -
Then verify user with same email already registered message '${registration.existingdata.message}'
上述步骤的代码实现是——
@QAFTestStep(stepName = "verifyUserAlreadyRegisteredMessage", description = "verify user with same email already registered message {0}")
public void verifyUserAlreadyRegisteredMessage(String message) {
verifyVisible("message.success.failure.text");
verifyText("message.success.failure.text", message);
}
预期行为
在这里,我应该能够获取消息值,即 已经有一个使用此电子邮件地址的帐户。如果您确定这是您的电子邮件地址,请单击此处获取您的密码并访问您的帐户。
实际行为
但它正在检索值 - ${registration.existing.user.message}这是 XML 文件中的引用键
这就是我在application.properties
文件中加载语言环境的方式:
env.default.locale=en_GB
env.load.locales=en_GB
注意:如果我通过传入密钥来运行测试,那么它会按预期工作,如下所示
SCENARIO: UserRegistrationWithExistingEmail
META-DATA: {"description":"Registration with already registered email","groups":["REGRESSION"],"key":"registration.existingdata"}
Given user is on homepage
When clicks on create an account link
And fill registration form with data '${args[0]}'
And click on register button
Then verify user with same email already registered message '${message}'
END