I am trying to pass parameters from a .feature file (cucumber) to a method call in a .rb heres file, which I have:
When I set something to blah
step definition for the above function file:
When /^I set something to (.+)$/ do |value| methodcall(["#{value}"])) end
in a separate .rb file
def methodcall (a=[],b=[],c=[]) a.each {|x| do something with x } b.each {|y| do something with y } c.each {|z| do something with z } ... end
It works fine when I give only one parameter in the .feature file. I hope it will work for a single value for each of the array (haven't tried this though)
but what I want to do is write something like this in the function file
And I set something to "blah,blah1,blah2" and somethingelse to "blah4,blah5" and otherthings to "blah6, blah7"
for the above, the step definition will look like
When /^I set something to (.+) and somethingelse to (.+) and and otherthings to (.+)$/ do |value, value1, value2| methodcall(["#{value}"], ["#{value1}"], ["#{value2}"])) end
and as a result of determining the above step, the values ββin the value, value1, value2 are passed in the arguments corresponding to a = [], b = [], c = [], and the methodcall () method is called. someone can help .. thanks.