Forum Discussion

joakimrosendahl's avatar
joakimrosendahl
New Contributor
15 years ago

Temporarily remove optional elements

Hi,

I'm trying to setup a test case where I can temporarily remove optional elements from the request. I've setup a test case that reads input data from an excel data source and executes a call to a web service for each row in the excel source:


Now we are creating more complex tests, setting the optional elements in an arbitrary way. I need help with seting up my test case to support this. I have a worksheet in the excel for each optional element. For each row in the worksheet there is a field representing whether or not to use the optional input or not. What I want to do in soapui is:
read the excel source -> loop through the data source -> databind property to the request -> remove the optional elements from the current request according to the field mentioned above -> call the web service.

Any ideas how to solve this? The only idea I have is to have to two SOAP call test steps: One that is the complete call inlcuding all optional elements and this one will work as a template. Then a second call step that will be used for the actuall call, but will be modified prior to the call. After the call I want to restore the second call to match the template (copy and replace?). I know that I can modify the request using a script, but I don't know how to restore it afterwards. Is this a proper solution?

Regards,
Joakim.
  • I'm gonna answer on my own post =)

    Well, it seems like the idea kind of works. Need to gather all input data into one worksheet in Excel though (I can only iterate one data source?). Which leads to a worksheet with ~100 columns! But the rest seems to be feasible with a couple of scripts steps and a property transfer:
      TemplateCall (SOAP step, disabled)
      ExcelSource (Data source step)
      ExecuteIteration (Script step)
      RemoveUnwantedNodesFromRequest (Script step, disabled)
      Call (SOAP step, disabled)
      RecreateRequest (Property Transfer step, disabled)
      LoopSource (Data loop step, Source = ExcelSource, TargetStep = ExecuteIteration)


    Something like that, if it's possible to execute disabled steps from script code. Is this the way to go?

    Regards,
    Joakim.
  • Hej Joakim!

    I'll move this topic to the soapUI Community Board, in which discussions regarding soapUI are held. If you are looking for forum and/or e-mail support from eviware, you might want to consider purchasing soapUI Pro.

    /Henrik
    eviware.com