Contributions
Re: DataSource Loop with variable number of child elements
Hi, I've found an easier scenario I can test this on and setup the test case to use a DataSource type Grid (similar to my original test case with 5 attributes and one of those optional) and other steps below. richieApologies but I'm unsure what to do with the properties steps, still new to this. The Groovy script appears to need the request just before its sent out the door to remove those empty elements but I'm unsure how a Property Step (or Property Transfer?) would help get it into this state. Get MLAs List service currently returns an empty parent tag after the empty mlaid element was removed by the case level remove empty element flag. <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header/> <soapenv:Body> <ns:GetMlasList> <ns:mlas> <ns:mla> <ns:mlaid>2</ns:mlaid> </ns:mla> <ns:mla> </ns:mla> </ns:mlas> <!--Optional:--> <ns:activeOnly>Y</ns:activeOnly> <!--Optional:--> <ns2:pageSize>10</ns2:pageSize> <!--Optional:--> <ns2:rowNumber>1</ns2:rowNumber> </ns:GetMlasList> </soapenv:Body> </soapenv:Envelope> Here is a picture of the two scenarios in the Grid, second one has the empty element you can see above. Cheers Alan4 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.7KViews0likes0Comments- 4 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.8KViews0likes4Comments
DataSource Loop with variable number of child elements
Hi I've just started using ReadyAPI 3.4.5 after being on SoapUI for a while. I'm testing an external vendor API and trying to pass in all my scenario data through one DataSource, ideally. My problem is that each of the test cases has a different number of elements applied to a complex element, e.g. Test 1 may have the following elements for specifying contributions ... <contributions> <contribution> <type>Single</type> <amount>1000</type> </contribution> <type>Regular</type> <amount>100</type> <startDate>1-1-2020</startDate> </contribution> ... The next test might only have one Single contribution defined. There are a few complex elements that I adjust for each test and have a similar problem. I've set the flag for "Remove Empty Content" to try and remove any elements where nothing is passed in from the DataSource but this leaves the parent node empty "<contribution></contribution>" which unfortunately breaks the test. I've researched ways that this might be able to be resolved using Events with RequestFilter.filterRequest but the supplied groovy script doesn't appear to work well with DataSource data, instead it passes the property name in as a string to the request, e.g. ${DataSource#Single-Amount} See section 4.5 in https://www.soapui.org/docs/scripting-and-properties/tips-tricks/and https://support.smartbear.com/readyapi/docs/testing/scripts/samples/xml.html Seems like a similar issue was raised here but the user didn't confirm whether it fixed their problem or not https://community.smartbear.com/t5/API-Functional-Security-Testing/Remove-Empty-Content/td-p/18426 The only way I can think of getting around this is not using the DataSource at all and, instead, crafting each test step as a specific test. I'm not a tester by profession so perhaps this is the way more seasoned testers craft tests when they have these limitations, I just wanted to control the test data from the one view point. I also thought a RegEx over the expanded request, with DataSource data populated in, just before it gets sent I could replaceAll some of the fields but couldnt work out an event or script to get the XML at this point. Cheers AlanSolved1.9KViews0likes6Comments