Hi together
I’m new in using eggplant but with know how of using OOP.
I’ve reading the part of ‘Objects Designed to be Helpers’ of the eggplant documentation and want to create an helper that will handle my excel for advanced test sequences.
I tried to open the excel file in the created object but I got an error message, when I open the worksheet.
error: “Workbook Error - Wrong file type (must be ‘xls’ or ‘xlsx’ file): /Users/myUser/Workplace/{/}”
On the code line "set wsValues to Worksheet(excelWorkbook,1) " raise the error.
When I execute the Script Main_Second (see below) then I get no error, it just works. I cannot understand why the same code not works, if it is in a created helper ??
Can here somebody help?
here my code lines:
Script Main:
put new "Helpers/helperTestSequence" into testSequence
put testSequence.getStepList() into stepList
Script helperTestSequence
to getStepList
try
set excelWorkbook to Workbook(ResourcePath("Messages/Test_1.xlsx"))
set wsValues to Worksheet(excelWorkbook,1) // here will raise the error.
// here read the excel content into a indexed list...
catch excOpenFile
throw excOpenFile
end try
// return the indexed list...
return ixList
End getStepList
Script Main_Second:
put "Helpers/helperTestSequence".getStepList() into stepList