If i place getCell(0,0) in String reqTagName = sheet1.getCell(0,0).getContents() for the below code then, it is only executing the first value from the sheet. B
Try this code change below and let me know if it worked :
import com.eviware.soapui.support.XmlHolder
import java.io.File
import java.io.IOException
import jxl.*
import jxl.read.biff.BiffException
import jxl.write.*
import jxl.write.Label
log.info("Testing Started")
def reqOperationName = "getInsuranceDetails_1_FTC_005"
def inputDataFileName = "D:/SOAP UI Pro/MPI.xls"
def inputDataSheetName = "MPI"
Workbook workbook = Workbook.getWorkbook(new File(inputDataFileName))
Sheet sheet1 = workbook.getSheet(inputDataSheetName)
def myList = new ArrayList();
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
String xmlResponse = reqOperationName+"#Request"
def reqholder = groovyUtils.getXmlHolder(xmlResponse)
try{
rowcount = sheet1.getRows()
colcount = sheet1.getColumns()
for(Row in 1..rowcount-1){
String reqTagName = sheet1.getCell(0,0).getContents()
def TagCount = reqholder["count(//*:"+reqTagName+")"]
if(TagCount!=0){
String reqTagValue = sheet1.getCell(0,Row).getContents()
if(reqTagValue!=null && !reqTagValue.isEmpty() && reqTagValue!="")
{
reqholder = groovyUtils.getXmlHolder(xmlResponse)
log.info "extracted value : " + reqTagValue
reqholder.setNodeValue("//*:"+reqTagName, reqTagValue)
reqholder.updateProperty()
log.info "node value : " + reqholder.getNodeValue("//*:"+reqTagName)
//test the request
testRunner.runTestStepByName(reqOperationName)
reqholder = groovyUtils.getXmlHolder(reqOperationName+"#Response")
myList.add(reqholder.getPrettyXml().toString())
log.info myList[Row-1]
}
}
}
}
catch (Exception e) {log.info(e)}
finally{
workbook.close()
}
Workbook existingWorkbook = Workbook.getWorkbook(new File(inputDataFileName));
WritableWorkbook workbookCopy = Workbook.createWorkbook(new File(inputDataFileName), existingWorkbook);
try
{
WritableSheet sheetToEdit = workbookCopy.getSheet(inputDataSheetName);
WritableCell cell;
for (int i =1;i