Error when read excel file

Hi, I tried to run script from tutorial on katalon.com on subject data driven and when execute from a test case get error below:

  • Test Cases/Data Driven Demoaut FAILED because (of) org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object ‘com.kms.katalon.core.testdata.reader.SheetPOI@15f4d54’ with class ‘com.kms.katalon.core.testdata.reader.SheetPOI’ to class ‘com.kms.katalon.core.testdata.InternalData’

How to fix this error…?

Thank In advance,
BrotoV

ExcelData firstNameData = findTestData(“firstNameData”)

Use ExcelData not internalData or something else :slight_smile:

Thanks, solved…we should use InternalData not Excel Data…

Hello Broto,

How did you solved your problem please ?

Thanks

sgazeaux said:

Hello Broto,

How did you solved your problem please ?

Thanks

From the tutorial script, swap out “internalData” with “ExcelData”

Hi, I tried to run script from tutorial on katalon.com on subject data driven and when execute from a test case get error below:

  • Test Cases/Data Driven Demoaut FAILED because (of) org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object ‘com.kms.katalon.core.testdata.reader.SheetPOI@15f4d54’ with class ‘com.kms.katalon.core.testdata.reader.SheetPOI’ to class ‘com.kms.katalon.core.testdata.InternalData’

How to fix this error…?

**Hi Guys Follow this steps Give the Excel Header name in Passing Values **:slight_smile:
Read Excel Data From Excel File

Exceldata = findTestData(“New Test Data”)

WebUI.delay(3)

for (def index : (1…Exceldata.getRowNumbers() - 1))

{

WebUI.setText(findTestObject(‘CM/Page_CMO login/input_txtusername’),Exceldata.getValue(“Username”, index))

WebUI.setText(findTestObject(‘CM/Page_CMO login/input_txtpassword’),Exceldata.getValue(“Password”, index))

WebUI.delay(3)

}

Broto Winarno said:

Hi, I tried to run script from tutorial on katalon.com on subject data driven and when execute from a test case get error below:

  • Test Cases/Data Driven Demoaut FAILED because (of) org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object ‘com.kms.katalon.core.testdata.reader.SheetPOI@15f4d54’ with class ‘com.kms.katalon.core.testdata.reader.SheetPOI’ to class ‘com.kms.katalon.core.testdata.InternalData’

How to fix this error…?

Thank In advance,

BrotoV

**Hi Bro Follow this steps Give the Excel Header name in Passing Values **
Read Excel Data From Excel File

In My Excel File

UserName Password
Guru 123
Raja 123

Pass Username and it’s index
Pass Password and it’s index

Exceldata = findTestData(“New Test Data”)

WebUI.delay(3)

for (def index : (1…Exceldata.getRowNumbers() - 1))

{

WebUI.setText(findTestObject(‘CM/Page_CMO login/input_txtusername’),Exceldata.getValue(“Username”, index))

WebUI.setText(findTestObject(‘CM/Page_CMO login/input_txtpassword’),Exceldata.getValue(“Password”, index))

WebUI.delay(3)

}