作者:bj韩式尕伙 | 来源:互联网 | 2023-07-12 09:20
I'm working with a set of tests that can be run in parallel on multiple client machines, and I have a tag that can conditionally skip a scenario (represented by the
1
| ` tag here) based on whether the environment is appropriate for that particular test. The tag is implemented as an |
Around
block.call
1
| when the client's environment (e.g., OS version) matches the Scenario's expectation. There are a couple of cucumber bugs I've noticed: the counts at the end are off, and the previous scenario is reported incorrectly if it uses any |
After` hook. An example:
Feature file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| cucumber
Feature: Some feature
Scenario: A scenario before a dead scenario
Given something happens
Scenario: The first dead scenario
Given something happens
Scenario: A scenario with an after hook before a dead scenario
Given something happens
Scenario: Another dead scenario
Given something happens |
Step file:
1 2 3 4 5 6 7 8 9 10 11 12
| ruby
Given(/^(.*)$/) do |step_text|
puts step_text
end
After('') do
puts 'After hook'
end
Around('') do |scenario, block|
puts 'Not running this scenario!'
end |
Output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| Feature: Some feature
Scenario: A scenario before a dead scenario # test.feature:2
Given something happens # test.rb:1
something happens
Scenario: A scenario with an after hook before a dead scenario # test.feature:10
Not running this scenario!
Given something happens # test.rb:1
something happens
After hook
Scenario: A scenario with an after hook before a dead scenario # test.feature:10
Not running this scenario!
4 scenarios (2 passed)
2 steps (2 passed)
0m0.046s |
Note that the scenario "A scenario with an after hook before a dead scenario" is reported twice, but the second time it has no steps. Also notice that the output of the
hook is attached to the wrong scenario each time. In addition, observe that it correctly reports 4 scenarios, but the breakdown only includes the 2 passing scenarios and ignores the skipped ones, where I would expect them to be marked "skipped."
The output is similar in other formats (e.g.,
).
该提问来源于开源项目:cucumber/cucumber-ruby
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.