Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
198 commits
Select commit Hold shift + click to select a range
1457b95
feat!: rewrite to use cucumber messages
daantimmer Dec 8, 2025
e8e9362
enable ccache
daantimmer Dec 12, 2025
792332e
disable the build of shared libs
daantimmer Dec 12, 2025
e8c96aa
disable position independent code generation for jbeder/yaml-cpp
daantimmer Dec 12, 2025
48d99c6
add additional launch tags
daantimmer Dec 12, 2025
1ae9468
add first version (empty, minimal and data-tables are enabled) of the…
daantimmer Dec 12, 2025
10137be
refactored a lot of code
daantimmer Dec 12, 2025
7ac6e9c
removed unused files
daantimmer Dec 12, 2025
77b4762
update devcontainers for CI
daantimmer Dec 12, 2025
50a2bce
removed agauniyal/rang from dependencies
daantimmer Dec 12, 2025
4054607
cleanup Application
daantimmer Dec 12, 2025
45a4380
sanitize and dump actual and expected json
daantimmer Dec 14, 2025
958e05c
set option variables for dependencies as cache variables
daantimmer Dec 14, 2025
6eb2da0
fix grouping for string parameter
daantimmer Dec 14, 2025
ece0b62
use ScopedFakeTestPartResultReporter instead of EmptyTestEventListene…
daantimmer Dec 14, 2025
6f1f4c8
Enable the following compatibility tests: ambiguous, backgrounds, cda…
daantimmer Dec 14, 2025
07a77d7
add examples-tables-attachment compatibility test
daantimmer Dec 15, 2025
028dcc5
add attachments compatibility test
daantimmer Dec 15, 2025
640986f
enabled examples-tables-undefined and global-hooks compatibility test
daantimmer Dec 16, 2025
cbb2f0c
Added global-hooks-afterall-error, global-hooks-attachments, global-h…
daantimmer Dec 17, 2025
dfe7157
add all compatibility checks by default regardless if a cpp implement…
daantimmer Dec 18, 2025
de2aaeb
add hooks-named, hooks-skipped and hooks-undefined compatibility tests
daantimmer Dec 18, 2025
d1a3e52
add multiple-features and multiple-features-reverses compatibility tests
daantimmer Dec 18, 2025
cad1bcf
Merge branch 'main' into feature/rewrite-to-use-cucumber-messages
daantimmer Dec 18, 2025
83c6e5a
fix clang-msvc build
daantimmer Dec 19, 2025
13484a5
fix clang-msvc build
daantimmer Dec 19, 2025
c7ee029
fix MSVC build
daantimmer Dec 19, 2025
4a9afab
fix MSVC build
daantimmer Dec 19, 2025
d11d0d0
add parameter-types compatibility tests
daantimmer Dec 22, 2025
78f70e1
add pending compatibility tests
daantimmer Dec 22, 2025
c67ebd4
fixed TestExpression tests
daantimmer Dec 22, 2025
323b2d4
fixed TestExpression tests
daantimmer Dec 22, 2025
3be881a
add retry, retry-ambiguous, retry-pending and retry-undefined compati…
daantimmer Dec 22, 2025
e94534c
add rules, rules-backgrounds and skipped compatibility tests
daantimmer Dec 22, 2025
c235f1a
add undefined, unknown-parameter-type and unused-steps compatibility …
daantimmer Dec 22, 2025
5893f62
fixed build issues and solved sonarcloud warnings
daantimmer Dec 23, 2025
d75b763
make URI cross-OS compatible
daantimmer Dec 23, 2025
917debc
remove compatibility kit from ls-lint
daantimmer Dec 23, 2025
5815b57
fix possible null-pointer dereference
daantimmer Dec 23, 2025
9986ec8
make uri's canonical
daantimmer Dec 23, 2025
c66a111
fixed const instead of static
daantimmer Dec 23, 2025
3e626e7
fix sonar warnings and replace \r\n with \n
daantimmer Dec 23, 2025
5c23d80
refactor RemoveIncompatibilities to improve iteration and const corre…
daantimmer Dec 23, 2025
1ad2458
refactor RemoveIncompatibilities to enhance iteration logic and ensur…
daantimmer Dec 23, 2025
e10babb
remove old reporters
daantimmer Dec 23, 2025
a56826e
remove unused stuff
daantimmer Dec 23, 2025
998dbd2
refactor to reduce nesting
daantimmer Dec 23, 2025
811ac18
refactory HookRegistry
daantimmer Dec 23, 2025
76ed6f4
refactored Parameter
daantimmer Dec 23, 2025
d61854c
refactored Query.hpp
daantimmer Dec 23, 2025
ba22049
removed TraceTime
daantimmer Dec 23, 2025
6a2492c
Refactored RunCucumber
daantimmer Dec 23, 2025
54278d0
minor refactorings
daantimmer Dec 23, 2025
867e06e
minor refactorings
daantimmer Dec 23, 2025
0715a6e
remove unused files
daantimmer Dec 23, 2025
2d07945
fixed co-pilot comments
daantimmer Dec 24, 2025
03832cd
fix bats-acceptance tests
daantimmer Dec 24, 2025
c9994f4
minor updates
daantimmer Dec 25, 2025
ef2d0c1
add summary formatter to debug launch configurations
daantimmer Dec 25, 2025
3dbb76e
add summary formatter to test.bats
daantimmer Dec 25, 2025
efe611e
query is now also a broadcaster for events
daantimmer Dec 25, 2025
a0f27cc
moved to new api::Formatters to register/enable formatters
daantimmer Dec 25, 2025
da2fcfb
remove unused eventDataCollector member from PrettyPrinter
daantimmer Jan 5, 2026
88e3a93
refactor: simplify title formatting in PrettyPrinter
daantimmer Jan 5, 2026
ee24b6f
refactor: update message formatting in FormatMessage function
daantimmer Jan 5, 2026
f3f2b9f
refactor: enhance error message in BuildArguments for better clarity
daantimmer Jan 5, 2026
2c52a4a
refactor: streamline hook assembly in AssembleTestSteps for improved …
daantimmer Jan 5, 2026
4782695
refactor: update test script and application files to improve formatt…
daantimmer Jan 5, 2026
ef11c11
refactor: enhance tests for TreeRegexp to clarify limitations of std:…
daantimmer Jan 6, 2026
c1d2a0b
refactor: rename ExtractStep to ExtractSteps for clarity and consistency
daantimmer Jan 6, 2026
0ff58a4
refactor: rename FormatMessage to FormatTestFailureMessage for clarity
daantimmer Jan 6, 2026
aa57ace
chore: update SonarQube scan action to version 7.0.0
daantimmer Jan 6, 2026
1eaefa6
refactor: add debug output steps to static analysis workflow for bett…
daantimmer Jan 6, 2026
7231def
refactor: update static analysis workflow to include exit codes for d…
daantimmer Jan 6, 2026
5f59bca
refactor: update static analysis workflow to use logical OR for exit …
daantimmer Jan 6, 2026
04b8aa4
refactor: update static analysis workflow to use 'true' for exit code…
daantimmer Jan 6, 2026
c23eabf
refactor: update test commands to use 'pretty' format for better outp…
daantimmer Jan 6, 2026
51fd45e
refactor: add coverage clean step and duplicate directory size checks…
daantimmer Jan 6, 2026
b9adf82
refactor: update test cases to correctly handle mandatory arguments a…
daantimmer Jan 6, 2026
794c541
refactor: remove tee command from bats task to simplify output handling
daantimmer Jan 6, 2026
8c18af3
refactor: remove unnecessary trailing commas in launch.json arguments
daantimmer Jan 6, 2026
5879949
refactor: replace strong ordering operators with SourceLocationOrder …
daantimmer Jan 6, 2026
5fd1def
refactor: simplify character class and group handling in regex parsing
daantimmer Jan 6, 2026
0e1a68b
refactor: use EXIT_SUCCESS and EXIT_FAILURE for exit codes in GetExit…
daantimmer Jan 6, 2026
3819881
refactor: move operator+ overloads for Lineage into the class definit…
daantimmer Jan 6, 2026
86b0bad
refactor: update SonarQube issue ignore rules to include additional c…
daantimmer Jan 6, 2026
f1e4d65
refactor: remove unnecessary blank line at the end of Parameter.cpp
daantimmer Jan 6, 2026
60af5a5
refactor: use default comparator for orderingMap in Application.cpp
daantimmer Jan 6, 2026
4b546b1
refactor: update launch arguments to use --tags instead of --tag
daantimmer Jan 6, 2026
6e50738
refactor: update formatter registration to use nlohmann::json for for…
daantimmer Jan 6, 2026
c82fa49
refactor: introduce FormatterOption struct for improved formatter han…
daantimmer Jan 7, 2026
b2155bf
refactor: enhance compatibility handling and streamline step registra…
daantimmer Jan 7, 2026
f91df55
refactor: simplify LoadDevkit function and improve path handling
daantimmer Jan 7, 2026
2e421e5
refactor: mark FormatterOption constructor as explicit
daantimmer Jan 7, 2026
6338f25
refactor: implement group parsing logic in TreeRegexp and enhance str…
daantimmer Jan 7, 2026
8e6e1f4
refactor: move ParameterRegistration instance to header for better vi…
daantimmer Jan 8, 2026
ccb2404
refactor: replace emplace with try_emplace for custom output file han…
daantimmer Jan 8, 2026
cffd389
refactor: remove unused includes from Body.cpp
daantimmer Jan 8, 2026
8c8dc9d
refactor: simplify event listener management and enhance parameter em…
daantimmer Jan 8, 2026
c8a25e4
refactor: improve AssembleSteps function signature and optimize assem…
daantimmer Jan 8, 2026
a47f823
refactor: optimize Argument constructor by using std::move for group …
daantimmer Jan 8, 2026
4902aaa
refactor: implement custom signal handler for SIGABRT
daantimmer Jan 8, 2026
3a7dac9
refactor: update CMakeLists to use consistent library naming and impr…
daantimmer Jan 8, 2026
e6c718b
refactor: replace ConverterTypeMap with support::ConverterTypeMap and…
daantimmer Jan 8, 2026
c46a929
refactor: remove unused GTest dependencies and clean up CMakeLists files
daantimmer Jan 8, 2026
f65ebd1
refactor: remove GTest dependencies and clean up RunCucumber implemen…
daantimmer Jan 8, 2026
f95d924
refactor: remove Parameter class and update related implementations t…
daantimmer Jan 9, 2026
bb8ceed
refactor: remove unused Body include from Worker.cpp
daantimmer Jan 9, 2026
4ac0d91
movesupport code to the support library
daantimmer Jan 9, 2026
b77cf83
refactor: enable test subdirectory and add dummy test implementation
daantimmer Jan 9, 2026
fe31842
refactor: remove unused includes from Token.hpp
daantimmer Jan 9, 2026
f5cfead
refactor: update parameter registration and step handling to use supp…
daantimmer Jan 9, 2026
7ab4c0e
Refactor Query and Formatter Integration
daantimmer Jan 9, 2026
3af273c
refactor: reorganize formatter library to use helper functions and im…
daantimmer Jan 9, 2026
56a2de7
treat warnings as errors only
daantimmer Jan 13, 2026
e167a27
refactor: move address sanitizer options under CCR_STANDALONE condition
daantimmer Jan 13, 2026
e7c416a
refactor: add CCR_STANDALONE condition for compilation and logging in…
daantimmer Jan 13, 2026
8e9835a
refactor: reorganize GoogleTest integration and remove redundant incl…
daantimmer Jan 13, 2026
de7fd17
refactor: add SYSTEM option to FetchContent_Declare for multiple depe…
daantimmer Jan 14, 2026
74141ce
refactor: update container image to version 6.6.4 in Dockerfile and C…
daantimmer Jan 15, 2026
d2b4f24
refactor: update library link targets to use scoped names for CLI11 a…
daantimmer Jan 15, 2026
594503b
refactor: remove unused duration includes and improve hook error hand…
daantimmer Jan 15, 2026
9007ce1
refactor: update CCR_FETCH_DEPS option to use CCR_DEFAULTOPT and add …
daantimmer Jan 14, 2026
7087103
refactor: add retryTagExpression to runtime configuration in compatib…
daantimmer Jan 15, 2026
5e1de27
refactor: reorganize CMakeLists.txt files and add fmtlib dependency
daantimmer Jan 15, 2026
0f3d0ce
refactor: rename PrettyPrinter to PrettyFormatter and implement forma…
daantimmer Jan 16, 2026
77cc94b
refactor: enhance PrettyFormatter to support attachment formatting an…
daantimmer Jan 16, 2026
5df8140
wip: JUnitXmlFormatter
daantimmer Jan 16, 2026
d7895d0
WIP: junit xml progress
daantimmer Jan 16, 2026
022138e
refactor: improve GetUniqueFeatureName logic for better readability a…
daantimmer Jan 16, 2026
665103e
feat: add MessageFormatter to handle cucumber messages
daantimmer Jan 16, 2026
e717651
feat: enhance JunitXmlFormatter and Query for improved test reporting…
daantimmer Jan 16, 2026
9329317
fix: update FindLocationOf to return location from tableRow if available
daantimmer Jan 16, 2026
6ee3064
refactor: add comments for future implementation of step argument for…
daantimmer Jan 16, 2026
412b781
feat: update test runner to include message format for improved outpu…
daantimmer Jan 16, 2026
b1c6aa0
feat: add custom fixture support with LoadMeOnConstruction for enhanc…
daantimmer Jan 17, 2026
ff480c9
feat: implement byte and short parameter converters for improved type…
daantimmer Jan 17, 2026
1e84a7a
feat: expand README with detailed usage instructions and custom param…
daantimmer Jan 17, 2026
0c38290
fix: update step definition to use std::int32_t for improved type con…
daantimmer Jan 17, 2026
19d145d
fix: improve MakeIso8601Timestamp by using duration_cast for better t…
daantimmer Jan 17, 2026
0110450
fix: correct include directive for pugixml in JunitXmlFormatter
daantimmer Jan 17, 2026
b2f4b23
fix: update CMakeLists.txt to specify pugixml as a target and comment…
daantimmer Jan 17, 2026
c3454bc
fix: conditionally include yaml-cpp and jbeder based on CCR_BUILD_TES…
daantimmer Jan 17, 2026
ef974a2
swap cpp-terminal with fmt
daantimmer Jan 17, 2026
3a2f838
feat: add TextBuilder class for structured text formatting
daantimmer Jan 18, 2026
f6ef4df
fix: update launch configuration to use 'summary' and 'pretty' format…
daantimmer Jan 18, 2026
6780053
refactor: simplify IndentString implementation using fmt library
daantimmer Jan 18, 2026
128be72
refactor: replace std::format with fmt library for string formatting …
daantimmer Jan 18, 2026
607b1af
refactor: replace std::format with fmt library for string formatting …
daantimmer Jan 18, 2026
c99c357
feat: implement nested steps functionality and enhance step execution…
daantimmer Jan 19, 2026
6d7a37e
feat: enhance acceptance tests and update Application class for recur…
daantimmer Jan 19, 2026
f07be6d
fix: correct spelling of 'language' in CLI option description
daantimmer Jan 19, 2026
7f51629
feat: add configuration dumping option and update default values for …
daantimmer Jan 19, 2026
bf667b3
enable proper theming for PrettyFormatter
daantimmer Jan 20, 2026
2f359f4
feat: add support for ambiguous steps and enhance PrettyFormatter for…
daantimmer Jan 20, 2026
366d9d2
feat: update FindLocationOf to return optional location for better er…
daantimmer Jan 21, 2026
1dff606
feat: refactor PrettyFormatter to improve error handling and streamli…
daantimmer Jan 21, 2026
2dc68e0
feat: enhance sanitizer options for better memory error detection
daantimmer Jan 21, 2026
49fd5f5
feat: enhance PrettyFormatter to include feature and rule line options
daantimmer Jan 21, 2026
320e3d2
feat: add logging for running features with specified tags
daantimmer Jan 21, 2026
35bbd08
feat: remove Rtrim implementation and replace with util::Trim for con…
daantimmer Jan 21, 2026
973f947
feat: refactor PrettyFormatter to use helper functions for message fo…
daantimmer Jan 21, 2026
35a1351
feat: refactor PrettyFormatter to utilize helper functions for messag…
daantimmer Jan 21, 2026
dc636b8
feat: update PrettyFormatter to conditionally print feature and rule …
daantimmer Jan 21, 2026
b4ebaae
feat: update launch configuration to include summary and retry option…
daantimmer Jan 21, 2026
e9f4e08
feat: update SummaryFormatter to include test_case_started message an…
daantimmer Jan 21, 2026
80c7af7
feat: enhance formatters to support hook messages and improve output …
daantimmer Jan 22, 2026
3d79b01
Refactor cucumber_cpp formatter helper library
daantimmer Jan 22, 2026
e038079
feat: update SummaryFormatter to support custom format options and im…
daantimmer Jan 22, 2026
b3f8d36
refactor: simplify paths storage type and clean up unused includes
daantimmer Jan 22, 2026
c7ff960
feat: update FormatStepText to include test_step_result_status for im…
daantimmer Jan 22, 2026
7ed5f33
feat: add UsageFormatter and related query enhancements for improved …
daantimmer Jan 23, 2026
a334199
feat: enhance UsageFormatter with dry run support and mean duration c…
daantimmer Jan 23, 2026
fc244f6
feat: improve scenario result counting and handle missing test step r…
daantimmer Jan 23, 2026
21a3b78
feat: add unused scenario and related test structure for usage reporting
daantimmer Jan 23, 2026
bc3ab21
Merge branch 'main' into feature/rewrite-to-use-cucumber-messages
daantimmer Jan 23, 2026
63523cc
feat: remove redundant disk usage checks from static analysis workflow
daantimmer Jan 23, 2026
9766418
feat: update fmt library linkage to use fmt::fmt instead of fmt-heade…
daantimmer Jan 23, 2026
d7aa5d2
feat: update test for Step to check dataTable access
daantimmer Jan 23, 2026
8506b7e
fix: correct variable name from linaege to lineage in Query.cpp
daantimmer Jan 23, 2026
27ba908
feat: remove Join utility functions from support library
daantimmer Jan 23, 2026
fcd6ac2
feat: enable all formatters for compatibility tests
daantimmer Jan 23, 2026
1728fc9
fix: add null check for test_case_started_id in HandleAttachment
daantimmer Jan 23, 2026
85d5b33
fix: add check for empty testStepFinishedAndTestSteps in Query.cpp
daantimmer Jan 23, 2026
9ad849e
fix: add null check for step_definition_ids in UsageFormatter
daantimmer Jan 23, 2026
a53f3d6
fix: update step_definition_ids access to use value() for better clarity
daantimmer Jan 23, 2026
92d8e36
refactor: replace std::format with fmt::format for consistency in for…
daantimmer Jan 23, 2026
b26b67a
refactor: replace std::format with fmt::format for consistency across…
daantimmer Jan 23, 2026
b51cee3
refactor: replace std::format with fmt::format in Query.cpp for consi…
daantimmer Jan 23, 2026
9c067ad
refactor: replace std::format with fmt::format in Body.cpp for consis…
daantimmer Jan 23, 2026
11514b2
refactor: replace std::format with fmt::format for consistency across…
daantimmer Jan 23, 2026
fc729ad
refactor: replace std::format with fmt::format for consistency in App…
daantimmer Jan 23, 2026
429f716
refactor: include fmt/chrono.h for consistency in Timestamp.cpp
daantimmer Jan 23, 2026
65b4b02
refactor: update include path for fmt/format.h in Argument.cpp for co…
daantimmer Jan 23, 2026
f2dff72
refactor: enhance exception message formatting in FormatMessages.cpp
daantimmer Jan 23, 2026
1a8d52c
refactor: demangle exception type names in Body.cpp for improved read…
daantimmer Jan 23, 2026
b764e26
refactor: add scenario for exception throwing and update test tags fo…
daantimmer Jan 23, 2026
de69483
refactor: replace std::forward_as_tuple with std::make_tuple for impr…
daantimmer Jan 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:

