how to call functions in python into Robot Framework

8,001 views
Skip to first unread message

Philip

unread,
Jun 1, 2016, 6:59:57 PM6/1/16
to robotframework-users



I have a library file  stringFunction.py and this library file has several functions (def:)
For instance:
Function 1 (def1) calls function2, function3, and function4


    def1():
         z = def2 (x,y)
         t =  def 3(3,2)
         r = def 4(2)
   return z+t+r

    def 2 (a, b)
       .....

    def 3(r,t):
       .....
  

    def 4(r):
       ......


In Robot Framework, I import the stringFunction.py in that test suite
then I call the function1 (def1) in a test case such as 
           ${tz} = stringFunction.def1

Robot Framework always give me the error, "def1" has not declared in a global or undefined etc .

Would you please give me an advice how to call the def1 into Robot Framework while def1 is calling def2, def3, def4

Tatu Aalto

unread,
Jun 2, 2016, 1:21:15 AM6/2/16
to pdo...@gmail.com, robotframework-users

Ugh

This is explained in the user guide: http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#what-methods-are-considered-keywords

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

Philip

unread,
Jun 2, 2016, 2:20:40 AM6/2/16
to robotframework-users, pdo...@gmail.com
I read that section in the user guide but still don't get it : )
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.

J Wipf

unread,
Jun 2, 2016, 6:39:39 AM6/2/16
to robotframework-users
you don't have def in front of def1
def def1():

$
{tz} = stringFunction.def1

Tatu Aalto

unread,
Jun 2, 2016, 10:37:12 AM6/2/16
to Phillip Do, robotframework-users

Ugh

Then perhaps reading basic of Python is needed. When I did start with Python, I did read Dive into Python: http://www.diveintopython.net

-Tatu

To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.

To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages