1

我有一个使用 cucumber-cpp 的长时间运行场景,大约需要 5 分钟才能完成。当我使用cucumber --init命令生成的默认 cucumber.wire 文件运行场景时,会生成以下文件:

host: localhost  
port: 3902

使用此配置,一旦场景完成,我会收到以下错误:

Timed out calling wire server with message 'invoke' (Timeout::Error)
./features/some-long-running-scenario.feature:13:in `Then result1.'
./features/some-long-running-scenario.feature:9:in `Then result1.'
Timed out calling wire server with message 'end_scenario' (Timeout::Error)

我发现我需要增加有线协议的超时时间才能使场景通过。我更新了 cucumber.wire 文件,使其内容如下

host: localhost  
port: 3902
timeout:
    connect: 11
    invoke: 600
    begin_scenario: 120
    end_scenario: 120

有没有办法从命令行设置和编辑这些超时值?

4

1 回答 1

0

似乎可以通过环境变量进行设置:https ://github.com/cucumber/cucumber-ruby-wire#yaml-with-erb-templating

host: localhost
port: 54321
timeout:
  connect: <%= (ENV['MY_CONNECT_TIMEOUT'] || 11).to_i %>
  invoke: 120
  begin_scenario: 120
  end_scenario: 120
于 2021-03-03T05:57:23.340 回答