- name: Run acceptance tests
run: |
bats --formatter junit cucumber_cpp/acceptance_test/coverage.bats | tee test-report.xml
bats --formatter junit cucumber_cpp/acceptance_test/test.bats | tee test-report.xml

- name: Collect coverage
run: |
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@
.xwin-cache
.vs/
megalinter-reports/

# compatibility generated files
actual.ndjson
expected.ndjson

# bats task generated files
test-report.xml
1 change: 1 addition & 0 deletions .ls-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ ignore:
- external
- megalinter-reports
- testdata
- compatibility
95 changes: 82 additions & 13 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@
"@result:UNDEFINED",
"@result:FAILED",
"@result:OK",
"@fail_feature"
"@fail_feature",
"@ex:2",
"@substep",
"@table_argument",
"@thishasarule",
"@nested_steps",
"@rules"
]
},
{
Expand All @@ -24,7 +30,10 @@
"type": "pickString",
"options": [
"cucumber_cpp/example/features",
"cucumber_cpp/acceptance_test/features"
"cucumber_cpp/example/features/rule.feature",
"cucumber_cpp/example/features/substep.feature",
"cucumber_cpp/acceptance_test/features",
"cucumber_cpp/devkit/empty/features"
]
}
],
Expand All @@ -35,17 +44,77 @@
"request": "launch",
"program": "${command:cmake.launchTargetPath}",
"args": [
"run",
"--feature",
"${input:features}",
"--report",
"console",
"junit-xml",
// "--com",
// "COMx",
// "--nordic",
"--tag",
"${input:tag}"
"--format",
"pretty",
"summary",
"--retry",
"1",
"--tags",
"${input:tag}",
"--",
"${input:features}"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "ASAN_OPTIONS",
"value": "detect_leaks=0"
}
],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
{
"name": "(gdb) Launch dry run",
"type": "cppdbg",
"request": "launch",
"program": "${command:cmake.launchTargetPath}",
"args": [
"--format",
"usage",
"--dry-run",
"--",
"${input:features}"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "ASAN_OPTIONS",
"value": "detect_leaks=0"
}
],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
{
"name": "(gdb) Launch - no tags",
"type": "cppdbg",
"request": "launch",
"program": "${command:cmake.launchTargetPath}",
"args": [
"--com",
"COMx",
"--nordic",
"--format",
"summary",
"--",
"${input:features}"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"cmake.useCMakePresets": "always",
"cucumberautocomplete.steps": [
"compatibility/*/*.cpp",
"cucumber_cpp/example/steps/*.cpp",
"cucumber_cpp/acceptance_test/steps/*.cpp"
],
Expand Down
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"label": "bats",
"type": "shell",
"command": "bats --formatter junit cucumber_cpp/acceptance_test/test.bats | tee test-report.xml",
"command": "bats --formatter junit cucumber_cpp/acceptance_test/test.bats",
"problemMatcher": []
}
]
Expand Down
29 changes: 21 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,26 @@ endif()

