【发布时间】:2019-07-12 13:51:35
【问题描述】:
使用如下函数创建了一个示例 Python 脚本 (Elements.py):
from robot.api.deco import keyword
@keyword("join two strings")
def join_two_strings(arg1, arg2):
return arg1 + " " + arg2
然后我已将 Robot Framework 脚本(.robot 文件)作为库导入:
*** Settings ***
Library AppiumLibrary
Library Selenium2Library
Library BuiltIn
#Here is the import of Custom Lib
Library Elements.py
*** Variable ***
*** Test Cases ***
Example that calls a Python keyword
${result}= join two strings hello world
Should be equal ${result} hello world
在脚本上面运行后,出现类似“没有找到名称为'连接两个字符串'的关键字”的错误。即使我在哪里导入了自定义库。
错误信息:
[ ERROR ] Error in file C:\Users\ramana.gouda\PycharmProjects\SafeMobile\Test_Suite\TestCase_346.robot: Test library 'Elements.py' does not exist.
TestCase 346 :: Creating internal cases using device
Example that calls a Python keyword | FAIL |
No keyword with name 'join two strings' found.
【问题讨论】:
标签: python pycharm robotframework