Dynamic (Unique) property variable in XML Request
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2008
01:32 PM
02-27-2008
01:32 PM
Dynamic (Unique) property variable in XML Request
Hi All,
The WebApp I'm testing requires a UniqueToken in the XML Request. Is there a way I can include a dynamic property variable in a XML Request?
I've tried dynamically entering a time variable in the -DsoapUI.properties=properties.txt file, but this appears to be read only at startup.
From what I can tell, Groovy script is an option before or after the Test Case is run. Not when it is run.
I don't need anything fancy, just a unique string. Something like the output from "time /t" would be fine.
Any suggestions to point me in the right direction would be much appreciated.
Thanks,
~Jim
The WebApp I'm testing requires a UniqueToken in the XML Request. Is there a way I can include a dynamic property variable in a XML Request?
I've tried dynamically entering a time variable in the -DsoapUI.properties=properties.txt file, but this appears to be read only at startup.
From what I can tell, Groovy script is an option before or after the Test Case is run. Not when it is run.
I don't need anything fancy, just a unique string. Something like the output from "time /t" would be fine.
Any suggestions to point me in the right direction would be much appreciated.
Thanks,
~Jim
8 REPLIES 8
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2008
01:35 PM
02-27-2008
01:35 PM
Hi Jim,
try adding the following to your TestCases Setup script:
context.randomId = Math.random()
And then "use" the randomId variable in a request with
${randomId}
Hope this helps!
regards,
/Ole
eviware.com
try adding the following to your TestCases Setup script:
context.randomId = Math.random()
And then "use" the randomId variable in a request with
Hope this helps!
regards,
/Ole
eviware.com
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2008
07:30 AM
02-28-2008
07:30 AM
Thanks Ole,
I can't seem to get this to work.
I added the context.randomId = Math.random() to the Test Case setup
and set the XML request like so,${randomId}
I've tried ${randomId} and ${#TestCase#randomId}. The property expansion is not happening. soapUI sends whatever I put in the UniqueToken holder.
I tried added a def before the context.randomId = Math.random(), and creating the def other ways, but can't get the property expansion to work.
I've also tried creating a UniqueToken groovy script containing the context.randomID function and using the result ni the XML request like so,
${#UniqueToken#randomId}
What am I missing? I can't help but think it's something simple.
I can't seem to get this to work.
I added the context.randomId = Math.random() to the Test Case setup
and set the XML request like so,
I've tried ${randomId} and ${#TestCase#randomId}. The property expansion is not happening. soapUI sends whatever I put in the UniqueToken holder.
I tried added a def before the context.randomId = Math.random(), and creating the def other ways, but can't get the property expansion to work.
I've also tried creating a UniqueToken groovy script containing the context.randomID function and using the result ni the XML request like so,
What am I missing? I can't help but think it's something simple.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2008
12:46 PM
02-28-2008
12:46 PM
Hi!
this solution will only work when you run the entire TestCase, not just an isolated Request inside it.. could that be the cause of your problem?
regards!
/Ole
eviware.com
this solution will only work when you run the entire TestCase, not just an isolated Request inside it.. could that be the cause of your problem?
regards!
/Ole
eviware.com
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2008
03:40 PM
02-28-2008
03:40 PM
I've gotten the context.randomId = Math.random() to return a value from a Groovy script Test Step, then Transfer the value (using a Property Transfer Test Step) to the final Test Step (Interactive Read ).
I just haven't had any luck defining the Math.random() function in the Test Case Setup Script and having the Property Expansion work properly in the XML Request.
It's probably a Scope or Syntax problem on my part. I'm still learning my way around soapUI. I'll keep poking around.
Thanks much for the assistance & very nice work on soapUI. I've convinced my group to switch from soapScope and buy a few copies of soapUI. I expect to get lots time on it in the future.
Have a good day!
~Jim
I just haven't had any luck defining the Math.random() function in the Test Case Setup Script and having the Property Expansion work properly in the XML Request.
It's probably a Scope or Syntax problem on my part. I'm still learning my way around soapUI. I'll keep poking around.
Thanks much for the assistance & very nice work on soapUI. I've convinced my group to switch from soapScope and buy a few copies of soapUI. I expect to get lots time on it in the future.
Have a good day!
~Jim
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2008
10:19 PM
02-28-2008
10:19 PM
Hi Jim,
ok, sounds good! Contact me once you have the pro-licenses and we can set up a webex session to sort this out (if you want)..
regards!
/Ole
eviware.com
ok, sounds good! Contact me once you have the pro-licenses and we can set up a webex session to sort this out (if you want)..
regards!
/Ole
eviware.com
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2008
05:18 AM
02-29-2008
05:18 AM
Excellent! Will do.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2008
07:52 AM
03-07-2008
07:52 AM
Hi Ole,
I got our SoapUI Pro licenses yesterday. I will put together a brief description of our Web App and some of the things I want to do and email it to you.
Our Web App is not very complex and I think we can work out a lot of what I want to do with emails. If I cannot work things out after a few emails, we can go the Webex route.
Thanks much,
~Jim G
I got our SoapUI Pro licenses yesterday. I will put together a brief description of our Web App and some of the things I want to do and email it to you.
Our Web App is not very complex and I think we can work out a lot of what I want to do with emails. If I cannot work things out after a few emails, we can go the Webex route.
Thanks much,
~Jim G
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2008
08:36 AM
03-07-2008
08:36 AM
Hi Jim,
Thank you, we're proud to have you as a Pro-user 🙂
regards,
/Ole
eviware.com
Thank you, we're proud to have you as a Pro-user 🙂
regards,
/Ole
eviware.com
