cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot get property 'testCase' on null object

Occasional Contributor

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 2
Community Hero

Re: Cannot get property 'testCase' on null object

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}'))


Regards,
Rao.
Staff

Re: Cannot get property 'testCase' on null object

Hi,

 

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

 

Thanks



Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors