Forum Discussion
Am I corect in my assumption that you are trying to parse one XML object and all of its elements to use them in future requests? Groovy will work, but it may take a lot of different steps. You might want to look at using an XML data source. That might better fit what you want. You can set it to parse an XML response and use XPATH to select elements and load them into properties.
Hi,
I tried to use it as XML Datasource. I created the properties and executed it. But the data log doesn't seem to be displaying any data although it says Got 5 rows in 3ms.
1. Is there something that needs to be done, apart from providing the row Xpath, defining property?
2. Can i use the output data values to get stored in an array?
Please suggest.
- groovyguy6 years agoChampion Level 1
Can you share some details of what you have tried? Either your project or screen shots?
What I have done in the past is similar to this, as a high level view:- Make a Read request that returns one object.
- Set up an XML datasource that uses XPATH to point to properties in the response from step 1.
- Example properties:
- UserName
- TimeStamp
- Identifier
- If you manually run the DataSource, you should see the data it returns in the data log window. If you do not see data, it is not configured correctly.
- Example properties:
- Set up furthe Read requests that use data from the XML Data Source
- Test steps would reference the data as ${XMLDataSource#PropertyName}
- ${XMLDataSource#UserName}
- ${XMLDataSource#TimeStamp}
- ${XMLDataSource#Identifier}
- Test steps would reference the data as ${XMLDataSource#PropertyName}
- An example test case would look like
- Read request to populate XML DataSource
- XML DataSource
- ReadRequest using Property1
- ReadRequest using Property2
- ReadRequest using Property3
- etc.
Hope that helps!
- MKV6 years agoContributor
You are correct. I did a mistake in the configuration. Using one of your earlier comment in a post (https://community.smartbear.com/t5/SoapUI-Pro/DataSource-XML-not-returning-data/td-p/147087/page/3), I corrected it and now the data is getting displayed.
Now, I want to pass this data into an array. Can you please help to do that as well.
- groovyguy6 years agoChampion Level 1
Glad you got the data getting returned. It took me awhile to puzzle that piece out my first time. :) When you say store these pieces of data in an array, what do you mean and what is the intent? I may need some examples of what you are trying to do and some sample requests / responses / etc to figure this next part out. :)
Related Content
- 5 years agounderqualified