I'm new to Python. I would like to run Behave on an IDE.
So I'm trying to run the official tutorial of Behave.
When I run behave in a terminal command everything is OK. So I guess code/installation are OK !
Issues :
1 - I don't know why I still have those errors (Undefined variables given, when, then)
2 - 0 test executed when I do right click on step.py, "Run as Python unit-test"
3 - "no matching glue code" warning on my .feature file
Environment : Pydev and Cucumber plugins, Eclipse Neon, Jdk 8, Windows 10 64bits, Python 3.7.2 Behave 1.2.6
My problem was : "I want an IDE where I can execute Behave"
Pycharm do the job.
I made a script to execute tests easily :
cd /D %~dp0
behave
Well, if you just want to integrate with an external runner, you can do it in PyDev too by using an external launch configuration (in the menu: run > external tools
).
Another option for using it in PyDev, could be using a pytest with pytest-bdd to run it (to run pytest on PyDev you have to configure the runner in the preferences > pydev > pyunit
).
Regarding imports not found, try adding behave
to the forced builtins
(see http://www.pydev.org/manual_101_interpreter.html for instructions) and to avoid unused imports, import just what you want ( from behave import when, given, then
) or add a #noqa
in that line.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.