With Robot Framework you don't need Jython, it is just an option. Python is all you need.
Your for loop is not valid, it should be like this:
*** Variables ***
@{list} foo bar lorem ipsum dolor sit amet
*** Test Cases ***
Example
: FOR ${item} IN @{list}
\ Log ${item}
If you save that as an example.txt
and run pybot example.txt
in the same directory, it passes and logs all items of list
individually.
In order to use Call Method
you need to have some object with methods to call. So you must have a python file which has a class, function and have that class instantiated and assigned to a variable. Like this:
class MyObject:
def __init__(self):
self.args = None
def my_method(self, *args):
self.args = args
obj = MyObject()
and save that to vars.py
(same directory as example.txt
) and then put this in to your example.txt
*** Settings ***
Variables vars.py
*** Variables ***
@{list} foo bar lorem ipsum dolor sit amet
*** Test Cases ***
Example
: FOR ${item} IN @{list}
\ Log ${item}
Example2
Call Method ${obj} my_method
Should Be True ${obj.args} == ()
Call Method ${obj} my_method arg
Should Be True ${obj.args} == ('arg',)
Call Method ${obj} my_method a1 a2
Should Be True ${obj.args} == ('a1','a2')
But my guess is that you don't really want to use Call Method
at this point.