1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
Feature: Wire protocol timeouts
We don't want Cucumber to hang forever on a wire server that's not even there,
but equally we need to give the user the flexibility to allow step definitions
to take a while to execute, if that's what they need.
Background:
Given a file named "features/wired.feature" with:
"""
Feature: Telegraphy
Scenario: Wired
Given we're all wired
"""
Scenario: Try to talk to a server that's not there
Given a file named "features/step_definitions/some_remote_place.wire" with:
"""
host: localhost
port: 54321
"""
When I run `cucumber -f progress`
Then the stderr should contain:
"""
Unable to contact the wire server at localhost:54321
"""
@spawn
Scenario: Invoke a step definition that takes longer than its timeout
Given a file named "features/step_definitions/some_remote_place.wire" with:
"""
host: localhost
port: 54321
timeout:
invoke: 0.1
"""
And there is a wire server on port 54321 which understands the following protocol:
| request | response |
| ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[{"val":"wired", "pos":10}]}]] |
| ["begin_scenario"] | ["success"] |
| ["invoke",{"id":"1","args":["wired"]}] | ["success"] |
| ["end_scenario"] | ["success"] |
And the wire server takes 0.2 seconds to respond to the invoke message
When I run `cucumber -f pretty -q`
Then the stderr should not contain anything
And it should fail with exactly:
"""
Feature: Telegraphy
Scenario: Wired
Given we're all wired
Timed out calling wire server with message 'invoke' (Timeout::Error)
features/wired.feature:3:in `Given we're all wired'
Failing Scenarios:
cucumber features/wired.feature:2
1 scenario (1 failed)
1 step (1 failed)
"""
|