if (CCR_STANDALONE)
set(CCR_DEFAULTOPT On)
else()
set(CCR_DEFAULTOPT Off)
endif()

if (CCR_STANDALONE)
set(CCR_EXCLUDE_FROM_ALL "")
set(CMAKE_COMPILE_WARNING_AS_ERROR On)
else()
set(CCR_DEFAULTOPT Off)
set(CCR_EXCLUDE_FROM_ALL "EXCLUDE_FROM_ALL")
endif()

option(CCR_FETCH_DEPS "Fetch dependencies via FetchContent." On )
option(CCR_FETCH_DEPS "Fetch dependencies via FetchContent." ${CCR_DEFAULTOPT} )
option(CCR_BUILD_TESTS "Enable build of the tests" ${CCR_DEFAULTOPT})
option(CCR_ENABLE_COVERAGE "Enable compiler flags for code coverage measurements" Off)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

if (CCR_STANDALONE AND NOT CCR_ENABLE_COVERAGE)
if (NOT (CMAKE_CXX_COMPILER_ID MATCHES "MSVC" OR CMAKE_CXX_SIMULATE_ID MATCHES "MSVC"))
add_compile_options(-fsanitize=address -fsanitize=undefined)
add_link_options(-fsanitize=address -fsanitize=undefined)
endif()
endif()

