Forum Discussion

spartanhooah's avatar
spartanhooah
Occasional Contributor
8 years ago

Use lines from a file as SOAP request bodies

I have a file which has one chunk of XML (representing the body of a SOAP request) per line. I want to be able to have SoapUI hit an API with requests built from each line of that file. I tried doing this in my Groovy script step:

 

new File('test_file').eachLine {
	{line -> 
		context.setProperty("requestBody", line)
		testRunner.runTestStepByName("RequestStep")
	}
}

My TestCase has the Groovy script step followed by the RequestStep, but all I see in the console when I run the TestCase is 

 

  • Test started at 2017-09-06 13:27:40.729
  • Step 1 [Driver] OK: took 18 ms
  • -> Script-result: Script16$_run_closure1_closure2@3be77f1
  • TestCase finished with status [FINISHED], time taken = 74
  • Step 2 [RequestStep] OK: took 56 ms

It seems that the steps are not looping properly. Is there a way to do this?

No RepliesBe the first to reply