|
Title: Property Expansion and Groovy Script Post by: Noel Murphy on February 27, 2008, 03:37:08 pm Hi there,
If I have a property attached to my project called FILE_PATH, can I make a direct reference to it within Groovy script. ${#Project#FILE_PATH} or do I have to use something like context.getProperty("FILE_PATH") Finally I would like to know if its possible to make a change to this properties value and then save the change to the project. Thanks, Noel Title: Re: Property Expansion and Groovy Script Post by: omatzura on February 27, 2008, 03:45:04 pm Hi!
you can either get the property value with context.expand( '${#Project#FILE_PATH}' ) or get and set the property valuewith def prop = testRunner.testCase.testSuite.project.properties["FILE_PATH"] // set prop.value = ... If you want to save the project then do testRunner.testCase.testSuite.project.save() should do the trick! Hope this helps! regards, /Ole eviware.com Title: Re: Property Expansion and Groovy Script Post by: Noel Murphy on February 27, 2008, 04:17:11 pm Hi Ole,
Thank you so much for the quick response. I can get the prop = context.expand( '${#Project#FILE_PATH}' ) to work but not the def prop = testRunner.testCase.testSuite.project.properties["FILE_PATH"] This is because I'm running a peice of groovy script from the mock response editor and its not invoked with testrunner. Is there a way around this? Thanks, Noel Title: Re: Property Expansion and Groovy Script Post by: omatzura on February 27, 2008, 04:23:19 pm Hi,
oh.. sorry.. in that try using mockResponse.mockOperation.mockService.project.properties["FILE_PATH"] instead! regards, /Ole eviware.com Title: Re: Property Expansion and Groovy Script Post by: Noel Murphy on February 27, 2008, 05:12:48 pm Hi Ole,
Thanks again for the speedy response, I have it working now. /Noel :) |