cancel
Showing results for 
Search instead for 
Did you mean: 

SoapUi Property Expansion within the json of the request body not working

SOLVED
dubbySwords
New Contributor

SoapUi Property Expansion within the json of the request body not working

Hi, I'm evaluating this tool and have come across a problem. SoapUI property expansion is not working for me. I am attempting to expand a property in some json which forms a body in my request:
{
   'Customer': '${#TestCase#CustomerProperty}'
}

CustomerProperty exists on the test case level.and have double checked that it is there. I hard code it and it works but not when I use property expansion as above.

1 ACCEPTED SOLUTION

Accepted Solutions
richie
Community Hero

Re: SoapUi Property Expansion within the json of the request body not working

Hey @dubbySwords,

What version are you running?
I'm running v5.6.0 and i have multiple project, testsuite and testcase level projects running fine.

Could you plz provide screen grabs of your testcase level properties, your test step and the teststeps payload please? With those we should be able to spot the problem.

The syntax you provided looks fine too, '${#TestCase#CustomerProperty}'. Are you sure youve inserted both # symbols?
Reason i ask is that this used to catch me out. You can either use the 'scope' (or level) where you specify the level such as '${#TestCase#CustomerProperty}' i.e. using the 'scope' thing, youre specifying the "level" at which your properties are held relative to your current focus....so you specify '${#TestCase#CustomerProperty}' (so you include a # in front or 'TestCase') OR you can specify the object
name, e.g. testcase name such as '${CreateRecord#CustomerProperty}' and as you can see....you only include a single hash to separate object name and property name.

If i were you id focus on ensuring if using scope/level approach you include a # before specifying the level name or if using object name theres only one # needed.

Id also check your camel case is correct....i.e. TestCase rather than anything else.

The issue will probably be something like either of the two issues ive described above, but screenshots will help confirm what the issue is.

Ta

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta

View solution in original post

3 REPLIES 3
richie
Community Hero

Re: SoapUi Property Expansion within the json of the request body not working

Hey @dubbySwords,

What version are you running?
I'm running v5.6.0 and i have multiple project, testsuite and testcase level projects running fine.

Could you plz provide screen grabs of your testcase level properties, your test step and the teststeps payload please? With those we should be able to spot the problem.

The syntax you provided looks fine too, '${#TestCase#CustomerProperty}'. Are you sure youve inserted both # symbols?
Reason i ask is that this used to catch me out. You can either use the 'scope' (or level) where you specify the level such as '${#TestCase#CustomerProperty}' i.e. using the 'scope' thing, youre specifying the "level" at which your properties are held relative to your current focus....so you specify '${#TestCase#CustomerProperty}' (so you include a # in front or 'TestCase') OR you can specify the object
name, e.g. testcase name such as '${CreateRecord#CustomerProperty}' and as you can see....you only include a single hash to separate object name and property name.

If i were you id focus on ensuring if using scope/level approach you include a # before specifying the level name or if using object name theres only one # needed.

Id also check your camel case is correct....i.e. TestCase rather than anything else.

The issue will probably be something like either of the two issues ive described above, but screenshots will help confirm what the issue is.

Ta

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta

View solution in original post

dubbySwords
New Contributor

Re: SoapUi Property Expansion within the json of the request body not working

Hi @richie ,

Thank for the terrific answer, it was very thorough.

It turned out to be some glitch in the installation of SoapUi. I reinstalled and followed you guidelines for the expansion and every thing worked!
Thanks again for the amazing answer and the time you spent.

I'm afraid I could not include screen shots as they contain sensitive information for my company.

 

/dubbySwords

richie
Community Hero

Re: SoapUi Property Expansion within the json of the request body not working

Hey @dubbySwords,

Glad you got it all worked out.

Just as a side note on security. All places of work have security considerations so you have to be careful posting screenshots. However the only thing you need to obfuscate in the screenshots is the host/ip address/domain of the endpoint/api you are attempting to hit. (As well as any username and password details).

Say for example you have a GET endpoint with the following full URL:

http://www.somedomain.com/folder1/folder2/{id}/somethingelse?entityid=12345&year=2021

Using the above as an example, you only supply the URI, not the URL

So you wouldnt include the host/ip/domain, youd just specify

GET --> /folder1/folder2/{id}/somethingelse?entityid=12345&year=2021

From a security perspective without the host details (included in the URL, not the URI), any other user would not be able to do anything that would compromise security.

So you just need to ensure if you need to add screenshota in future, just edit the image beforehand hiding/scrubbing out the host/ip/domain

Cheers

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
New Here?
Join us and watch the welcome video:
Top Kudoed Authors