I have a Python module having 2 classes. Each class has a set of functions or methods defined. How can we call a particular method from a class in the ROBOT framework. I am trying the below method however, its giving the following errors. Can someone please help me in figuring the issue over here. The Python module and the Robot files are in the same path.I have tried changing the library statement to CheckCode.employee WITH_NAME xyz. This hasnt helped. Thanks.
ERRORS
==============
[ WARN ] Imported library '/homes/user/New/CheckCode.py' contains no keywords.
==============================================================================
CheckCode :: Checking small built in code
==============================================================================
Verify we can call a particular class from a Python Module in Robot | FAIL |
No keyword with name 'my_code.employee.staff info' found.
------------------------------------------------------------------------------
CheckCode :: Checking small built in code | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================
Python Module File output
******************************
import re
import collections
import math
class person():
def __init__(self,first,last):
self.firstname = first
self.lastname = last
def emp_name(self):
return self.firstname + " " + self.lastname
class employee(person):
def __init__(self,first,last,empId):
person.__init__(self,first,last)
self.staffId = empId
def staff_info(self):
return self.Name() + " " + self.staffId
ROBOT FILE
******************************
*** Settings ***
Documentation Checking small built in code
Library BuiltIn
Library Collections
Library CheckCode.py WITH NAME my_code
*** Test Cases ***
Verify we can call a particular class from a Python Module in Robot
Log Hello World
${var} = my_code.employee.staff info Maggi Nestle 20000
*** Keywords ***
Init
Set Log Level DEBUG