Cucmber Step to insert Test Data into Database

Hi,

We run the feature created for a form to identify the fields and also to
add data into the respective fields.

But while running the cucumber features, all the scenario and steps are
getting passed but the record is not getting inserted into the
application / the database.

We have also wrote the feature as:

Feature: Adding a user
In order to add a user to the organization
As a administrator
I want to create and add new user

Scenario: Create User
Given that I have no users
And I am on the “List of users”
When I follow “New User”
And I fill in “First Name” with “Rebecca”
And I fill in “Second Name” with “Martin”
And I fill in “Title” with “Miss”
And I fill in “Email” with “[email protected]
And I fill in “Telephone” with “01617867645”
And I fill in “Mobile” with “01777867645”
And I fill in “Fax” with “01617867640ÃŽ”
And I fill in “Address Line 1” with “58”
And I fill in “Address Line 2” with “West Tree rd”
And I fill in “Address Line 3” with “Stockport”
And I fill in “County” with “Cheshire”
And I fill in “Country” with “United Kingdom”
And I fill in “Zip Code” with “sk8 4ty”
And I press “Create”
Then I should have 1 user

And steps as:

Then /^I should have ([0-9]+) user$/ do |c|
User.count.should==c.to_i
end

Given /^that I have no users$/ do
User.delete_all
end

If somebody could help us out, how to execute the steps so that the data
gets inserted into the database.

Smita.

On Wed, May 27, 2009 at 5:20 AM, Smita S. [email protected]
wrote:

And I fill in “Second Name” with “Martin”
And I fill in “Zip Code” with “sk8 4ty”
Given /^that I have no users$/ do
User.delete_all
end

If somebody could help us out, how to execute the steps so that the data
gets inserted into the database.

Smita.

Hi Smita. Please use the new Cucumber google group for new threads
about Cucumber:

http://groups.google.com/group/cukes

Cheers,
David

Scott, Last mondayish ?

  • Lee

2009/5/27 Scott T. [email protected]

Scott T. wrote:

But while running the cucumber features, all the scenario and steps are
Scenario: Create User
And I fill in “Address Line 1” with “58”

gets inserted into the database.
When was the decision made to split off the cucumber group?

Scott

http://rubyforge.org/pipermail/rspec-users/2009-May/014502.html

-Ben

David C. wrote:

When I follow “New User”
And I fill in “County” with “Cheshire”
end

Hi Smita. Please use the new Cucumber google group for new threads
about Cucumber:

http://groups.google.com/group/cukes

When was the decision made to split off the cucumber group?

Scott