cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot get property 'testCase' on null object

Highlighted
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
Highlighted
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.
Highlighted
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
Script Wanted
Check out the new challenge!

Create a script to generate a request body based on data from Datasource
for the TechCorner tag.
Your input is appreciated!


Scripts created this month:
- A scriptd to go through all response nodes and check the value of the required field
- A Dispatching script to get responses based on the values in Request Body
- A script to add a new tag and assign it to all TestCases in a TestSuite
Top Kudoed Authors