how to handle leading spaces in assertion that are returned in my REST call
Greetings,
My rest service returns a value of " 5903" which has 6 leading spaces. My data pool always eliminates the spaces and just has 5903.
The error I get when testing the assertion is:
Comparison failed. Path: [$[2]['checkNumber']]; Expected value: [5903]; Actual value: [ 5903].
Is there a way to work a regular expression into this AND/OR trim off the leading spaces in the REST return?
Thanks,
Chris
It's always something easy that stops me. After trying overly complicated JSON regular expressions I just put the * in front of the data pool location and checked Allow Wildcards.
*${WaiverManagerCompliantWithCheck#CheckNumber}
Worked great.
I'm kicking myself.
you are able to try script assertion (ie new groovy.json.JsonSlurper().parseText(response)), and then retrieve response value, trim leading space and compare with your expected value.