Running tests on PyCharm using Robot Framework

Guilherme Pimentel Saraiva picture Guilherme Pimentel Saraiva · Dec 2, 2014 · Viewed 33.8k times · Source

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?

This is my code:

*** 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    

Answer

Mukesh Takhtani picture Mukesh Takhtani · Jan 3, 2015

I have used the Intellibot PyCharm plugin for Robot Framework.

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

  1. Go to File > Settings > External Tools
  2. Click '+' button under 'External Tools' panel
  3. In the 'Create Tool' dialog, enter the below values:
    • Name: Robot
    • Program: [Path of Pybot.bat e.g.C:\Python27\Scripts\Pybot.bat]
    • Parameters: $FileName$
    • Working Directory: $FileDir$
  4. Click OK

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.