header
header
Main Menu
Home
Eviware Store
Downloads
Products
News
Forum
Eviware Blog
Search
FAQs
Customer Area
Support
Documentation
Tutorials
CookBook
Downloads
Forum
Login Form
Welcome, Guest. Please login or register.
November 22, 2008, 06:42:31 am
Username: Password:
Login with username, password and session length

Forgot your password?
 
Property Expansion and Groovy Script
Welcome, Guest. Please login or register.
November 22, 2008, 06:42:31 am
Home Help Search Login Register
News: The Forums are up! Welcome to eviware.

+  Eviware Forum
|-+  soapUI
| |-+  soapUI
| | |-+  Property Expansion and Groovy Script
« previous next »
Pages: [1] Print
Author Topic: Property Expansion and Groovy Script  (Read 349 times)
Noel Murphy
Newbie
*
Posts: 3


« 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
Logged
omatzura
Administrator
Hero Member
*****
Posts: 1,425


« Reply #1 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

Logged
Noel Murphy
Newbie
*
Posts: 3


« Reply #2 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

Logged
omatzura
Administrator
Hero Member
*****
Posts: 1,425


« Reply #3 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
Logged
Noel Murphy
Newbie
*
Posts: 3


« Reply #4 on: February 27, 2008, 05:12:48 pm »

Hi Ole,

Thanks again for the speedy response, I have it working now.

/Noel  Smiley
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
header header
header
header