2016-11-08 89 views
-3

我正在使用ride,我想知道如何在ROBOT中創建自定義庫。 任何人都可以解釋我使用基本的Python程序,並在機器人中調用該程序的方法?如何在Robot Framework中創建庫?

+0

首先閱讀文檔:http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#creating-test-library-class-or-module –

回答

1

這裏有一個簡單的例子:

Python文件名 「helloworld.py」 載:

class helloworld(): 
     def __init__(self): 
       ROBOT_LIBRARY_SCOPE = 'GLOBAL' 


     def printHelloWorld(self): 
       return "Hello World" 

的機器人文件

*** Settings *** 
Library    helloworld.py 

*** Test Cases *** 
MyTestCase 
      ${x}= Print Hello World 
      log to console   ${x} 

這版畫 「的Hello World」 上安慰。

相關問題