Below code passes an argument to a cucumber step definitions:
Then /^I should see a message "([^\"]*)"$/ do |arg1|
page.should have_content (arg1)
end
Anyone could help me, how to pass multiple arguments?
In order to pass multiple arguments, you need to have multiple "capture groups". Here's an example that has two capture groups:
Then /^I should see a message "([^\"]*)" and another message "([^\"]*)" $/ do |arg1, arg2|
page.should have_content(arg1)
page.should have_content(arg2)
end
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.