• Home
  • Testing
  • SAP
  • Web
  • Must Learn!
  • Big Data
  • Live Projects
  • Blog

Cucumber installation could be tiresome but its relatively easy.

Here is a roadmap of components that need to be installed to make Cucumber work

PART A) Install Ruby and DevKit

Step1) Got to http://rubyinstaller.org/downloads/

Step 2) Open the downloaded file.

  1. Accept license
  2. Click on Next button

Step 3) In next screen.

  1. Select your Installation Directory
  2. Select all Options
  3. Click Install

Step 4) In the following screen, Click on Next

Step 5) Wait for installation to complete.

Step 6) Click Finish

Step 7) Once installation is complete, Lets Run Ruby!

Step 8) You will see Ruby Command prompt similar to Windows cmd.

Install Ruby Development Kit

Step 1) Download Development kit here . Development kit should be same version as that of Ruby you downloaded.

Step 2) The development kit is in .7zip format file and when you execute it ask for extract file. Just choose any directory you want extract and extract it

Step 3) Now in extracted folder you see dk.rb file. it is development kit installation file, we need it when we install development kit in ruby.

Step 4) Go back to Ruby cmd prompt. And locate development kit directory in cmd which you extracted for development kit.

Step 5) Now type command "ruby (your development kit path) dk.rb init" to initialize process of development kit as shown in image.

Step 6) Next, we have to install development kit. Type command in cmd "ruby dk.rb install" for installation.

Step 7) Devkit installation completed:

Install Cucumber

Step 1) Type in Ruby cmd "gem install cucumber". This command will download and install Cucumber at command line itself

After few seconds cucumber installation procedure has been start

Step 2) To verify cucumber is installed successfully or not just type "cucumber –version"

Install IDE RubyMine

Step 1)

Step 2)

Step 3)

Step 4)

Step 5)

Step 6)

Step 7)

Step 8)

Step 9)

Step 10)

Step 11)

Step 12)

Install water-webdribver

Step 1) Click on "Start Command Prompt With ruby" and install command "gem install water-webdriver"

Step 2) water-webdriver install successfully

First Cucumber Script

Step 1) Open RubyMine Editor via windows start menu

You will See Rubymine Dashboard as below

Step 2) Create a new project in Rubymine editor

Step 3) create a file directory

Step 4) create and Save File in "yourfolder/features/" with name "yourfilename.feature"

Step 5) To execute our scenario, save the following commands in the Feature File


Feature: Multiplication 
I multiply two numbers 
	Scenario: multiply a and b 
		Given I have variable a 
		And I have variable b 
		When I multiplication a and b 
		Then I display the Result

Step 6) Now lets Run our First feature file.!

Click on "Start Command Prompt With ruby"

It will look like this!

Step 7) Lets create step definition file for our Feature File!

Create a new folder in Rubymine editor

Step 8) Save File As below in "yourfolder/features/step_definititons" with name test_step.rb

Step 9) Write the following code into the step file

Code :

Given(/^I have variable a$/) do
@a = 50

And(/^I have variable b$/) do
@b = 70

When(/^I multiplication a and b$/) do 
@mul = @a * @b

Then(/^I display the Result$/) do 
puts "Multiplication of #{@a} and #{@b} is #{@mul}"

Step 10) Now, again run our feature file:

The result is