Contributions
Re: Unable to view request and response details in transaction log
Hi, Can someone please help with this query? Does ReadyAPI not show the request and response content when using a data looper step? Most of the APIs I am testing do not have a payload but only query parameters/headers. Could that be the reason that there is no content in the transaction log tab? Thanks, Ray2 years agoPlace ReadyAPI QuestionsReadyAPI Questions852Views0likes1CommentUnable to view request and response details in transaction log
Hi All, I have build a few tests with Data Source and Data Source loop. When I run these tests and go to transaction log, I am unable to view the request and response for a particular Data row/iteration. All I see is <not xml content> and <not JSON content> in the request and response windows. Is there a setting I should enable to have access to this data? Attaching a screenshot of what is visible to me on the transaction log tab currently. My Test case has 4 steps and the Data loop has 5 rows that loops to one of the steps. I am also attaching the test step and data source for your reference. Test Case: Data Source: Thanks, Ray2 years agoPlace ReadyAPI QuestionsReadyAPI Questions955Views0likes6CommentsRe: Unable to get all elements from JSON Response using JSON Path
Thanks for your responserichie The response depends on how the application is setup. In this case, I have set it up so that this response is always going to be static. I tried using the wild card notation for JSON path $[*]['Id'] but it did not work in this case. However, if I try it online with a JSON path explorer it correctly returns the IDs. -Ray2 years agoPlace ReadyAPI QuestionsReadyAPI Questions585Views0likes0CommentsUnable to get all elements from JSON Response using JSON Path
Hi All, I have a JSON Response like this - [ { "Id" : "b0f9009b-87bd-4b68-9033-bb6027f1251e", "Name" : "Carousel", "Mode" : "Simulation", "State" : "Offline", "OnlineState" : "NotOnline", "Active" : false, "Available" : true, "DockState" : "Docked", "Present" : true, "IsSimulated" : true, "IsInstrument" : true, "Priority" : 2, "FirmwareVersion" : "Not available.", "SoftwareVersion" : "Not available.", "ModelDescription" : "Not available.", "SerialNumber" : "Not available.", "ConnectionMode" : "Unknown", }, { "Id" : "c2fc48ef-8190-495b-86ee-4b16fb793fa3", "Name" : "Hotel", "Mode" : "Normal", "State" : "Offline", "OnlineState" : "NotOnline", "Active" : false, "Available" : true, "DockState" : "Docked", "Present" : true, "IsSimulated" : false, "IsInstrument" : true, "Priority" : 2, "FirmwareVersion" : "Not available.", "SoftwareVersion" : "Not available.", "ModelDescription" : "Not available.", "SerialNumber" : "Not available.", "ConnectionMode" : "Unknown", }, { "Id" : "2e2b98cc-96ec-4e81-933a-aa7c4e762220", "Name" : "MultidropCombi", "Mode" : "Simulation", "State" : "Offline", "OnlineState" : "NotOnline", "Active" : false, "Available" : true, "DockState" : "Docked", "Present" : true, "IsSimulated" : true, "IsInstrument" : true, "Priority" : 2, "FirmwareVersion" : "Not available.", "SoftwareVersion" : "Not available.", "ModelDescription" : "Not available.", "SerialNumber" : "Not available.", "ConnectionMode" : "Unknown", }, { "Id" : "66703155-9db2-46cd-91f2-21d4a7b76a43", "Name" : "Spinnaker", "Mode" : "Simulation", "State" : "Offline", "OnlineState" : "NotOnline", "Active" : false, "Available" : true, "DockState" : "Docked", "Present" : true, "IsSimulated" : true, "IsInstrument" : true, "Priority" : 1, "FirmwareVersion" : "Not available.", "SerialNumber" : "Not available.", "ConnectionMode" : "Unknown", }, { "Id" : "516fbe5b-56c0-4ff2-a19d-3a9da703bc43", "Name" : "Teleshake", "Mode" : "Simulation", "State" : "Offline", "OnlineState" : "NotOnline", "Active" : false, "Available" : true, "DockState" : "Docked", "Present" : true, "IsSimulated" : true, "IsInstrument" : true, "Priority" : 2, "FirmwareVersion" : "Not available.", "SoftwareVersion" : "Not available.", "ModelDescription" : "Not available.", "SerialNumber" : "Not available.", "ConnectionMode" : "Unknown", } ] I am trying to get the ID of each device from this response in the Data Source step using JSON path. When I enter $[*]['Id'] I get 0 rows. However, if I enter something like $[1]['Id'] then I get the corresponding ID correctly. I would like to retrieve the ID, one at a time and feed it to another endpoint using data source loop to verify the details by ID. Can someone please help me with this? Here is a screenshot of my Data Source. Thanks, Ray597Views0likes3CommentsRe: Groovy Script assertion always passes even though the values don't match the response
I fixed the assertions using a for loop import groovy.json.JsonSlurper def response = messageExchange.response.responseContent def slurpedResponse = new JsonSlurper().parseText(response) def count = slurpedResponse.Size for(i=0; i< count ; i++) { if(slurpedResponse[i].isProcess){ if(slurpedResponse[i].name == "Plate1") { assert slurpedResponse[i].process.name == "UsingProcessPlates" assert slurpedResponse[i].lid == null } if(slurpedResponse[i].name == "Plate2") { assert slurpedResponse[i].process.name == "UsingProcessPlates" assert slurpedResponse[i].lid == "Plate2Lid" } if(slurpedResponse[i].name == "Plate2Lid") { assert slurpedResponse[i].process.name == "UsingProcessPlates" assert slurpedResponse[i].lid == null } if(slurpedResponse[i].name == "PlateSet") { assert slurpedResponse[i].process.name == "UsingProcessPlates" assert slurpedResponse[i].lid == "PlateSetLid" } if(slurpedResponse[i].name == "PlateSetLid") { assert slurpedResponse[i].process.name == "UsingProcessPlates" assert slurpedResponse[i].lid == null } if(slurpedResponse[i].process.name == "Plate_StallRun") { assert slurpedResponse[i].process.name == "StallRun" assert slurpedResponse[i].lid == null } } else { log.info("The container is not used in any process") } } Thanks for the idea! I would like to know if there is documentation about different kind of assertions that ReadyAPI offers through scripting. I am okay writing code and would like to explore the assert library more in depth. Thanks, Ray3 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.1KViews0likes0CommentsRe: Groovy Script assertion always passes even though the values don't match the response
Thanks for the response! So, I believe the right way to approach this would be using a for loop? I used the * operator for JasonSlurper thinking it will iterate over all the elements in the array but guess it works differently from a for loop.3 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.1KViews0likes1CommentGroovy Script assertion always passes even though the values don't match the response
Hi, I am writing assertions for an API which has the following JSON response - { "id" : "dd72080a-be22-4e60-a0e4-58f35d4144e5", "name" : "I_Plate3", "containerType" : null, "isInventory" : true, "isProcess" : false, "inventoryTemplateName" : "I_Plate3", "process" : null, "lid" : null }, { "id" : "1f2e0738-358e-478b-abf9-d4b79383d587", "name" : "Plate1", "containerType" : "SLAS/SBS Standard", "isInventory" : false, "isProcess" : true, "inventoryTemplateName" : null, "process" : { "id" : "a3b5e431-dc18-43af-b204-ae877c7c72b9", "name" : "UsingProcessPlates" }, "lid" : null }, In the response I iterate over isProcess and if it is true, I put an assertion on the process name and lid. Here is the script I am using for this - import groovy.json.JsonSlurper def response = messageExchange.response.responseContent def slurpedResponse = new JsonSlurper().parseText(response) if ( slurpedResponse*.isProcess) { switch (slurpedResponse.name) { case "Plate1" : assert slurpedResponse.process.name == "UsingProce" assert slurpedResponse.lid == null } case "Plate2" : assert slurpedResponse.process.name == "UsingProcessPlates" assert slurpedResponse.lid == "Plate2Lid" } } The issue is that the assertion below passes when it should be failing since the name of the process does not match with what it is in the JSON response. assert slurpedResponse.process.name == "UsingProce" I have tried it with assert slurpedResponse.process.name.toString() as well but the assertion still passes when it should fail. Can someone please help me with the error in my script?1.2KViews0likes4Comments