gpt4 book ai didi

robotframework - 导入库不包含关键字

转载 作者:行者123 更新时间:2023-12-03 19:54:30 26 4
gpt4 key购买 nike

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

class ExampleLibrary(object):

def __init__(self):
print "Hello"
def hello(self):
print "The given name"

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

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

机器人框架脚本
*** Settings ***

Library Testclass.py

*** Test Cases ***

LibraryTest

hello

请帮忙

提前致谢

最佳答案

库的类名必须与文件名相同。请看看这个:
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"

关于robotframework - 导入库不包含关键字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37719355/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com