Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/qt5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ jobs:
; do
"${TEST}" 2> /dev/null &
sleep 1
(cd examples/CalcQt; cucumber)
(cd examples/CalcQt; cucumber --strict)
wait %
done
17 changes: 15 additions & 2 deletions .github/workflows/run-all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,20 @@ concurrency:

jobs:
build-linux:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
include:
- cucumber-version: '7.1'
os: ubuntu-22.04
# Cucumber-Ruby 10 needs Ruby 3.1 or later, Ubuntu 22.04 provides Ruby 3.0
- cucumber-version: '10'
os: ubuntu-24.04

runs-on: ${{ matrix.os }}

env:
CUCUMBER_VERSION: ${{ matrix.cucumber-version }}

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Expand Down Expand Up @@ -46,7 +59,7 @@ jobs:
- name: install ruby tools
run: |
sudo gem install bundler
sudo bundle install
sudo env CUCUMBER_VERSION="${CUCUMBER_VERSION}" bundle install

- name: install gtest
run: |
Expand Down
17 changes: 14 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
source 'https://rubygems.org'

group :test do
gem 'cucumber', "=7.1.0"
gem 'cucumber-wire', "=6.2.1"
# Select the Cucumber-Ruby version with CUCUMBER_VERSION, for example
# `export CUCUMBER_VERSION=10` before `bundle install`. Keep it set for `bundle exec`,
# otherwise Bundler switches back to the default. Cucumber-Ruby 10 needs Ruby 3.1 or later.
cucumber_versions = {
'7.1' => { cucumber: '7.1.0', wire: '6.2.1' },
'10' => { cucumber: '10.2.0', wire: '8.0.0' },
}
cucumber_version = ENV.fetch('CUCUMBER_VERSION', '7.1')
versions = cucumber_versions.fetch(cucumber_version) do
raise "Unsupported CUCUMBER_VERSION '#{cucumber_version}', use one of: #{cucumber_versions.keys.join(', ')}"
end

group :test do
gem 'cucumber', "=#{versions[:cucumber]}"
gem 'cucumber-wire', "=#{versions[:wire]}"
end
29 changes: 20 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ It relies on a few libraries:
* [TCLAP](https://tclap.sourceforge.net/) 1.2.5 or later.

It might work with earlier versions of the libraries, but it was not tested with them.
See the [CI scripts](.github/workflows/run-all.yml) for details about dependency installation.
See the [CI scripts](.github/workflows/run-all.yaml) for details about dependency installation.

Cucumber-Cpp uses the wire protocol at the moment, so you will need
Cucumber-Ruby installed and available on the path. It is also needed
to run the functional test suite.
Cucumber-Ruby and its cucumber-wire plugin installed and available on
the path. They are also needed to run the functional test suite.

Please mind that Cucumber-Cpp is not compatible with Cucumber-Ruby 3.x
due to a [bug in its wire protocol](https://github.com/cucumber/cucumber-ruby/issues/1183)
implementation.
Cucumber-Cpp is tested with Cucumber-Ruby 7.1 and 10. Later versions
are not supported yet, because there is no cucumber-wire release for
them. Cucumber-Ruby 10 needs Ruby 3.1 or later.

To install the Ruby prerequisites:

Expand All @@ -48,10 +48,14 @@ gem install bundler // For windows: gem install bundle
bundle install
```

This installs Cucumber-Ruby 7.1. To use Cucumber-Ruby 10 instead, set
the environment variable `CUCUMBER_VERSION=10` before running
`bundle install` and keep it set when running `bundle exec`.

### Windows vs. Linux

To get an inspiration on how to set up the dependencies on your specific system (Windows or Linux), you may want to have a look at the
workflow files [for Windows](.github/workflows/windows-build.yml) and [for Linux](.github/workflows/linux-build.yml).
workflow files [for Windows](.github/workflows/windows-build.yaml) and [for Linux](.github/workflows/linux-build.yaml).


## Build
Expand Down Expand Up @@ -92,7 +96,8 @@ Running the Calc example on Windows (NMake):

```
start build\examples\Calc\BoostCalculatorSteps.exe
cucumber examples\Calc
cd examples\Calc
cucumber
```

## The way it works
Expand Down Expand Up @@ -131,8 +136,14 @@ host: localhost
port: 3902
```

Cucumber-Ruby 8 and later ignore the *cucumber.wire* file unless the wire protocol plugin is loaded. Create a *wire.rb* file in the *features/support* folder with the following content (Cucumber-Ruby 7.1 works with it as well):

```
require 'cucumber/wire'
```

Create your first feature (an example is available [here](examples/Calc/features/addition.feature)).

Then create your step definition runner (an example is available [here](examples/Calc/features/step_definitions/BoostCalculatorSteps.cpp)). In order to compile the step definition runner, make sure to add [cucumber include directory](include/cucumber-cpp) to the include path and link with *libcucumber-cpp.a* and additional testing libraries (boost unit test).

Run the step definition runner in the background and then cucumber, like in the Calc example in the previous section. The step definition runner should exit after the feature is run and cucumber exits.
Run the step definition runner in the background and then cucumber, like in the Calc example in the previous section. Start cucumber in the folder that contains the *features* folder, otherwise it does not find the *cucumber.wire* file. The step definition runner should exit after the feature is run and cucumber exits.
2 changes: 2 additions & 0 deletions examples/Calc/features/support/wire.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Cucumber-Ruby 8 and later only load the wire protocol plugin on request
require 'cucumber/wire'
2 changes: 2 additions & 0 deletions examples/CalcQt/features/support/wire.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Cucumber-Ruby 8 and later only load the wire protocol plugin on request
require 'cucumber/wire'
2 changes: 2 additions & 0 deletions examples/FeatureShowcase/features/support/wire.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Cucumber-Ruby 8 and later only load the wire protocol plugin on request
require 'cucumber/wire'
6 changes: 3 additions & 3 deletions run-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ for TEST in \
; do
"${TEST}" > /dev/null &
sleep 1
(cd examples/Calc; cucumber)
(cd examples/Calc; cucumber --strict)
wait %
done

Expand All @@ -51,7 +51,7 @@ for TEST in \
; do
"${TEST}" 2> /dev/null &
sleep 1
(cd examples/CalcQt; cucumber)
(cd examples/CalcQt; cucumber --strict)
wait %
done

Expand All @@ -63,7 +63,7 @@ SOCK=`pwd`/cucumber.wire.sock
TEST=build/examples/FeatureShowcase/FeatureShowcaseSteps
echo "unix: ${SOCK}" > examples/FeatureShowcase/features/step_definitions/cucumber.wire
"${TEST}" --unix "${SOCK}" > /dev/null &
(cd examples/FeatureShowcase; cucumber)
(cd examples/FeatureShowcase; cucumber --strict)
wait %

mkdir -p coverage
Expand Down
Loading