Forum Discussion

CSmirl's avatar
6 years ago

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:...
  • CSmirl's avatar
    6 years ago

    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.


    Worked great.

    I'm kicking myself.

  • aaronpliu's avatar
    6 years ago

    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.