def a = WS.sendRequest(findTestObject(‘New_Request_Auth’, [(email) : ‘sgappfr2@vpmel.fr’, (password) : ‘azerty!!’]))
In the HTTP body:
however, the WS responds with an error, as if the parameters were not correctly sent. With the data without variables in the body the WS responds correctly.
Help please.
Thanks for your answer, but it is the same error with your syntax. This syntax is generated automatically in the script when I insert object parameters in The objectPost
Try putting quotes around your parameters in your JSON i.e. “${email}” and “${password}” the parameters work like macro-substitution. You still need the quotes. (I think)
If you get a error on print line, check your path on http://jsonpath.com/ website
I’m not sure that the [0] position is necessary, make sure that is ok.
"postId": 2,
"id": 6,
"name": "et fugit eligendi deleniti quidem qui sint nihil autem",
"email": "${email}",
"body": "doloribus at sed quis culpa deserunt consectetur qui praesentium\\naccusamus fugiat dicta\\nvoluptatem rerum ut voluptate autem\\nvoluptatem repellendus aspernatur dolorem in"
}
But here when I trigger my code, am unable to pass Email to email attribute mentioned JSON.
Hi Kavia. When you are loading the test object, try: findTestObject(‘PostUpdatedEmail’, [(email) : Email]) instead of findTestObject(‘PostUpdatedEmail’, [‘email’ : Email])
"postId": 2,
"id": 6,
"name": "et fugit eligendi deleniti quidem qui sint nihil autem",
"email": "${email}",
"body": "doloribus at sed quis culpa deserunt consectetur qui praesentium\\naccusamus fugiat dicta\\nvoluptatem rerum ut voluptate autem\\nvoluptatem repellendus aspernatur dolorem in"
}
Getting below error message
[ERROR] - Test Cases/DemoRestAutomation FAILED because (of) Variable ‘email’ is not defined for test case.
If I define Variable eamil inside test case as well, actual value not passing
Variables are case sensitive. While in your test object you are passing the variable EMail, your error indicates the variable _email. _Could you be dealing with two different variables here?
"postId": 2,
"id": 6,
"name": "et fugit eligendi deleniti quidem qui sint nihil autem",
"email": "${Email}",
"body": "doloribus at sed quis culpa deserunt consectetur qui praesentium\\naccusamus fugiat dicta\\nvoluptatem rerum ut voluptate autem\\nvoluptatem repellendus aspernatur dolorem in"
"postId": 2,
"id": 6,
"name": "et fugit eligendi deleniti quidem qui sint nihil autem",
"email": "${Email}",
"body": "doloribus at sed quis culpa deserunt consectetur qui praesentium\\naccusamus fugiat dicta\\nvoluptatem rerum ut voluptate autem\\nvoluptatem repellendus aspernatur dolorem in"