You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Igor Gursky edited this page Sep 23, 2016
·
7 revisions
Setting and Reading a value
Given let variable "gadgetId" equal to "12345"
When the client performs GET request on /gadgets/{(gadgetId)}
Accessing Response HTTP headers as a variable
When the client performs GET request on /gadgets
Then response contains property "gadgets[0].id" of value "{(header.GadgetId)}"
Copying a value from Response HTTP header
Given request body from file gadgets/requests/newGadget.json
When the client performs POST request on /gadgets
Then let variable "gadgetURL" equal to header "Location" value
Copying a value from property from Response body
Given request body from file gadgets/requests/newGadget.json
When the client performs POST request on /gadgets
Then let variable "gadgetOwner" equal to property "owner" value
Variables in files
If reading request from file, Cukes-REST will automatically substitute variable placeholders with appropriate values if defined.
Example:
{
"name" : "{(gadgetName)}"
}
and scenario
Given request body from file gadgets/requests/newGadget.json
And let variable "gadgetName" equal to "iPhone"
When the client performs POST request on /gadgets