Forum Discussion
spsuser
12 years agoOccasional Contributor
Sorry for answering late but your forum didn't reminded me of your post.
Actually I want the DataSink to write the result of this step.
I have several properties in a property transfer test step. They get me a value via xpath from the response and write it to the according datasink property.
I hoped a "set null on missing source" would help. (It works for "normal" result where xpath simply doesn't resolve) But for timeout somehow it keeps the last working response value.
I adapted your code a bit and tried
The last line I added as the "if" never triggers to true. The statusCode for this script is still 200. Even in case of timeout.
So a check on statusCode doesn't help me to trigger the error case in my script.
Any further ideas? Thanks in advance
Actually I want the DataSink to write the result of this step.
I have several properties in a property transfer test step. They get me a value via xpath from the response and write it to the according datasink property.
I hoped a "set null on missing source" would help. (It works for "normal" result where xpath simply doesn't resolve) But for timeout somehow it keeps the last working response value.
I adapted your code a bit and tried
def resp = testRunner.testCase.testSteps[ "Test Request" ].testRequest.response
if ( resp.statusCode != 200 )
{
testRunner.testCase.testSteps[ "DataSink" ].setPropertyValue( "Status", resp.statusCode )
}
testRunner.testCase.testSteps[ "DataSink" ].setPropertyValue( "Status", resp.statusCode )
The last line I added as the "if" never triggers to true. The statusCode for this script is still 200. Even in case of timeout.
So a check on statusCode doesn't help me to trigger the error case in my script.
Any further ideas? Thanks in advance
Related Content
- 12 years ago
- 7 years ago