Open vinayak5044 opened 2 years ago
It should be pass to body(payload) like this only - "dtcIds" : [ "#37:1498", "#37:1499", "#37:1502", "#37:1503" ]
and not like -
@sparrowV Could you please look into it ?
Hi @vinayak5044 i have recently work on such type of issue in which i have created instance of JSONObject and passed the string(in your case "dtcIds") in the arguments and then with the help of JSONObject reference i have invoked jsonObject.optString("dtcIds").replace("\", ""); , used sprinboot in my project.
Hi @ayushdubey755 Thanks for reply.
But In my case, Can you please help to understand how to create jsonObject because I am taking array "dtcIds" from previous api response and chained it in required API.
For more understanding please refer below attached screenshot: I want syntax to pass in red marked square which will reflect correct dtcIds list
//sample code
@vinayak5044
private void initAuthor() {
Path path = Paths.get(authorDumpLocation);
try (Stream
//construct the author object
Author author = new Author();
author.setName(jsonObject.optString("name"));
author.setPersonalName(jsonObject.optString("personal_name"));
author.setId(jsonObject.optString("key").replace("/authors/", ""));
This is the code that i was talking about i have also new to this concept and get to know about it during handson practice Here is the link to a video hope this will give you some help https://www.youtube.com/watch?v=24NrLl8EhDM&list=PLJ5_m4Y8xLkkxfo2Z1Lb0qjXnAZqIWCCZ&index=9
Hi @ayushdubey755
I tried but unable to do it.
I am confused where I need to write this method to replace regex and how to call it from json test cases file ?
API response of previous POST request: "dtcIds" : [ "#37:1498", "#37:1499", "#37:1502", "#37:1503" ]
Need to pass this whole array to body of request - But After running getting in logs like: "request": { "headers": { "locale": "${locale}" }, "body": { "dtcIds": "${$.previousRequest.response.body.dtcIds[?(@.*)]}" }
In logs it seems like,
I don't want backword slash there ....Please help me to do it. Please refer attached screenshot.