if (CCR_BUILD_TESTS)
ccr_enable_testing()
endif()
Expand Down Expand Up @@ -53,7 +59,6 @@ set_directory_properties(PROPERTY USE_FOLDERS ON)
include(FetchContent)
include(GNUInstallDirs)
include(CTest)
include(GoogleTest)

if (CCR_FETCH_DEPS)
add_subdirectory(external)
Expand All @@ -64,7 +69,15 @@ else()
find_package(pugixml REQUIRED)
find_package(cucumber_messages REQUIRED)
find_package(cucumber_gherkin REQUIRED)
find_package(yaml-cpp REQUIRED)
find_package(fmt REQUIRED)

if (CCR_BUILD_TESTS)
find_package(yaml-cpp REQUIRED)
endif()
endif()

add_subdirectory(cucumber_cpp)

if (CCR_STANDALONE)
add_subdirectory(compatibility)
endif()
4 changes: 3 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"installDir": "${sourceDir}/.install/${presetName}",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": "On",
"CMAKE_CONFIGURATION_TYPES": "Debug;RelWithDebInfo;Release"
"CMAKE_CONFIGURATION_TYPES": "Debug;RelWithDebInfo;Release",
"CMAKE_C_COMPILER_LAUNCHER": "ccache",
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache"
}
},
{
Expand Down
143 changes: 140 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,148 @@ amp-cucumber-cpp-runner is known to build using:
amp-cucumber-cpp-runner is not supposed to be used standalone. It is possible to add amp-cucumber-cpp-runner as a submodule to your own project or to use cmake's FetchContent to add amp-cucumber-cpp-runner as a cmake build dependency.

En example project is provided which shows most features of amp-cucumber-cpp-runner and how to configure a cmake project to use amp-cucumber-cpp-runner. The simplest solution is to simply add a dependency on `cucumber-cpp-runner` like so:
`cmake
target_link_libraries(cucumber_cpp.example PRIVATE

```cmake
FetchContent_Declare(cucumber_cpp
GIT_REPOSITORY https://github.com/philips-software/amp-cucumber-cpp-runner.git
GIT_TAG main
)

FetchContent_MakeAvailable(cucumber_cpp)

add_executable(my_test_runner)
target_sources(my_test_runner PRIVATE
steps/mysteps.cpp
hooks/myhooks.cpp
)

target_link_libraries(my_test_runner PRIVATE
cucumber_cpp.runner
)
`
```

## Writing step definitions

Steps are written using the `GIVEN`, `WHEN`, `THEN` or `STEP` macro's. The syntax for step definitions is:

```cpp
// using cucumber expressions

STEP("cucumber expression without captures"){
// body
}

STEP("cucumber expression with an {int}", (std::int32_t arg)){
// body
}

// or as a regular expression:

STEP(R"(^a regular\?? expression without captures$)"){

}

STEP(R"(^a (regular|unregular) expression with ([1-2]) capture groups$)", (const std::string& type, const std::string& nrOfGroups)){

}
```

### Builtin Parameter Types

The argument list has to match with the cucumber expression type:

| Cucumber Expression | Parsed as | Notes |
|---------------------|----------------|----------------------------------|
| `{int}` | `std::int32_t` | |
| `{float}` | `float` | |
| `{word}` | `std::string` | words without whitespace |
| `{string}` | `std::string` | "banana split" or 'banana split' |
| `{}` | `std::string` | |
| `{bigdecimal}` | `double` | non-standard |
| `{biginteger}` | `std::int64_t` | non-standard |
| `{byte}` | `std::int8_t` | |
| `{short}` | `std::int16_t` | |
| `{long}` | `std::int64_t` | |
| `{double}` | `double` | |


See the [Cucumber Expressions documentation](https://github.com/cucumber/cucumber-expressions#readme) for more details on supported types. amp-cucumber-cpp-runner has full support for cucumber expressions.

> ℹ️ except for biginteger, but it's optional

### Custom Parameter Types

There is also support for custom parameter types. They are written and used like:

```cpp
struct Flight
{
std::string from;
std::string to;
};

PARAMETER(Flight, "flight", "([A-Z]{3})-([A-Z]{3})", true)
{
return { group.children[0].value.value(), group.children[1].value.value() };
}

STEP(R"({flight} has been delayed)", (const Flight& flight))
{
EXPECT_THAT(flight.from, testing::StrEq("LHR"));
EXPECT_THAT(flight.to, testing::StrEq("CDG"));
}
```

The `PARAMETER` macro API is as follows:
```
PARAMETER(<return type>, <name>, <regular expression>, <use for snippets>)
```
> ℹ️ \<use for snippets\> is not supported yet

The `PARAMETER` function body receives an [`const cucumber::messages::group& group`](https://github.com/cucumber/messages/blob/37af3aa8c54ccaf4e61c7cd168d05e39a19c1959/cpp/include/messages/cucumber/messages/group.hpp#L21) as argument.

### Custom step fixtures

amp-cucumber-cpp-runner has support for custom base classes for step definitions using the `GIVEN_F`, `WHEN_F`, `THEN_F` or `STEP_F` macros. These give additional flexibility for re-using common patterns for steps. For example:

```cpp
struct LoadMeOnConstruction
{
void Tadaa() const
{}
};

struct CustomFixture : cucumber_cpp::library::engine::Step
{
using Step::Step;

const LoadMeOnConstruction& alwaysAvailable{ context.Get<LoadMeOnConstruction>() };
};

GIVEN_F(CustomFixture, R"(a custom fixture background step)")
{
alwaysAvailable.Tadaa();
}
```

### Assertion Framework

amp-cucumber-cpp-runner uses GoogleTest and GoogleMock as the basis for the assertion framework. For example:
```cpp
STEP(R"(the value should be {string})", (const std::string& expected_value))
{
const auto& actual = context.Get<std::string>("cell");

ASSERT_THAT(actual, testing::StrEq(expected_value));
}
```

If asserting (or expecting) is not an option then it is also safe to throw exceptions.

## Writing hook definitions

\<\<todo>>


## How to test the software

Expand Down
Loading
Loading