Running tests on PyCharm using Robot Framework

前端 未结 4 2032
天命终不由人
天命终不由人 2020-12-05 12:11

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 Empt

4条回答
  •  情歌与酒
    2020-12-05 13:04

    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.

提交回复
热议问题