Forum Discussion
SmartBear_Suppo
SmartBear Alumni (Retired)
Hi Anand,
When accessing properties from Groovy scripts you should use the context object to macro-expand the property values in run-time. Using context object you can access properties from different contexts, incl. Global, that you're after.
If your PATH global variable does not include the partition letter, here's what you should have:
Not the prefixed hash symbol (#) before the context name. Properties defined inside a test step do not need this prefix. Also, you should use single quotes and not double quotes since they would assign the string value as is which is without property macro-expansion you need.
There's also documentation on property expansion in soapUI that you might want to peruse.
I would also recommend using log object to learn more about your Groovy scripts and object values. For example:
I hope this will solve your problem.
Cheers!
/Nenad Nikolic a.k.a. Shonzilla
When accessing properties from Groovy scripts you should use the context object to macro-expand the property values in run-time. Using context object you can access properties from different contexts, incl. Global, that you're after.
If your PATH global variable does not include the partition letter, here's what you should have:
def excelFilename = context.expand('D:/${#Global#PATH}/Output.xls');
Workbook Output = Workbook.getWorkbook(new File(excelFilename))
Not the prefixed hash symbol (#) before the context name. Properties defined inside a test step do not need this prefix. Also, you should use single quotes and not double quotes since they would assign the string value as is which is without property macro-expansion you need.
There's also documentation on property expansion in soapUI that you might want to peruse.
I would also recommend using log object to learn more about your Groovy scripts and object values. For example:
log.info("excelFilename = " + excelFilename);
I hope this will solve your problem.
Cheers!
/Nenad Nikolic a.k.a. Shonzilla
SaurabhT
9 years agoNew Contributor
Hi,
This solution is very useful.
Thanks.
Related Content
- 12 months agolalit_singh
- 6 months agosohailalam2696
Recent Discussions
- 3 days agoemoya
- 3 days agoMyBalanceNow