my test step running infinite
dear all,
I have a test step, when I run manually, it runs well.
But when I ran it from a groovy script it is running infinite.
here is my groovy script:
//this code is working
//grasping data from excel
import org.apache.poi.ss.usermodel.*
import org.apache.poi.hssf.usermodel.*
import org.apache.poi.xssf.usermodel.*
import org.apache.poi.ss.util.*
//myTestCase contains the test case
def myTestCase = context.testCase
//open an excel file
def fs = new FileInputStream ("/Users/xxx/Documents/soapUIworkspace/xxx/logindata.xlsx")
//def a workbook
Workbook wb = WorkbookFactory.create(fs)
//def the worksheet location in the excel file
def ws = wb.getSheet("Sheet1")
//count the rows
def r = ws.getPhysicalNumberOfRows()
// get the Property TestStep object
propTestStep = myTestCase.getTestStepByName("Property - addingAccount")
project = testRunner.getTestCase().getTestSuite().getProject().getWorkspace().getProjectByName("xxxx")
testSuite = project.getTestSuiteByName("testSuite");
testCase = testSuite.getTestCaseByName("TestCase");
//read the cell
for (def i=0; i<r; i++) {
def row = ws.getRow(i)
def c = row.getPhysicalNumberOfCells()
log.info "row "+i
//if (!(i == 0)) {
// runner = testCase.run(new com.eviware.soapui.support.types.StringToObjectMap(), false);
//}
for(def j=0; j<c;j++) {
def cell = row.getCell(j)
if (j == 0) {
log.info j
user = cell.getStringCellValue()
propTestStep.setPropertyValue("name", user) //the value is saved in the property
log.info user
//log.info cell.getStringCellValue()
} else {
log.info j
pass = cell.getStringCellValue()
propTestStep.setPropertyValue("value", pass) //the value is saved in the property
log.info pass
//log.info cell.getStringCellValue()
}
}
runner = testCase.run(new com.eviware.soapui.support.types.StringToObjectMap(), true);
//Thread.sleep(3000)
}
log.info r
wb.close()
thank you.