AnsweredAssumed Answered

Groovy script not working in Devtest.

Question asked by Anand.vm on Dec 22, 2016
Latest reply on Jan 6, 2017 by MarcyNunns

I am using  script assertion . I have written following groovy code . But i am getting following error ,

 

Assertion name: Scripted Assertion checks for: false is of type: Assert by Script Execution.Script,

 

def slurper = new groovy.json.JsonSlurper()
def result = slurper.parseText('{"person":{"name":"Guillaume","age":33,"pets":["dog","cat"]}}')

assert result.person.name == "Guillaume"
assert result.person.age == 33
assert result.person.pets.size() == 2
assert result.person.pets[0] == "dog"
assert result.person.pets[1] == "cat"

 

execution error so we assume false: java.lang.NullPointerException

Groovy script error

 

groovyassertion scriptscript library

Outcomes