nickspacek
16 years agoOccasional Contributor
Asserting response contains request parameter
Hi folks,
I have a method I want to test that requires a date parameter represented as an epoch. I want to use the time of the test for this value. What I am currently doing is running a setup script to add a parameter called 'startTime' to the context with the current time. Then as a parameter to the method, I have 'epoch' set to ${startTime}. In my assertions, I run an XPath selector that points to the value in the response, and set the expected value to ${epoch}.
So that works, but I don't like having to run the setup script. If I set the 'epoch' parameter to ${=new Date().getTime()} and try to retrieve that in the XPath expected result it runs the code there again, so I end up with a value that is greater than the one sent with the request.
Is there any way to access values actually transmitted in the request?
Thanks,
Nick
I have a method I want to test that requires a date parameter represented as an epoch. I want to use the time of the test for this value. What I am currently doing is running a setup script to add a parameter called 'startTime' to the context with the current time. Then as a parameter to the method, I have 'epoch' set to ${startTime}. In my assertions, I run an XPath selector that points to the value in the response, and set the expected value to ${epoch}.
So that works, but I don't like having to run the setup script. If I set the 'epoch' parameter to ${=new Date().getTime()} and try to retrieve that in the XPath expected result it runs the code there again, so I end up with a value that is greater than the one sent with the request.
Is there any way to access values actually transmitted in the request?
Thanks,
Nick