I want to pass array value as a parameter from cucumber .feature file, so I can access it from step definition file:
I am using this format:
Examples:
|r1|t1|
|abc|[aa,bb,cc]|
But I'm getting an error
undefined method
each' for "[aa,bb,cc]":String (NoMethodError)`
Is it possible to pass array from .feature file?
I don't think you need the square brackets.
When I pass this array "aa,bb,cc"
You have to split your string up.
When(/I pass this array "([^"]*)"$/) do |array|
array.split(',').each{|entry| do something }
end
Note: you may want to strip the entries in case there is whitespace around them {|entry| puts entry.strip }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With