Forum Discussion

lucym's avatar
lucym
New Contributor
8 years ago
Solved

Property Expansions in JSONPath expression in Property Transfer step

Hello SmartBear community

 

I'm new to using SoapUI and have got stuck on trying to use property expansions (for Test Case level parameters) in a Property Transfer step. I want to look up a value returned in a service response using the following JSONPath:

 

$.roles[?(@.service_name=='MyServiceName')].id

 

But I would like to parameterize the step to run for different environments, e.g.

 

$.roles[?(@.service_name=='${#TestCase#ServiceName}')].id

 

This doesn't seem to work - neither does the expression $.roles[?(@.service_name==${#TestCase#ServiceName})].id. I get the error "Array index [Ljava.lang.String;@1b02ce3 not found in path".

 

I have checked the property name is correct by using the same property expansion in my request (where it is expanded correctly), and I've checked my JSONPath expression works with a hard-coded value.

 

Any idea of where I am going wrong here?

 

Thanks
Lucy

  • If the object has been recreated, then to avoid the error, get the new object before the method call.

     

    Try doing a Get on the page before looking for the elements.