Forum Discussion

Donkey2017's avatar
Donkey2017
Occasional Contributor
8 years ago

script assertion

Hi, not being a programmer could anyone suggest a way to check if the property "apples" has a number rather than just null for example. So below is the result of running a test. I can easily ask SOAP...
  • nmrao's avatar
    nmrao
    8 years ago
    //Below Script Assertion should do the job
    def json = new groovy.json.JsonSlurper().parseText(context.response) //check id is number assert json.CONTENT.id instanceof Integer, 'id is not integer type' assert 0 < json.CONTENT.id, 'id is not a positive number'