Sunday, September 27, 2009

Cucumber and Ruby on Rails (Part 2) My learning materials

Create a project and do testing using cucumber.

Project name “product”

Requirement

  1. The user can see the available products.

When the user come to the page he should be able to see all the available products with description like

Title: Ruby on Rails

Description: Model, view, controller architecture

Image Url: ror.jpg

Price: 21

  1. He should be able to add new products.

  2. He should be able to show the products.

  3. He should be able to edit products.

  4. He should be able to validate products details when adding new products.

Error massages should be display when there is a wrong with adding data like

Price should be number

Title cant be blank etc.

  1. When Edit product the validation also should be done.

  2. He should be able to navigate any places by clicking links.

  3. He should be able to delete products.

Product table contents

Title = String

Description = String

Image Url = String

Price = Decimal



Lets start developing the project.

  1. Install cucumber

sudo gem1.8 install cucumber

  1. The plugins’ dependencies must be installed separately:

gem install term-ansicolor treetop diff-lcs nokogiri

  1. Lets start developing our project

Open a terminal then type

rails -d mysql product

cd product

rake db:create:all

rake db:migrate

  1. Now lets try to create cucumber

ruby script/generate cucumber

  1. Then run

Cucumber features

  1. Then u can see as follows







  1. Now you are ready to work with cucumber

  2. lets see that in next post.





1 comment:

bujji said...

Hi Jeewantha

your blogs are very good for learner's like me.right now i am working on QTP and my manager ask me to prepare POC for cucumber,so can you help me out in this regards. To be frank i have Zero knowledge on this cucumber.
Can you tell me more abt cucumber in your next blogs.I appriciate if you send me the materials.

thanks
rajesh (dantuluri.rajesh@gmail.com)