Search code examples
rubycucumberfeature-file

is there any alternative for scenario.steps method in cucucmber 2.0.0?


I have just upgraded to Cucumber 2.0.0 and looks the version 2 is not supporting the steps method for the scenario.

The below code in the my hooks is not working due to this and dont see any alternative method in ruby docs for cucumber version 2.0.0

@step_t = Array.new
scenario.steps.each do |step|
  @step_t.push("#{step.name}")
end

Please let me know if anyone got a chance to get the steps of a scenario using cucumber 2.0.0


Solution

  • Not sure about 2.0.0, but with 2.0.2 I am able to get steps like that:
    scenario.test_steps.
    Doesn't matter if it's scenario outline or not.

    And if you need array of steps names:
    scenario.test_steps.map(&:name)