robotframework - Different type of input data between Robot Framework file and Python -


i'm writing excel library own testing.

  1. original python library 'readexcel.py':

    from xlrd import open_workbook, xl_cell_text   class read_excel:         def __init__(self,excel_file):              self.excel_file = excel_file              self.book = open_workbook(self.excel_file)              self.sheet1_name = self.book.sheet_names()         def take_sheet_name(self,name):             self.name = name             return self.name         def cell_value(self,row_index,col_index):             self.row_index = row_index             self.col_index = col_index                  sheet = self.book.sheet_by_name(self.name)              cell_value = sheet.cell(self.row_index,self.col_index).value             return cell_value 

run example check whether program can value of cell(0,1) via eclipse or not?

y = read_excel('simple.xlsx')  y.take_sheet_name('name1')  print y.cell_value(0,1)  result:  11   --> number actual value on cell(0,1) 

copy python file python library/site-package folder , rename 'readexcel1.py' write test case base on readexcel1.py library

*** settings *** documentation       resource file google test suite.  library             selenium2library         library             readexcel1                   c:\\automation_project\\robot_framework\\testing\\check_activity\\simple.xlsx  *** test cases *** check library     take sheet name    name1   --> pass     cell value    0   1        --> failed 

the log show message below:

the list indices must integers, not unicode 

so, think due input '0 1' @ cell value command line string, force them integer type in readexcel1.py

self.row_index = int(row_index) self.col_index = int(col_index)  

this solves problem.

but wonder why don't need force changing type in original readexcel.py, , python can understand input '0 1' number. in readexcel1.py, robot understands '0 1' string , have force changing type 'row_index, col_index' ?

please me make issue clearly.

thanks.

by default rf pass arguments string 0 , string 1. if want pass integer 0 , integer 1, use ${0} , ${1}

see http://robotframework.org/robotframework/latest/robotframeworkuserguide.html#number-variables


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -