Contact Us
About Us
News
Home
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
.
January 08, 2009, 11:58:00 pm
Username:
Password:
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Forgot your password?
Creating Propertiues at the Project level...
Welcome,
Guest
. Please
login
or
register
.
January 08, 2009, 11:58:00 pm
News:
The Forums are up! Welcome to eviware.
Eviware Forum
soapUI
soapUI
Creating Propertiues at the Project level...
« previous
next »
Pages:
[
1
]
Author
Topic: Creating Propertiues at the Project level... (Read 539 times)
Desmond Cassidy
Newbie
Posts: 25
Creating Propertiues at the Project level...
«
on:
September 30, 2008, 09:46:48 am »
Hi,
Apologies if this is covered in some other place...or more to the point - where in the Groovy Guid eare the basics of Property creation specified.
I would like to dynamically create several named properties at either
1. The Project Level
2. The Suite Level
(THere doesn;t seem to be the possiblility of creating Global Properties - not that I can see anyway).
So, in One Groovy Script I would like something like...
import java.text.*;
SimpleDateFormat df1 = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat df2 = new SimpleDateFormat("HH:mm:ss.S");
String TodayPlus14 = df1.format( new Date() +14;) + "T" + df2.format( new Date() +14; );
String TodayPlus21 = df1.format( new Date() +21;) + "T" + df2.format( new Date() +21; );
...and now create (and I guess a check to see if the property is already defined - as in a Re-Reun!) and load properties like TodayPlus14, TodayPlus21 (OK..the ame name but doesn;t have to be !). ...into either the Project , Test Suite or indeed Global level...
Not being a java programmer...all this seems a little obtuse to me...
Any help appreciated...
Cheers,
Dezzz.
Logged
omatzura
Administrator
Hero Member
Posts: 1,666
Re: Creating Propertiues at the Project level...
«
Reply #1 on:
September 30, 2008, 12:39:18 pm »
Hi Dezzz,
sure, to set a property all you need to do is call the corresponding setPropertyValue, ie
testCase.setPropertyValue( name, value )
or
project.setPropertyValue( name, value )
if the property doesn't exist, it will be created first. Depending on from where you are doing this, access to the object model differs. For example from inside Groovy Script TestStep, you would do
testRunner.testCase.testSuite.project
to get the project. Let me know your specific context and I'll help you forward!
Also, you can set global properties with
com.eviware.soapui.SoapUI.globalProperties.setPropertyValue( name, value )
(since 2.5 version)
Hope this helps!
regards,
/Ole
eviware.com
Logged
Desmond Cassidy
Newbie
Posts: 25
Re: Creating Propertiues at the Project level...
«
Reply #2 on:
September 30, 2008, 04:48:55 pm »
OK...Many thabks OLe...much appreciated...Looks great...
SO...all the way up the tree is as follows...
testRunner.testCase.testSuite.project.setPropertyValue("FirstName", "Desmond" )
testRunner.testCase.testSuite.setPropertyValue( "LastName", "Cassidy")
testRunner.testCase.setPropertyValue( "MiddleName", "Peter")
Now to set it in a DIfferent Project or TestSUite or TestCase than the 'Tree' i am in...
Cheers,
Dezzz.
Logged
omatzura
Administrator
Hero Member
Posts: 1,666
Re: Creating Propertiues at the Project level...
«
Reply #3 on:
September 30, 2008, 08:02:22 pm »
Hi,
you can always navigate back "down" the tree with either xXCount/getXXAt/getXXByName methods, for example testSuite.testCaseCount / testSuite.getTestCaseAt( ix ), or XXs[name], for example project.testSuites["TestSuite 1"]
You can get the workspace with project.workspace and then another project with getProjectByName.. A complete example:
testCase.testSuite.project.workspace.getProjectByName( "Project 3" ).testSuites["TestSuite 3"].getTestCaseAt( 2 )
One thing to know is that there is no workspace when running tests using the command-line runners, so project.workspace will return null.
Hope this helps!
regards,
/Ole
eviware.com
Logged
Desmond Cassidy
Newbie
Posts: 25
Re: Creating Propertiues at the Project level...
«
Reply #4 on:
September 30, 2008, 10:58:07 pm »
Excellent...thanks yest again !!
Logged
Christoph Schwarz
Newbie
Posts: 17
Re: Creating Propertiues at the Project level...
«
Reply #5 on:
October 15, 2008, 03:29:37 pm »
Hi Ole,
using the properties i create a project property test.IMDBurl filled with a groovy script:
String url = 'http://' + ipAddress + ':8088'
testRunner.testCase.testSuite.project.setPropertyValue("test.IMDBurl", url )
now i want to use this test.IMDBurl property as the endpoint. but whenever i call an endpoint with this property i get a empty response.
in the endpoint i tried this settings:
$(project.getPropertyValue("test.IMDBurl"))
$(test.IMDBurl)
and a few others but none worked.
what would be the entry as the endpoint to make this work?
thanks
Chris
Logged
omatzura
Administrator
Hero Member
Posts: 1,666
Re: Creating Propertiues at the Project level...
«
Reply #6 on:
October 16, 2008, 09:17:34 am »
Hi!
please try
${#Project#test.IMDBurl}
(The "#Project#' part tells soapUI in which scope to look for the property..)
does that help?
regards,
/Ole
eviware.com
Logged
Christoph Schwarz
Newbie
Posts: 17
Re: Creating Propertiues at the Project level...
«
Reply #7 on:
October 16, 2008, 10:19:28 am »
Hi Ole,
yes thanks, that works fine now.
regards
Chris
Logged
Pages:
[
1
]
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> eviware general
-----------------------------
soapUI
-----------------------------
=> soapUI
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Powered by SMF 1.1.2
|
SMF © 2006-2007, Simple Machines LLC
Loading...