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
I have used the Intellibot PyCharm plugin for Robot Framework.
For running the tests, we can do the below configuration:
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.
The most straightforward way is to create a run configuration, and then using the Run commands.
Here's a sample screenshot - it's invoked in the menu Run->Run Configurations, explanations follows:
1) in the screenshot is the location of the RF run.py file - it is located in the directory Lib\site-packages\robot in your python install - or virtualenv as in the shown case.
2) is the very same python interpreter - make sure it's the same as the one used in 1) (or it may get messy :)
3) are the parameters you'd normally pass on to robot when running it from the command line. The bare minimum is to provide the path to the suite(s) that must be ran - the last parameter in the example screenshot.
PyCharm doesn't have the option to "run this specific test case" by right-clicking on it - because RF depends this information (which case exactly) to be provided on the CLI.
This case selection can be done in a number of ways - just look at the Robotframework's execution selectors (by tags, by case names, etc). All of these options are set in the "Script parameters:" box in the run config; for example, to run tests having a tag Sanity, use --include sanity, to run a specific test case - --name "My test case", and so on.
By the way, one of the greatest benefits of using run configuraitons is that you can debug the execution - i.e. using an IDE for what it's best suited :)
A run configuration does not depend on any plugin being installed - though IntelliBot is an "absolute must" for developing the cases IMO, as seen from the steps it has no relation to the execution/running.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With