Contributions
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
I have a Groovyscript to get data from an excel file in a soapui massage. Groovy script: import com.eviware.soapui.model.*; import com.eviware.soapui.model.testsuite.Assertable; import com.eviware.soapui.support.XmlHolder; import java.io.File; import java.util.*; import jxl.write.*; import jxl.*; def regLogger = org.apache.log4j.Logger.getLogger("RegresssionTestLogger"); def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context) def properties = new java.util.Properties(); //context.expand('${Properties#propertyname}' def s2; def s3=(testRunner.testCase.getPropertyValue("RUN")); def a1; regLogger.info (s3); if (s3 != "1" && s3 != "2" && s3 != '3') { testRunner.testCase.setPropertyValue("RUN", '1'); s3=(testRunner.testCase.getPropertyValue("RUN")); } Workbook workbook = Workbook.getWorkbook(new File("C:\\Data\\SoapUI_Excel_Files\\Test1.xls")); for (count in 1..< 11) // this is form row 1 to row 11 based on the numbers of properties that // you have in the excel sheet in this case the value is 10 { Sheet sheet = workbook.getSheet(1); Cell al = sheet.getCell(count,0); // getCell(row,column)-place some value in myfile.xls Cell b2 = sheet.getCell (count,s3.toInteger()); // value will be acessed using a1,b2 & c3 Cell println a1; println b2; String s1 = a1.getContents(); s2 = b2.getContents(); testRunner.testCase.setPropertyValue(s1,s2); } workbook.close(); error message: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 error at line: 30 The only sheet in the excel is Sheet1 Can any one help me to fix this issue?Solved3.7KViews0likes1Comment