Forum Discussion
IgorG
Staff
9 years agoYou seem to try to do several things in one assertion.
Here is how you can try and assert the response::
- Use Message Content assertion to verify the contents of the response. With it you can configure what information you expect in specific response field.
- Use Script assertion to verify response lenght. Depending on your response, there are multiple ways to do this. The simplest one is checking response lenght:
assert messageExchange.response.contentLength < 500
This is obviously very basic, a script should be custom for what you expect in your response. You can, for example, get a response as XML, count the number of specific nodes in it and fail the assertion if there are too many.
testhrishi
9 years agoFrequent Contributor
Thank you for the input, the < length may work to cover for more than expected scenario. But it may not cover the less than expected part, right. Also some of the fields coming back in the response are new every time, hence its gets tricky to assert on specific ones