
How to Download and Install Cucumber
Meta Description:
How to Download and Install Cucumber: Learn how to install Cucumber on Windows with this complete guide. Includes installation of Ruby, DevKit, RubyMine IDE, watir-webdriver, and how to run your first Cucumber feature file and step definitions.
How to Download & Install Cucumber in Windows: Complete Tutorial
How to Download and Install Cucumber: Installing Cucumber on a Windows machine can seem complex, but it’s fairly straightforward if you follow the right steps. This guide provides a complete roadmap — from installing Ruby and DevKit to running your first Cucumber test script in RubyMine IDE.
Prerequisites
How to Download and Install Cucumber: Before you begin, ensure you have the following:
- A Windows operating system (Windows 10 or later recommended)
- Internet connection to download packages
- Admin privileges on your PC
Step 1: Install Ruby and DevKit
How to Download and Install Cucumber: Cucumber requires Ruby as its base language.
- Visit the official Ruby downloads page:
- Download the recommended Ruby+DevKit version for Windows.
- Run the downloaded .exe file.
- Accept the license and click Next.
- Choose your installation directory and select all options.
- Click Install and wait for it to complete.
- Click Finish once the setup is done.
- Launch the Ruby Command Prompt (a command-line interface for Ruby).
Step 2: Install Cucumber via Ruby Command Prompt
- Open Ruby Command Prompt.
Type the following command:
bash
gem install cucumber
- Wait for the Cucumber gem to download and install.
To verify the installation, type:
bash
cucumber –version
- This should display the installed version of Cucumber.
Step 3: Install RubyMine IDE
How to Download and Install Cucumber: RubyMine is an advanced IDE by JetBrains for Ruby development.
- Download RubyMine from
- Run the installer and follow these steps:
- Click Next
- Choose the install location
- Configure installation options
- Choose Start Menu folder
- Click Install
- Click Finish
- Click Next
- On the first launch:
- Select Do not import settings
- Click Evaluate for free
- Accept the license agreement
- Click Skip All and Set Defaults
- RubyMine will now launch
- Select Do not import settings
- Create a new Ruby project via File > New Project
Step 4: Install watir-webdriver
How to Download and Install Cucumber: watir-webdriver allows browser automation using Ruby.
In Ruby Command Prompt, type:
bash
gem install watir-webdriver
- Wait until the installation is complete.
Step 5: Create Your First Cucumber Project
Project Setup
- Open RubyMine IDE
- Create a new project (e.g., CucumberTest)
Inside the project folder, create a subfolder:
nginx
features
Inside features, create a new file:
yourfilename.feature
Sample Feature File
Add the following content to your .feature file:
gherkin
Feature: Sample Login
Scenario: Successful Login
Given I launch the browser
When I open the login page
Then I should see the homepage
Step 6: Create Step Definition File
How to Download and Install Cucumber: Inside the features folder, create a subfolder:
nginx
step_definitions
- Create a new Ruby file named test_step.rb
- Add the following step definition code:
ruby
Given(‘I launch the browser’) do
puts ‘Browser launched’
end
When(‘I open the login page’) do
puts ‘Login page opened’
end
Then(‘I should see the homepage’) do
puts ‘Homepage displayed’
end
Step 7: Run Your First Cucumber Test
- Open Ruby Command Prompt
Navigate to your project directory:
bash
cd path\to\your\project
Run the feature file using:
bash
cucumber
You will see the scenario steps executed with the messages from the puts statements.
Final Output
If everything is installed correctly, Cucumber will execute your feature file and display step-by-step results. This confirms that your environment is set up and ready for Cucumber-based BDD test automation.
Summary
Component | Purpose |
Ruby & DevKit | Base programming environment |
Cucumber | BDD test framework |
RubyMine IDE | Code editor and test runner |
watir-webdriver | Web browser automation library |