Ask a Question

how to get Endpoint URL from response in Property Transfer, any idea ?

SOLVED
PM
Contributor

how to get Endpoint URL from response in Property Transfer, any idea ?

I have created test suite which has around 10 Rows from EXCEL

 

DataSource - Excel

GET 

POST

Property Transfer

Data Sink 

 

I was able to fetch out data or Header from response from GET and POST, BUT need to get the request in EXCEL ...as always Developer as for the URL which Request was sent. Any idea how to get the data, as when i tried to use 

 

Note : Request Data was able to fetch from POST but i want full request which has URL along with Data.

 

Like RAW RESPONSE :-

 

GET http://dev-sii-webservices.ebs.ecomp.com:8882/service/CustomerPartNumbersService/v01_00/JSON/Locatio... HTTP/1.1
Connection: close
Accept-Encoding: gzip,deflate
Authorization: Basic cnN3ZWJhcHBsaWNhdGlvbl92MV8wLXVzZXI6cGFzc3dvcmQ=
Accept: application/json
Content-Length: 0
Host: dev-sii-webservices.ebs.ecomp.com:8882
User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_144)

 

6 REPLIES 6
SuperSingh
Contributor

Using the following Groovy, you can get Request/Response as a text file with Request Endpoint in the beginning of the file.

 

url = context.testCase.getTestStepByName('TestStepName').getPropertyValue("Endpoint")

def ReqFile = "C:/Folder/Response.txt"
def request = context.expand( '${TestStepName#Response}')
def a = new File(ReqFile)
a.write( url , "UTF-8")
a << '\n' <<'\n'
a.append(request,"UTF-8")

I wanted to capture the whole URL from POST or DELETE or PUT Method, seems like its giving me Payload only.

 

Used Code :-

 

testRunner.testCase.getTestStepByName("DELETE").getPropertyValue("request")

 

Pls confirm if its different from the one u mentioned. 

PM
Contributor

testRunner.testCase.getTestStepByName("DELETE").getPropertyValue("Endpoint")

 With this its just giving me the Endpoint details only :-

 

like http://st1-sii-webservices.ebs.ecomp.com:8882

 

Whereas i want this :-

 

http://st1-sii-webservices.ebs.ecomp.com:8882/service/CustomerPartNumbersService/v01_00/JSON/Locatio...

 

 

PM
Contributor

Got It ....

 

this would capture WHOLE Request 

 

new String(testRunner.testCase.testSteps["login"].testRequest.response.rawResponseData)

PM
Contributor

Sorry , my fault it was for response BUT i want the same from Request

PM
Contributor

Got the resolution :-

 

Raw Response:-

new String(testRunner.testCase.testSteps["GET"].testRequest.response.rawResponseData)

 

Raw Request:-
def testReq = testRunner.testCase.getTestStepByName("GET").getTestRequest().getResponse().getRawRequestData()
new String(testReq)

cancel
Showing results for 
Search instead for 
Did you mean: