kondasamy wrote:
This should be possible through Groovy Script! I hope the below links would help to solve your scenario,
Thanks,
Samy
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others, Thanks. ↓↓↓
Samy, thanks for the reply but what the links contain have already been implemented on my code, I can get one cicle working but I want to automate the whole process and I believe that to achieve it I must get a nested cycle.
I might be wrong but given the little knowledge I have, I believe it just might be it. I got some groovy scripts working on that end. My test case is like this:
1. Groovy script
2. Properties
3. Soap request
4. Loop
On the groovy script I got:
import com.eviware.soapui.support.XmlHolder
import jxl.*
import jxl.write.*
def myTestCase = context.testCase
def counter,next,previous,size
Workbook workbook1 = Workbook.getWorkbook(new File("C:\\Users\\User\\Documents\\IN\\PH\\NI\\macs.xls"))
Sheet sheet1 = workbook1.getSheet(0)
size=sheet1.getRows().toInteger()
propTestStep = myTestCase.getTestStepByName("Properties")
propTestStep.setPropertyValue("Total",size.toString())
counter = propTestStep.getPropertyValue("Count").toString()
counter = counter.toInteger()
next = (counter>size-2?0:counter+1)
Cell u = sheet1.getCell(0,counter)
workbook1.close()
MAC = u.getContents()
propTestStep.setPropertyValue("MAC",MAC)
propTestStep.setPropertyValue("Count",next.toString())
next++
propTestStep.setPropertyValue("Next",next.toString())
if(counter==size-1)
{
propTestStep.setPropertyValue("StopLoop","T")
log.info"Setting the stoploop property now..."
}
else if(counter==0)
{
def runner=new com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner(testRunner.testCase,null)
propTestStep.setPropertyValue("StopLoop","F")
}
else
{
propTestStep.setPropertyValue("StopLoop","F")
}
With that code, I can get the script to run all the Mac Addresses I insert on the file but I need to insert another cycle to run this script for every line on the second worksheet of the "macs.xls" file.