Installation

To get started, build the project with CMake:

cmake -S . -B build
cmake --build build -j12

This will build two libraries: cucumber and cucumber-no-main.

  • cucumber includes a built-in main() function, so you only need to implement your step definitions.

  • cucumber-no-main lets you provide your own entry point. See Using your own main.cpp for details.

If nlohmann_json is available, CMake will automatically enable JSON report generation. CMake simply runs find_package(nlohmann_json) and checks if (nlohmann_json_FOUND), so it does not matter how the package is provided.

Conan

CWT-Cucumber is also available on ConanCenter. If you are using Conan for dependency management, you can add it to your conanfile.txt:

[requires]
cwt-cucumber/2.7

[generators]
CMakeToolchain
CMakeDeps

Using your own main.cpp

If you prefer to define your own main(), there are two ways to run the tests:

Option 1: Use entry_point() This behaves like the built-in main and runs all feature tests automatically.

int main(int argc, const char* argv[])
{
  auto result = cuke::entry_point(argc, argv);
  return result == cuke::results::test_status::passed
           ? EXIT_SUCCESS
           : EXIT_FAILURE;
}

Option 2: Use cwt_cucumber directly This gives you full control over execution, output, and result handling.

cwt_cucumber cucumber(argc, argv);
cucumber.run_tests();
cucumber.print_results();
return cucumber.final_result();