Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method to store a variable from a response field found by json path #16

Closed
vboldor opened this issue Jul 31, 2017 · 0 comments
Closed

Comments

@vboldor
Copy link
Contributor

vboldor commented Jul 31, 2017

/**
* Stores the value of the response field found by json path
/
this.Then(/^(api) user stores the value '(.
)' from response in variable (.*)$/, function(keyPath, name, callback) {

   keyPath = helperCommon.getTreatedValue(keyPath);
   var varName = helperCommon.getTreatedValue(name);

   //get value from JSON using JSONPATH
   jsonparser.init(trest.response.body);
   var varValue = jsonparser.getValue(keyPath)[0];

   // Add the value to variables
   helperVars.addVariable(varName, varValue);
   this.delayCallback(callback);

});

@vboldor vboldor changed the title Add method to store a variable from a response field found by xpath Add method to store a variable from a response field found by json path Jul 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants