导入库不包含关键字

Cha*_*mar 4 robotframework

我是机器人框架的初学者。我想使用我自己的库,导入并编写测试用例。不幸的是,我面临一个错误“导入库不包含关键字”。我已经在堆栈溢出中浏览了一些与此相关的帖子,但我仍然我无法弄清楚机器人框架中的问题。我可能正在做一些愚蠢的事情。这是我在python中的代码

class ExampleLibrary(object):

    def __init__(self):        
        print "Hello"
    def hello(self):
        print "The given name"
Run Code Online (Sandbox Code Playgroud)

这是错误 [ WARN ] 导入的库 RobotFramework\TestSuite\Testclass.py' 不包含关键字。

我已将 .py 文件放在与测试用例相同的目录中。

机器人框架脚本

*** Settings ***

Library           Testclass.py

*** Test Cases ***

LibraryTest

    hello
Run Code Online (Sandbox Code Playgroud)

请帮忙

提前致谢

小智 8

库的类名必须与文件名相同。请看看这个:http : //robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#creating-test-library-class-or-module

class Testclass(object):

    def __init__(self):
        print "Hello"

    def hello(self):
        print "The given name"
Run Code Online (Sandbox Code Playgroud)