【问题标题】:Is it possible to go to python method definition from a robot framework keyword?是否可以从机器人框架关键字转到 python 方法定义?
【发布时间】:2019-10-24 18:28:06
【问题描述】:

我想使用键盘快捷键从机器人框架文件中执行 python 方法。这可能吗?

机器人框架关键字:

Check something
    Given I have my scenario configured
    When I configure something
    Then Something else happens

Library  myClass.py

myClass.py 上的 Python 方法:

from robot.api.deco import keyword

class myClass(object):
    @keyword('I configure something')
    def i_configure_something(self):
        self.configure()

我会用 Gherkin 解释我想要什么:P

Given I am using VS Code to edit my files
When I highlight the keyword "I configure something"
And I press F12
Then I want it to open my python file and go directly to the method definition.

【问题讨论】:

    标签: python visual-studio-code robotframework


    【解决方案1】:

    是的,这是可能的。我们使用 PyCharm 和 Intellibot 插件。这是迄今为止我找到的最好的解决方案。在 PyCharm 中,我们可以使用 Ctrl+B 直接从关键字转到 python 方法

    也可以使用带有 Red 插件的 Eclipse 来实现,但我不知道相同的快捷方式。

    【讨论】:

      【解决方案2】:

      对于 VSCode,我使用 Robot Framework Intellisense

      【讨论】:

      • 我应该使用什么配置?我的设置: "rfLanguageServer.includePaths": [ "*/.robot", "*/.rst", "*/.py " ] "files.associations": { ".rst": "robot", ".robot": "robot" },
      • 它应该已经有了你想要的配置,检查文档中的“转到定义”和“查找所有引用”部分:marketplace.visualstudio.com/…
      【解决方案3】:

      我使用 Pycharm 超过 2 年,并且我使用插件:

      • 机器人框架支持
      • IntelliBot @SeleniumLibrary 已修补(也可以使用 selenium 关键字...因为我们从 Selenium2Library 更改为 SeleniumLibrary)

      【讨论】:

        猜你喜欢
        • 2014-05-21
        • 2018-08-01
        • 2013-11-08
        • 2018-11-01
        • 2016-01-03
        • 2017-10-13
        • 2020-04-21
        • 2015-10-14
        • 2019-06-11
        相关资源
        最近更新 更多