catchorg / Catch2

A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later (C++11 support is in v2.x branch, and C++03 on the Catch1.x branch)
https://discord.gg/4CWS9zD
Boost Software License 1.0
18.76k stars 3.06k forks source link

Gherkin language support #1424

Open AlexanderZvyagin opened 6 years ago

AlexanderZvyagin commented 6 years ago

Have you consider to support Gherkin language directly, similar to what https://github.com/behave/behave is doing for python? The idea to separate a "test" language from an implementation (C++/python/...) is a great one, I think. Because right now Catch2 projects tries to implement both with C++, and writing tests is not as easy as in Gherkin.

GIVEN Person "A" does not know "C++"
GIVEN Person "B" knows "C++"
WHEN Person "A" writes a "TEST"
WHEN Person "B" implements "TEST"  in "C++"
THEN "TEST" should be ok
MetaBarj0 commented 6 years ago

I agree with @WarShoe. One of the major interest of BDD approach is the separation we have between test cases written in Gherkin language and the glue code for executable specifications. I think it won't be easy to do if you want to integrate such a feature within the header (maybe it could be necessary to create a DSL or something like that...) but this is the major reason I'm reluctant to switch from cucumber-cpp to catch2 for BDD in my projects.

fallwest commented 2 years ago

Hi! I actually like the mix of Gherkin and C++. It can make unit tests readable for test-automators working with Gherkin frameworks like Behave. That way they can see what is already covered and adjust accordingly. And there already is at least one C++ framework for running Gherkin, so maybe just use that: https://github.com/cucumber/cucumber-cpp

BorisSchaeling commented 1 year ago

For those looking for another C++ library with Gherkin support: I can recommed Kris Jusiak's library at https://github.com/cpp-testing/GUnit.