Quantcast
Channel: New board topics in SmartBear Community
Viewing all articles
Browse latest Browse all 21061

Use a timestamp in request and test for it in response

$
0
0

Hi,

 

I have a service where I'm sending a correlation ID: I send this value in the request, and I expect the same value in the response.

 

For testing this, I generate a timestamp that I send in the request, and I get the same answer in the response. So far so good, but I can't figure out how to put this into an assertion.

 

This is how I generate the timestamp for the request:

 

${=import java.text.SimpleDateFormat ; new SimpleDateFormat("YYYY-MM-dd HH:mm:ss").format(new Date())}

 

For the assertion, I try to refer to the correlation ID property in the request. But when it actually does the assertion, it just evaluates the above function again, thus getting a new timestamp, and failing the test.

 

How can I make it so that it doesn't run the expression again during the assertion, but refers to what was sent in the actual request?

 

Or failing that, can I somehow prepare the timestamp somehow (*), save its value, and then use that to both send the request and check the response? I tried the 'Properties' and the 'Property Transfer' teststeps, but those didn't help.

 

(*: without manually typing it in, obviously)

 

Thanks & best regards,

 

Kris

 


Viewing all articles
Browse latest Browse all 21061

Trending Articles