使用 Robot Framework 在 PyCharm 上运行测试 [英] Running tests on PyCharm using Robot Framework

查看:97
本文介绍了使用 Robot Framework 在 PyCharm 上运行测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始将 PyCharm 与 robot 框架结合使用,但我遇到了一个问题.我怎样才能运行我的测试?每次我右键单击我的测试文件夹时,我都会从控制台日志中收到一条 Empty testsuit 消息.

I started using PyCharm with the robot framework, but I'm facing an issue. How can I run my tests? All the time I right click on my tests folder, I get an Empty test suit message from the console log.

有没有办法单独运行每个测试,比如右键单击测试用例并点击测试运行器?

Is there any way to run each test separately like right click on the test case and hit the test runner?

这是我的代码:

*** Settings ***
Library     Selenium2Library
Resource    /steps/keywords.txt

*** Variables ***
${URL}         http://www.google.com

*** Keywords ***
Open browser with URL
    [arguments]     ${url}
    Open Browser    ${url}  browser=gc

Set input on text box
    [arguments]     ${xpath}    ${text}
    Input text      ${xpath}    ${text}

Push button
    [arguments]     ${button}
    Click Button    ${button}

*** Test Cases ***
Google Access
    Open browser with URL   ${URL}
    Set input on text box   //*[@id="gbqfq"]    Critical Software
    Push button             //*[@id="gbqfba"]

    #Close Browser    

推荐答案

我使用了 Intellibot PyCharmRobot Framework 插件.

I have used the Intellibot PyCharm plugin for Robot Framework.

为了运行测试,我们可以做以下配置:

For running the tests, we can do the below configuration:

  1. 转到文件 > 设置 > 外部工具
  2. 点击外部工具"面板下的+"按钮
  3. 在创建工具"对话框中,输入以下值:
    • 名称:机器人
    • 程序:[Pybot.bat的路径例如C:\Python27\Scripts\Pybot.bat]
    • 参数:$FileName$
    • 工作目录:$FileDir$

完成上述配置后,我们将在 IDE 测试的上下文菜单中获得Robot"选项.选择该选项以在 PyCharm 中运行您的测试套件.

Once the above configuration is done, we get the option 'Robot' in the context menu on the test in the IDE. Choose that option to run your test suite in PyCharm.

这篇关于使用 Robot Framework 在 PyCharm 上运行测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