Set the TestRequest field data source
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2008
12:54 PM
01-10-2008
12:54 PM
Set the TestRequest field data source
Hello,
I'm using soapUI Pro.
I'm trying to dynamically set the data source (ala ${DataSource#value}) of fields in a TestRequest via a Groovy script. I'm not sure how to do this. I have looked through the API for WsdlTestRequestStep but didn't see a good way.
A point in the right direction would be great, or some sample Groovy code.
mike
PS- I was asked to repost this to http://www.eviware.com/component/option ... /board,2.0 however I don't have access to that forum.
I'm using soapUI Pro.
I'm trying to dynamically set the data source (ala ${DataSource#value}) of fields in a TestRequest via a Groovy script. I'm not sure how to do this. I have looked through the API for WsdlTestRequestStep but didn't see a good way.
A point in the right direction would be great, or some sample Groovy code.
mike
PS- I was asked to repost this to http://www.eviware.com/component/option ... /board,2.0 however I don't have access to that forum.
4 REPLIES 4
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2008
01:14 PM
01-10-2008
01:14 PM
Hi!
this forum will have to do.. 🙂
Try using GroovyUtils together with XmlHolder as described at http://www.soapui.org/userguide/functio ... roovyUtils which allows you to easily update the request xml using xpath expressions..
Hope this helps!
regards,
/Ole
eviware.com
this forum will have to do.. 🙂
Try using GroovyUtils together with XmlHolder as described at http://www.soapui.org/userguide/functio ... roovyUtils which allows you to easily update the request xml using xpath expressions..
Hope this helps!
regards,
/Ole
eviware.com
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2008
01:26 PM
01-10-2008
01:26 PM
I saw that example which is nice, except I want to dynamically inspect the request to determine what fields are there and assign a datasource property to them. I'd like the code to work against different operations.
I had thought about looking at the request xml and searching for the "?" place holder that is put in some fields, but it's not a complete solution.
I'd also like to avoid re-writing the code in SampleXmlUtil.java that looks to produce the example XML. Since you are exposing a forms view I was hoping there were already some helper classes someplace that I could use to "easily" inspect the parameters.
To give a little background on what I'm doing, I would like to run a Groovy script that walks a WsdlProject and creates one or more test suites that performs some standard generic testing of each interface/operation. This currently includes some basic fuzz testing (throwing random values at each field).
I already have working code to create the test suite, test cases, etc. But currently there is a manual step to load each soap request test step and set the property for each field and change the field count in the DataSource code. I'm hoping to remove that manual step.
mike
I had thought about looking at the request xml and searching for the "?" place holder that is put in some fields, but it's not a complete solution.
I'd also like to avoid re-writing the code in SampleXmlUtil.java that looks to produce the example XML. Since you are exposing a forms view I was hoping there were already some helper classes someplace that I could use to "easily" inspect the parameters.
To give a little background on what I'm doing, I would like to run a Groovy script that walks a WsdlProject and creates one or more test suites that performs some standard generic testing of each interface/operation. This currently includes some basic fuzz testing (throwing random values at each field).
I already have working code to create the test suite, test cases, etc. But currently there is a manual step to load each soap request test step and set the property for each field and change the field count in the DataSource code. I'm hoping to remove that manual step.
mike
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2008
02:03 PM
01-10-2008
02:03 PM
Hi Mike,
sounds like a great feature! If I understand correctly you want to traverse a request and insert property-expansions for each element that should contain data, right?
Maybe you could use the XmlBeans XmlCursor API for this, it lets you traverse a document pretty easily and modify its contents.. you can get the cursor via the XmlHolder.xmlObject.newCursor() method, then use it as described at http://xmlbeans.apache.org/docs/2.0.0/g ... rsors.html
Finally, write the updated Request property back with XmlHolder.updateProperty()
does that sound feasible?
regards,
/Ole
eviware.com
sounds like a great feature! If I understand correctly you want to traverse a request and insert property-expansions for each element that should contain data, right?
Maybe you could use the XmlBeans XmlCursor API for this, it lets you traverse a document pretty easily and modify its contents.. you can get the cursor via the XmlHolder.xmlObject.newCursor() method, then use it as described at http://xmlbeans.apache.org/docs/2.0.0/g ... rsors.html
Finally, write the updated Request property back with XmlHolder.updateProperty()
does that sound feasible?
regards,
/Ole
eviware.com
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2008
02:25 PM
01-10-2008
02:25 PM
Yup, you got it. I had started looking into the that but was hoping there would be an easier way.
Guess I will start down that path.
thanks,
mike
Guess I will start down that path.
thanks,
mike
