Cucumber-cpp需要运行示例的软件

时间:2018-06-08 12:39:40

标签: c++ cucumber cucumber-cpp

克隆和安装后(我相信正确的方式 - 我跟着this tutorial),我转到~\Cucumber\Cucumber\cpp\examples\Calc并输入cucumber --init

我得到了

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)

其次是

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>'

虽然我知道这是一个基本错误,但我真的找不到解决方法。当我在google中输入时,我访问了大多数显示的链接 我的问题是:
  - 我正在网络上工作,这会导致布线问题吗?   - 运行该示例是否需要额外的步骤? documentation提及CMake,但我没有找到它的用法   - 还有哪些其他问题?   - 你能指点我开始使用cucumber-cpp吗? (仅限书面)

此计算机是Windows 7专业版

编辑:
如果我在wire文件中使用给定的端口,我得到:

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)

我也无法根据我找到的任何信息解决这个问题。

1 个答案:

答案 0 :(得分:0)

数目:

  • Windows上的防火墙可能会导致问题,但通常会看到弹出窗口请求确认访问权限(您也可以尝试暂时禁用防火墙以验证是否存在问题)。
  • 是的,虽然缺乏良好的解释,但项目README中定义的步骤应该是正确的。
  • 未使用C ++步骤定义启动有线服务器。
  • 项目存储库中的指南可能是最佳起点(确保您遵循所有步骤)。不幸的是,没有很好的文档。

Cucumber-CPP目前的工作方式是让Cucumber-Ruby连接到C ++实现正在监听的TCP端口。当在cucumber.wire文件中定义有线协议时,使用C ++有线协议服务器正在侦听的主机和端口,Cucumber-Ruby将尝试使用Cucumber-CPP运行它们。

C ++是一种编译语言,因此必须首先编译步骤定义。提供的示例使用CMake,如README中所述。 Cucumber-CPP需要链接到步骤定义及其使用的所有内容(通常是测试中的应用程序),创建一个可执行文件,该文件将监听Cucumber-Ruby的有线协议端口(默认为localhost:3902)连接(并在断开连接时退出)。

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