Subburaj
Subburaj

Reputation: 2334

How to run multiple request in SOAP UI and Store all Response?

I am having some 100 Request in one folder.I wish to run all the request one by one and need to capture the response for all the request in SOAP UI.

Could someone help me on this with the details?

Upvotes: 4

Views: 30334

Answers (1)

Rao
Rao

Reputation: 21369

Here you can create a test case with two steps:

  • Groovy Script step
  • SOAP Request step

Groovy Script step:

  1. provide directory location as input to this step
  2. read a file as text
  3. set text as request for soap request step
  4. run the soap request step
  5. read the response and save the result
  6. repeat till the file list lasts and exist (do not allow to the soap step one more time)

SOAP Request Step this will initially have some request, and above groovy step overwrites each time it reads file.

So, you have to implement the groovy using above sudo steps.

Hope this helps.

UPDATE based on the below comments, adding the groovy script.

/**
* Closure definition requires inputs
* stepIndex : index of the request step where new content to be set
* contentToSet : the new request read from file
**/
def setRequest = { stepIndex, contentToSet ->
    def step = context.testCase.testStepList[stepIndex]
    step.testRequest.requestContent = contentToSet
}
//You may read a directory get the list of files and loop thru below steps for each file

//Read the request from file
def content = new File('/file/absolute/path').text

//Call above closure
//Assuming that Test Request step the second step, index becomes 1
setRequest(1, content)

Upvotes: 3

Related Questions