cancel
Showing results for 
Search instead for 
Did you mean: 

Global Props and Groovy

Highlighted
Occasional Contributor

Global Props and Groovy

I am trying to do a very simple thing but I'm having trouble:
I have a global property I set up through SoapUI's preferences tool called "username" (File->Preferences, under the Global Properties tab).

What I'd like to do is to be able to read the value of this property via a groovy test step.  From what I've been reading, this should do it (i've wrapped it in a logger.debug statement for debugging purposes)

log.debug "${username}"

But I get a "no such property: username" error when I run the script.

Any help is greatly appreciated
1 REPLY 1
Highlighted

Re: Global Props and Groovy

Hello!

Try using the following instead:


log.debug context.expand('${username}')


Note that you do have to use single quotes (') for the property expansion to work!

Regards,
Dain
eviware.com

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️Please mark my answer as a solution if it was helpful
New Here?
Join us and watch the welcome video:
Announcements
Script Wanted
Let's start July with new challenges!

Create a script to change request body before sending it to the server for the TechCorner tag!


Scripts created in June:
- A script to generate a request body based on data from Datasource
- A script 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