New to Rest Assured - getting response body empty

1,744 views
Skip to first unread message

Avr Narayana

unread,
Aug 25, 2016, 12:35:20 AM8/25/16
to REST assured
Hello ,

My Dev Team provided me the Rest service which takes below Payload and i was get to see the JSON response using ARC chrome APP.
For Automating this manual testing i read about Rest Assured wanted to use it.

Through Rest Assured: I see empty body . I want to see the similar response body i see it through ARC Client. Any help its highly appreciated.

Response response= RestAssured.given()    .contentType("application/json").    body("{  \"CTLHDR\" : {    \"SYS_NAME\" : same as above   },        \"any\" : \"Hello\"       }}")    .post("");        Console Response :

{}PASSED: firstRestAssuredTest===============================================    Default test    Tests run: 1, Failures: 0, Skips: 0===============================================--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Manual Testing from Chrome ARC Client i do see the response body- Please see the following
POST Request
--------------------------------------------

Content-Type: application/json
Accept: application/json
Response-Mode: synchronous
Method :POST

RawPayload

{
  "CTLHDR" : {
    "SYS_NAME" : "XXXX",
    "SVC_ID" : "XXXX",
    "SVC_NAME" : "TEST",
    "DOMAIN" : "AS",
   "USER_ID" : "user",
    "CALLBACK_URL" : "http://.......",
    "TOPOLOGY_TOKEN" : "",
    "WK_TYPE" : "I",
    "JOB_TYPE" : "A", 
    "SYS_ID" : "ABC123",
    "DTIMEOUT" : "PT30M0.000S",
    "DIPVER" : "6.0"
   }, 
   "REQUEST" : {   
     "CID" : "XX-38XXX..CM",
     ""
     },
        "any" : "Hello"

    
   }
}



Response in ARC Client both Header and body

Status:
200: OKLoading time: 6435 ms

Response header

Server: Apache-Coyote/1.1Content-Type: application/json;charset=UTF-8Content-Length: 1307Date: Wed, 24 Aug 2016 20:33:07 GMT

{  "ABC_RESPONSE": {    "any": "Hello",    "CTLHDR": {      "SYS_NAME": "ABC",      "SVC_ID": "XXXX",            }    },    "DETAILS": "XXXXXXl"  }}------------------------------------------------


Johan Haleby

unread,
Aug 25, 2016, 1:59:31 AM8/25/16
to rest-a...@googlegroups.com
What does the logs say if you include RestAssured.enableLoggingOfRequestAndResponseIfValidationFails(); just before your current test code?

--
You received this message because you are subscribed to the Google Groups "REST assured" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rest-assured+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages