Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Global Property name in my JSON input request using SoapUI?

I have a SoapUI project which contains around 60 plus services. Each service requires some input which will be changed for every execution. So I have created certain Global Properties and assign some values to that properties.

I have to use these properties values in my SoapUI request ( i.e. JSON Format request ).

If it is groovy script means, I will use like this.

String HTiC_Username = com.eviware.soapui.model.propertyexpansion.PropertyExpansionUtils.globalProperties['HTiC_Username'].value;

But, how to get the value of the Global Property in the request?

Hope you understand my question. Please provide proper guidance.

Thanks

like image 275
Karunagara Pandi Avatar asked Apr 26 '13 04:04

Karunagara Pandi


1 Answers

To dynamically "expand" (i.e. substitute) the value of a property into a test step, the following syntax is used: ${#scope#propertyName}

...where 'scope' refers to the level at which the property has been defined (e.g. Global, Project, TestSuite, TestCase).

So to expand a property named username defined as a Global property, for example, the following code can be used directly within a Request Test Step (e.g within a JSON body, or header value, etc):

${#Global#username}

To access the same property value within a Groovy Test Step, you can use the following syntax: context.expand('${#scope#propertyName}')

...as in the following example:

context.expand('${#Global#username}')
like image 176
drond Avatar answered Sep 28 '22 03:09

drond