Installation of Cucumber in Ubuntu

Cucumber is a software tool that computer programmers use for testing other software. It runs automated acceptance tests written in a Behavior Driven Development (BDD) style. Cucumber is written in the Ruby Programming Language.

Installation of Cucumber in UBUNTU
Figure 1: Installation of Cucumber in UBUNTU

Cucumber supports various operating systems and likewise we will see how to install Cucumber in the Ubuntu Operating System.

Step 1

Let us check whether Ruby is installed or its installed version.

Ruby is installed or its installed version
Figure 2: Ruby is installed or its installed version

You can see that Ruby is installed already with version 1.8 and now we need an updated version. So we will install the latest version of Ruby that is the base for the Cucumber tool.

Step 2

Installing Ruby.

Installing ruby
Figure 3: Installing Ruby

Once the command is given to install Ruby, it will set up the installation environment and will ask us for the space requirements. We need to provide “Y” (Yes) to proceed further.

Installing Ruby will take some time and once it is finished the terminal will return to the default home directory.

Installing Ruby will take some time
Figure 4: Installing Ruby will take some time

Step 3

Once Ruby is installed, you can always check for the version using the following command:

installed ruby
Figure 5: Now we have installed Ruby version 1.9.3 and can now proceed to install Cucumber.

Step 4

Installing Cucumber.

cucumber is installed successfully
Figure 6: Now Cucumber is installed successfully as shown in the image and now we need to check whether Cucumber is installed properly or not. For that go to the next step, Step 5:

Step 5

Cucumber help.

cucumber help menu
Figure 7: Now we got the Cucumber help menu as in the image that shows that the Cucumber is installed successfully.

Cucumber consists of various other supporting applications for its functioning. With the help and combination of other applications Cucumber runs effectively and user friendly. So let us explain and see how to install those supporting applications.

Step 6

Gherkin and its installation.

Gherkin is the language that Cucumber understands. It is a business readable, domain-specific language that lets you describe software behavior without detailing how that behavior is implemented.

Gherkin serves two purposes, documentation and automated tests. Let us see the command for its installation.

gherkin is installed successfully
Figure 8: Now Gherkin is installed successfully as displayed

Step 7

What Capybara is and its installation.

Capybara is an integration testing tool for rack-based web applications. It simulates how a user would interact with a website. Capybara helps you test web applications by simulating how a real user would interact with your app.

capybara is successfully installed
Figure 9: Now capybara is successfully installed as displayed in the image.

Step 8

What Rspec is and its installation.

RSpec is a Behaviour-Driven Development tool for Ruby programmers. BDD is an approach to software development that combines Test-Driven Development, Domain Driven Design and Acceptance Test-Driven Planning. RSpec helps you do the TDD part of that equation, focusing on the documentation and design aspects of TDD.

rspec is installed successfully
Figure 10: The rspec is installed successfully as shown in the image.

Step 9: What is selenium-webdriver and its installation.

WebDriver is a tool for writing automated tests of websites. Its purpose is to mimic the behavior of a real user and as such interacts with the HTML of the application. Driving a browser natively as a user would either locally or on a remote machine using the Selenium Server marks a leap forward in terms of browser automation.

selenium webdriver
Figure 11: Finally the selenium webdriver is also installed successfully. And now the Cucumber tool is ready for functioning in Ubuntu. 

Sample Program

Feature: Login Outlook Account

    As a End User

    I want to login to my outlook account so that I can access my mail.

    Scenario: Login of outlook account

    Given URL of outlook

    When I enter the values "[email protected]" and "testuser123" and I check the checkbox then I should click the "Sign in" button to login to my account.

    Scenario: Composing mail

    When clicking the New button then I should be able to compose email and then click Send.

    Scenario: Login of Gmail mail account to verify the incoming mail

    When clicking the photo at the right top corner then I should see the logout button and click the logout button.

    Scenario: Open Gmail login page

    Given the URL of Gmail, when I enter values for username and password then I should click the "Sign in" button to login to my account.

    When I click the unread message then I should be able to view the inbox and logout from the account.

Use the following command to run the program in the terminal.

cucumber
Figure 12: Now the Cucumber program will start as in the image. The next is the test result displayed in the following image.

Test result
Figure 13: Test result

Up Next
    Ebook Download
    View all
    Learn
    View all