How to Download & Install CUCUMBER in Windows
Cucumber installation could be tiresome but its relatively easy.
Here is a roadmap of components that need to be installed to make Cucumber work
Install Ruby and DevKit
Step1) Got to https://rubyinstaller.org/downloads/
Step 2) Open the downloaded file.
- Accept license
- Click on Next button
Step 3) In next screen.
- Select your Installation Directory
- Select all Options
- 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 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
You should follow the steps below to successfully Install IDE RubyMine.
Step 1) Click Next to continue to Install IDE RubyMine.
Step 2) Choose Install location
Step 3) Installation Options
Step 4) Choose the start menu folder
Step 5) Click on Install
Step 6) Click on Finish
Step 7) Select Do not import settings.
Step 8) Click on Evaluate
Step 9) Accept the license
Step 10) Skip Remaining and set defaults
Step 11) Open
Step 12) Create a new project
Install watir-webdriver
Step 1) Click on “Start Command Prompt With ruby” and install command “gem install watir-webdriver”
Step 2) watir-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
Code:
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 end And(/^I have variable b$/) do @b = 70 end When(/^I multiplication a and b$/) do @mul = @a * @b end Then(/^I display the Result$/) do puts "Multiplication of #{@a} and #{@b} is #{@mul}" end
Step 10) Now, again run our feature file:
The result is