Welcome to CWT-Cucumber, a lightweight, modern C++20 BDD testing framework for native C++ projects.
📚 Full docs & examples: Read the docs
🚀 Available on Conan Center: cwt-cucumber
CWT-Cucumber interprets Gherkin feature files, letting you write test cases in plain language and define behavior-driven development (BDD) scenarios in C++.
Tested compilers: GCC 13, Clang17, MSVC 19
Thanks to Jörg Kreuzberger, who has contributed and tested a lot.
Highlights & Advantages of CWT-Cucumber:
- ✅ No mandatory dependencies – easy to integrate anywhere
- ✅ DataTables support via
cuke::tablein step definitions - ✅ Tagged hooks for filtering, skipping, or ignoring scenarios
- ✅ Step definitions with Cucumber expressions
- ✅ Supports custom parameter types
- ✅ Conan-ready for modern C++ projects
- ✅ Lightweight, fast, and modern C++20-based
- ✅ Full BDD support: Scenarios, Scenario Outlines, Rules, Backgrounds, Hooks
Feature file (examples/features/1_first_scenario.feature):
Feature: Putting apples into a box
Scenario: Lets start with two apples
Given An empty box
When I place 2 x "apple" in it
Then The box contains 2 itemsStep implementation:
GIVEN(init_box, "An empty box")
{
const box& my_box = cuke::context<box>();
cuke::equal(my_box.items_count(), 0);
}
WHEN(add_item, "I place {int} x {string} in it")
{
const std::size_t count = CUKE_ARG(1);
const std::string item = CUKE_ARG(2);
cuke::context<box>().add_items(item, count);
}
THEN(box_items_count, "The box contains {int} item(s)")
{
const int items_count = CUKE_ARG(1);
const box& my_box = cuke::context<box>();
cuke::equal(my_box.items_count(), items_count);
}This project has started as an educational project after reading "Crafting Interpreters" by Robert Nystorm. It has evolved into a stable production ready state and I'm happy to maintain it. All of the work here is done in my free time.
Don't hesitate and open an Issue.
Cheers 🍻
2025 Coding with Thomas
https://www.codingwiththomas.com/
