https://pantsbuild.org/ logo
#general
Title
# general
b

boundless-zebra-79556

10/18/2022, 1:07 PM
Hi all, I'm looking to introduce BDD to our monorepo, and wonder how much work it will be to use
behave
for testing BDDs. I would just need to invoke
behave
instead of
pytest
and maybe tweak some args here and there.
c

curved-television-6568

10/18/2022, 1:13 PM
@powerful-umbrella-75231 has a use case of this he might be willing to share a bit of.. 😉 ?
h

happy-kitchen-89482

10/18/2022, 3:04 PM
Hi! I don’t know much about behave. Is it more-or-less a drop-in replacement for pytest?
c

curved-television-6568

10/18/2022, 3:08 PM
No, it’s a different way of running tests, where you have Gherkin (cucumber) test descriptions along with test implementations for the steps. https://cucumber.io/
behave is a Python implementation for ^^
I’ve been contemplating implementing first class support for behave in pants.
(at the time we were implementing the thing I was asking if @powerful-umbrella-75231 could share a bit of..)
b

boundless-zebra-79556

10/18/2022, 3:42 PM
There is also
pytest-bdd
and it works ok-ish for most cases, but their cucumber implementation is a custom one, not the official library, and there are rough edges when it comes to dealing with e.g. multi-line test cases and embedded data tables
h

hundreds-father-404

10/18/2022, 4:25 PM
I think likely the cleanest approach is to create a new target type like
python_behave_test
and
python_behave_tests
. That way there's no ambiguity with pants trying to run its Pytest implementation on those files