1

QAF Version

2.1.13 and 2.1.14-RC1

I have below testdata in xml file -

<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>

And the message's values is store in appdata.en_GB file -

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.

While I'm trying to access the message value in BDD step as given below -

Then verify user with same email already registered message '${registration.existingdata.message}'

Code implementation of the above step is -

@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);
}

Expected behavior

Here I should be able to get the message value i.e. 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.

Actual behavior

But it is retrieving the values as - ${registration.existing.user.message} which is reference key in XML file

And this is how i have load the locales in application.properties file :

env.default.locale=en_GB
env.load.locales=en_GB

Note : If i'm running the test by passing in key then its working as expected as shown below

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
user861594
  • 5,733
  • 3
  • 29
  • 45
NarendraR
  • 7,577
  • 10
  • 44
  • 82

1 Answers1

0

You need to make sure that the local files are under configured resources. For instance if your resource configuration points to resources then local files must be under resources. Below are few examples:

env.resource=resources
resources.load.subdirs=1
env.default.locale=en_GB
env.load.locales=en_GB

all your resources will be loaded including locales from resources (and its subdirectories).

env.resource=resources\common;resources\qa1
#If you will set resources.load.subdirs=0 then resources from subdirectories will not loaded.
resources.load.subdirs=1
env.default.locale=en_GB
env.load.locales=en_GB

all your resources will be loaded including locales from resources\common (and its subdirectories) and resources\qa1 (and its subdirectories). Keep in mind this will not load other resources under parent (in this case resources) directory.

user861594
  • 5,733
  • 3
  • 29
  • 45
  • I have same configuration what you have mentioned but no success. i have shown to @amit borania and he told me to raise issue for workaround – NarendraR Jun 18 '18 at 08:35
  • Where is your `appdata.en_GB` file and what you specified as value for `env.resource`? – user861594 Jun 20 '18 at 18:52
  • `appdata.en_GB` is in `resources` folder and in application properties `env.resources=resources` set – NarendraR Jun 21 '18 at 05:23
  • Unfortunately I'm not able to upload the snap so i have commented on same issue on [github](https://github.com/qmetry/qaf/issues/196). Let me know for further. – NarendraR Jun 21 '18 at 05:42
  • try with `qaf-2.1.14` release, it should works as above. – user861594 Mar 16 '19 at 01:56