0
votes

I'm trying to make a simple test witch is capybara go to page, fill a field based on scenery, and verify if i have some text in page (i know this is a useless test but is just a POC), but cucumber wont find my step for get the example data and looks for a static step. here is the files

.feature:

Given que eu estou na página
When eu escrever no campo o nome <name>
Then deve ver receber a mensagem "Back"
scenary:
| name |
| wolo |
| xala |

the step:

When /^eu escrever no campo o nome "(.*?)"$/ do |name|
   fill_in "usuario_nome", :with=> name
end

this is my log:

You can implement step definitions for undefined steps with these snippets:

When("eu escrever no campo o nome wolo") do
  pending # Write code here that turns the phrase above into concrete actions
end

When("eu escrever no campo o nome xala") do
  pending # Write code here that turns the phrase above into concrete actions
end
1

1 Answers

1
votes

It's not finding your step because your step specifies "s are required but when you call it in your scenario there are no quotes. You either need to change you test to have

When eu escrever no campo o nome "<name>"

or change your step definition to

When /^eu escrever no campo o nome (.*?)$/ do |name|
  fill_in "usuario_nome", :with=> name
end

Note: if using an up to date version of Cucumber you could also define your step using cucumber expressions which would be

When "eu escrever no campo o nome {string}" do |name|
  fill_in "usuario_nome", :with=> name
end