【问题标题】:robot framework gives "no keyword with name" error after importing the python module which has the associated function机器人框架在导入具有相关功能的 python 模块后给出“no keyword with name”错误
【发布时间】:2021-12-06 22:56:42
【问题描述】:

Test.py

def test_method():
    print("hello")

regression.robot

*** Settings ***
Library               libs/Test.py

test.robot

*** Settings ***
Resource              regression/regression.robot

*** Test Cases ***
Tvh1641513c

    Test Method

请看下面的文件夹结构。

  • 测试文件夹
      • Test.py
    • 资源
      • 回归
        • regression.robot
    • 测试
      • test.robot

我相信我正确地导入了机器人文件中的模块。但我仍然收到错误“没有找到名称为'测试方法'的关键字”。如果有人可以就此提供建议,将会很有帮助。

【问题讨论】:

  • 你试过在方法名前加 def 吗?:def test_method(): print("hello")
  • @AbdElRahmanZeid 是的。我已经添加了。
  • 请显示实际错误。另外,请提供minimal reproducible example。您发布的代码均未调用 test_methodtest method
  • @BryanOakley 请查看更新的详细信息。

标签: python robotframework


【解决方案1】:

请参考Robot Framework user guide

应该在test.py中定义一个类

class test:
    def test_keyword(self):
        print("hello")

【讨论】:

    猜你喜欢
    • 2020-10-06
    • 2017-07-25
    • 2015-10-06
    • 2019-08-11
    • 2017-06-17
    • 2021-04-26
    • 1970-01-01
    • 2020-09-25
    • 2016-02-23
    相关资源
    最近更新 更多