I have a python class MyClass
written in file MyClass.py
:
class MyClass(object):
def __init__(self):
self.myvar = list()
def setvar(self, val):
self.myvar = val
def mymethod(self):
return self.myvar
I have imported in Robot Framework as below:
Library MyClass WITH NAME my_component
I also have a keyword which call a method of objects which are passed to it:
testing component
[Arguments] ${cmp}
log to console ************* ${cmp}
${result} = ${cmp}.mymethod
I have multiple objects instantiated from class MyClass
and every object has different properties. I want to get their attributes using testing component
keyword regardless of the object itself.
When I call testing component
passing my_component
:
Test Method Call
testing component my_component
I get:
No keyword with name '${cmp}.mymethod' found.
If I call it this way in keyword testing component
:
${result} = call method ${cmp} mymethod
I get:
Object 'my_component' does not have method 'mymethod'.
I also tried call method my_component mymethod
for test and I again got Object 'my_component' does not have method 'mymethod'.
.
But when I use ${result} = my_component.mymethod
, everything works fine.