Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run a feature file using Pycharm Community

I have installed the behave 1.2.5 and PyCharm Community. When I right click the feature file I do not see an option called Run as feature file.

How do I set the Run configuration

Run Configuration

like image 366
Ashok kumar Ganesan Avatar asked Dec 23 '22 23:12

Ashok kumar Ganesan


2 Answers

I know this is an old question, but maybe other people have this same issue.

You can setup PyCharm Community like this:

Copy Behave Path:

enter image description here

And paste it in 'Script':

enter image description here

like image 144
Lucas Mello Avatar answered Dec 26 '22 20:12

Lucas Mello


As others have stated, PyCharm community edition is not going to be much help when it comes to behave support. You can however create a testAllFeatures.py with roughly this content:

if __name__ == '__main__':
    from behave import __main__ as behave_executable
    behave_executable.main(None)

You will get the usual "Run" context menu for this file. Let's call this an executor for now as I don't know if there is any wide-spread term for this. This does the equivalent of executing behave in its directory. You can then play around with tags and a few similar executors (with args!=None parameters, of course) to call up different sets of your scenarios.

An alternative is to create "Run configuration(s)" in PyCharm to call the behave cli. The advantage of the above outlined executor approach is that you can run the executors even when you are not using PyCharm, including a CI environment.

like image 21
Szabo Peter Avatar answered Dec 26 '22 20:12

Szabo Peter