skaushik9
6 years agoOccasional Contributor
URGENT- SOAPUI- Dynamical XML for creating elements
Hi, I have a below structure in my Test case
Note - I am using Soapui PRO
1) Data source - reading multiple rows from Excel file
2) Request method
3) Data source loop
When I run the test case, data source takes multiple rows from the Excel file. It loops each row and generates separate XML file for each row. For example
Message 1 for first row in Excel
Header XML elements
<......>
Child XML elements
Ship no 1
Qty 1
Batch number 001
Message 2 for second row in Excel
Header XML elements
Child XML elements
Ship no 2
Qty 5
Batch number 002
_-----------++++++----------
What I want is
Message
Header XML elements
Child XML elements
Ship no 1
Qty 1
Batch number 001
Ship no 2
Qty 5
Batch number 002
Note - I am using Soapui PRO
1) Data source - reading multiple rows from Excel file
2) Request method
3) Data source loop
When I run the test case, data source takes multiple rows from the Excel file. It loops each row and generates separate XML file for each row. For example
Message 1 for first row in Excel
Header XML elements
<......>
Child XML elements
Ship no 1
Qty 1
Batch number 001
Message 2 for second row in Excel
Header XML elements
Child XML elements
Ship no 2
Qty 5
Batch number 002
_-----------++++++----------
What I want is
Message
Header XML elements
Child XML elements
Ship no 1
Qty 1
Batch number 001
Ship no 2
Qty 5
Batch number 002
Hi skaushik9,
The DataSource Loop isn't helpful here. If you use it the request is sent each time when you iterate through rows.
You can do the following:
1. Continue using the Excel file as a source, but use a Groovy script to read the data from it.
2. Store the data in the XML file. In this case, you will be able to use the DataSource of the Directory (xml) or File (txt) type to read all the content and write to one property.
Please see the screenshots:
DataSource - Directory
DataSource - File