r-cochran / cuke_sniffer

A ruby library used to root out smells in your cukes.
MIT License
44 stars 28 forks source link

[Reporting Dead Steps] Usage of steps having '|' operator to pass parameters are not parsed properly #71

Closed christopher-rex closed 9 years ago

christopher-rex commented 10 years ago

Say there is step which can only take certain list of values for a parameter,

Then /^I click on (Login|Logout) button$/ do |button_name| page.send(button_name.downcase).click end

Currently the dead steps parsing, does not consider the usage of these steps in feature files and show these steps as unused always.

vaughncm commented 10 years ago

Thank you for the report. We will look into this soon.

r-cochran commented 10 years ago

I looked into this a bit tonight and had issues recreating the issue and was wondering if we could compare notes. Using 0.0.8 of cuke_sniffer with the below feature file and step definition file I generated a report that had no dead step definitions.

dual_regex.feature

Feature: This calls a dual regex step definition

Scenario: I should hit both paths of a Or based step definition Given I click on Login button And I click on Logout button

dual_regex_steps.rb

Then /^I click on (Login|Logout) button$/ do |button_name| page.send(button_name.downcase).click end

debugging shows the step definition in question with a calls has as follows

'my_feature.feature:4' => I click on Login button 'my_feature.feature:5' => I click on Logout button

vaughncm commented 9 years ago

Analysis provided on most current gem version shows this to be working as intended. Closing. If you'd like to re-open with more info please feel free!