Search code examples
c++cucumbercucumber-cpp

Cucumber-cpp required software for running example


After cloning and installing (I believe in the proper way - I followed this tutorial) I go to to ~\Cucumber\Cucumber\cpp\examples\Calc and type cucumber --init.

I get

C:\Cucumber\Cucumber-cpp\examples\Calc>cucumber --init
  exist   features
  exist   features/step_definitions
  exist   features/support
  exist   features/support/env.rb
  Timed out calling wire server with message 'step_matches' (Timeout::Error)

Followed by

C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-wire-0.0.1/lib/cucumber/wire/connection.rb:45:in `block in fetch_data_from_socket'
C:/Ruby/lib/ruby/2.4.0/timeout.rb:108:in `timeout'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-wire-0.0.1/lib/cucumber/wire/connection.rb:45:in `fetch_data_from_socket'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-wire-0.0.1/lib/cucumber/wire/connection.rb:22:in `call_remote'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-wire-0.0.1/lib/cucumber/wire/request_handler.rb:10:in `execute'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-wire-0.0.1/lib/cucumber/wire/protocol/requests.rb:14:in `execute'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-wire-0.0.1/lib/cucumber/wire/protocol.rb:8:in `step_matches'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-wire-0.0.1/lib/cucumber/wire/connections.rb:33:in `block in step_matches'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-wire-0.0.1/lib/cucumber/wire/connections.rb:33:in `map'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-wire-0.0.1/lib/cucumber/wire/connections.rb:33:in `step_matches'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/step_match_search.rb:20:in `call'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/step_match_search.rb:20:in `call'
C:/Ruby/lib/ruby/2.4.0/delegate.rb:83:in `method_missing'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/step_match_search.rb:62:in `call'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/filters/activate_steps.rb:66:in `matches'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/filters/activate_steps.rb:47:in `result'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/filters/activate_steps.rb:37:in `find_match'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/filters/activate_steps.rb:33:in `attempt_to_activate'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/filters/activate_steps.rb:29:in `map'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/filters/activate_steps.rb:29:in `new_test_steps'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/filters/activate_steps.rb:23:in `test_case'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/filters/activate_steps.rb:12:in `test_case'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/core/test/case.rb:25:in `describe_to'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/filters/activate_steps.rb:12:in `test_case'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/core/test/case.rb:25:in `describe_to'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/core/test/filters/locations_filter.rb:18:in `block in done
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/core/test/filters/locations_filter.rb:17:in `each'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/core/test/filters/locations_filter.rb:17:in `done'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/core/filter.rb:62:in `done'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/core/test/filters/tag_filter.rb:18:in `done'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/core/compiler.rb:24:in `done'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/core/gherkin/parser.rb:37:in `done'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/core.rb:32:in `parse'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/core.rb:21:in `compile'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/runtime.rb:75:in `run!'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/cli/main.rb:34:in `execute!'
C:/Ruby/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/bin/cucumber:9:in `<top (required)>'
C:/Ruby/bin/cucumber:23:in `load'
C:/Ruby/bin/cucumber:23:in `<main>'

While I understand this is a basic mistake I really could not find a solution for this. I visited most links that show up when I type it in google.
My questions are:
- I am working on a network, would that cause issues with the wiring?
- Are there any extra steps required to run the example? The documentation mentions CMake but I did not find its usage
- What other issues might cause this?
- Could you point me to any good tutorial to getting started with cucumber-cpp? (written only)

This computer is a Windows 7 Professional

EDIT:
If I use the given port in the wire file I get:

C:\Cucumber\Cucumber-cpp\examples\Calc>cucumber --init
   exist   features
   exist   features/step_definitions
   exist   features/support
   exist   features/support/env.rb
Unable to contact the wire server at localhost:3902. Is it up? 
(Cucumber::Wire::Connection::ConnectionError)

I also could not fix this based on any of the information I found.


Solution

  • Answers:

    • Firewalls on Windows can cause issues, but usually you see a pop up requesting to confirm access (you can also try to disable the firewall briefly to verify if that is a problem).
    • Yes, although lacking good explanation, the steps defined in the project's README should be correct.
    • Not starting the wire server with the C++ step definitions.
    • The guides in the project repository might be the best place to start (make sure you follow all steps). Unfortunately, not great documentation.

    The way Cucumber-CPP currently works is by having Cucumber-Ruby connecting to a TCP port where the C++ implementation is listening. When the wire protocol is defined in the cucumber.wire file, with host and port where your C++ wire protocol server is listening, Cucumber-Ruby will try and run them with Cucumber-CPP.

    C++ is a compiled language, so step definitions must be compiled first. The examples provided use CMake, as described in the README. Cucumber-CPP needs to be linked to the step definitions and to everything that they use (usually the application under test), creating an executable file that will listen to the wire protocol port (defaults to localhost:3902) for Cucumber-Ruby to connect to (and exiting when it disconnects).

                        +------------------------------------------+
                        |                                          |
    +----------+        | +----------+  +----------+  +----------+ |
    |          |        | |          |  |          |  |          | |
    | Cucumber |        | | Cucumber |  | C++ Step |  | Your     | |
    | Ruby     |--------->| CPP Wire |--| Defs     |--| CPP App  | |
    |          |        | | Server   |  |          |  |          | |
    |          |        | |          |  |          |  |          | |
    +----------+        | +----------+  +----------+  +----------+ |
                        |                                          |
                        +------------------------------------------+