Forum Discussion
SmartBear_Suppo
SmartBear Alumni (Retired)
bmgriner wrote: I am trying to set a test case level property off of a groovy script assertion and I keep getting null pointer errors. I assume the way to do it is as follows: context.testRunner.testCase.getProperty("someProperty").setValue("somevalue")
Am I doing something wrong here?
Hello!
context.testRunner is null in script assertions. Try this instead:
messageExchange.modelItem.testStep.testCase.setPropertyValue( "My property", "The new value" )
Regards!
Good thing you asked this -- I've now added it to the soapUI Tips & Tricks page.
/Henrik
eviware.com
ilovechiku
9 years agoContributor
Can you use
messageExchange.modelItem.testStep.testCase.setPropertyValue( "My property", "The new value" )
to get properties back to next request and next assertion of the response?
- wjblazek7 years agoOccasional Contributor
Script assertions can also access property step properties through the messageExchange object:
def var = messageExchange.modelItem.testStep.testCase.getTestStepByName("propertyStepName").getPropertyValue("propertyName")
messageExchange.modelItem.testStep.testCase.getTestStepByName("propertyStepName").setPropertyValue("propertyName", propNameNewValued)It would be good to add this to the "Tips & Tricks" page too.