Forum Discussion
MartinS
14 years agoOccasional Contributor
I think there are 2 options (the only 2 options i know
):
First make a XML with multiple parents and sons and their sons ect... For example XML will containt 10 parents every parent will have 10 children. Then you can have data source which will get data from excel sheet. Then link Test Request with data source.
Example:
Excel sheet example:

Data source will import first row. Then you will have xml request like this (this is only small example):
The point is that XML will have around 10 parents and every parent will have 5 children (the number of parents and children depend on you).
Then in Test Request property set Remove Empty Content on true. This will clear all empty XML elements. So when you dont have value in excel sheet then XML element will be empty and this will remove all of them.
Example:
I tryed to attach picture of example excel sheet. It should be somewhere above. There are 2 parents with 2 children each. So XML will have 2 parents with 2 children and values will be mapped to data source as example above. All values will be send to Test Request and fill all fields in there. Then Remove empty content remove all empty elements so you will get clean XML with same number of parents/childs set in your excel sheet.
The second:
Same principle but this one use java library (only for SoapUI Pro 4.5.0). I am using this option only when i cant use remove empty content (for example when you have in test request empty element msgParams which cant be deleted).
Regards,
MartinS
):First make a XML with multiple parents and sons and their sons ect... For example XML will containt 10 parents every parent will have 10 children. Then you can have data source which will get data from excel sheet. Then link Test Request with data source.
Example:
Excel sheet example:
Data source will import first row. Then you will have xml request like this (this is only small example):
<ns1:People xmlns:ns1="http://www.example.org/ParentChildGrandChild">
<ns1:Person>
<ns1:Name>${import_data#parentName}</ns1:Name><ns1:Age>${import_data#parentAge}</ns1:Age>
<ns1:Child>
<ns1:Name>${import_data#ChildName1}</ns1:Name>
<ns1:Age>${import_data#ChildAge1}</ns1:Age>
</ns1:Child>
<ns1:Child>
<ns1:Name>${import_data#ChildName2}</ns1:Name>
<ns1:Age>${import_data#ChildAge2}</ns1:Age>
</ns1:Child>
</ns1:Person></ns1:People>
The point is that XML will have around 10 parents and every parent will have 5 children (the number of parents and children depend on you).
Then in Test Request property set Remove Empty Content on true. This will clear all empty XML elements. So when you dont have value in excel sheet then XML element will be empty and this will remove all of them.
Example:
I tryed to attach picture of example excel sheet. It should be somewhere above. There are 2 parents with 2 children each. So XML will have 2 parents with 2 children and values will be mapped to data source as example above. All values will be send to Test Request and fill all fields in there. Then Remove empty content remove all empty elements so you will get clean XML with same number of parents/childs set in your excel sheet.
The second:
Same principle but this one use java library (only for SoapUI Pro 4.5.0). I am using this option only when i cant use remove empty content (for example when you have in test request empty element msgParams which cant be deleted).
Regards,
MartinS