Forum Discussion

PSTyler's avatar
PSTyler
Occasional Contributor
8 years ago

Cannot get property 'testCase' on null object

I am trying to create methods in Utility.groovy class to use that method for all my getCodes.ashx page test Steps, where I can get a TestStep name dynamically during execution. But getting error java.lang.NullPointerException: Cannot get property ‘testCase’ on null object error at line:15 when calling method from GroovyScript step and getting Cannot get property ‘testCase’ on Null object when calling method within test step using ScriptAssertion.

For Groovy Script step I used

def xml = groovyUtils.getXmlHolder( testRunner.testCase.testSteps[TestStepName].testRequest.response.responseContent )

 

and for ScriptAssertion I used

def xml = groovyUtils.getXmlHolder( messageExchange.responseContent )

2 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    Not sure why are getting.

    Would you like to try the below instead?

    import com.eviware.soapui.support.XmlHolder
    def xmlHoder = new XmlHolder(context.expand('${#TestStepName#Response}'))
  • Hi,

     

    From where are you calling this script? how is the testCase object defined?

     

    Thanks