1

Looking for ways to carry over data from previous step to subsequent using QAF. Is there an option for such behavior?

user861594
  • 5,733
  • 3
  • 29
  • 45
user3812972
  • 77
  • 1
  • 6
  • Will you be able to provide details about how your steps look like and example of what you are trying to achieve? – user861594 Feb 19 '20 at 19:21

1 Answers1

0

In qaf your step can return a value. If you step is returning a value and you want to use it in another step you can use store into 'var-name' step after step that returning value. For example

When create new user using "{'name':'user1','password':'user123'}"
And store into 'newUser'
Then system should have user '${newUser}'

Your step may look like below:

@QAFTestStep(description="create new user using {userInfo}")
public User createUser(User user){
    //steps to createUser
    long id = userDao.createUser(user);
    user.setId(id);
    return user;
}
@QAFTestStep(description="system should have user {userInfo}")
public void createUser(User user){
    //steps to createUser
    User user = userDao.getUser(user.getId);
    Validator.assertThat("get user from system",user, Matchers.notNull());
}

Below is example of web services test:

Given user requests 'myservice.getuser.reqcall'
And say 'userID' is value at jsonpath '$.id'
Then ...
user861594
  • 5,733
  • 3
  • 29
  • 45