December 18, 2018

Basic Capybara-Gauge: Setup Ruby Environments for The-Internet

This is the second part of a series of blog posts. Care to go back to the beginning

With the last entry, we analyzed the App Under Test, Dave Haeffner's The-Internet and came up with some test specifications. With this entry, we will be setting up the Ruby environment that will be running the Capybara-Gauge tests.

Although I am developing this project on my Macbook with this example, it is possible to install Ruby, Gauge on a Windows Machine.  See my article, Intro to setting up a BDD framework with VS Code + Gauge + Ruby.

Create a New Directory For Capybara-Gauge Project 

Coding projects, I store in my Home directory, under the /src directory. Let's create a new folder for the project, called capybara-gauge. Firing up the Mac Terminal, I can go to Home by using the shortcut to change the directory to it:  cd ~
  • cd ~/src
  • mkdir capybara-gauge
  • cd capybara-gauge


Check If Ruby Is Installed

 Do you already have Ruby installed? In the Mac Terminal:
  • ruby -v
... No Ruby version? I like iusing the Ruby Environment manager rbenv to set up the Ruby environment so I can switch back and forth between different Ruby versions. Rbenv uses Bundler to update dependencies.

No Ruby? Install It With RBENV!

Do you have the Homebrew package manager on your Macbook? It installs many helpful packages for the MacOS. Check to see if you have it by:
  • brew -v
If not go to and install it according to the script shown.
  • /usr/bin/ruby -e "$(curl -fsSL"
Once Homebrew is installed, you can install rbenv with:
  • brew install rbenv 
The latest stable version of Ruby, as of this writing, is Ruby 2.5.1. Make sure it is on the list:
  •  rbenv install --list
The last stable version is "2.5.1" at the time of this writing. To install this version:
  • rbenv install 2.5.1

Bring on the Bundler!

 Want an easy way to update all your Ruby dependencies? Bring on the Bundler! To install Bundler:
  • gem install bundler
 All your Ruby dependencies can be stored in a Gemfile, which you will set to reference  '', where people can find, publish, and install Ruby gems.

What is a Ruby gem? From Guides.RubyGems.Org:

"The RubyGems software allows you to easily download, install, and use ruby software packages on your system. The software package is called a 'gem' which contains a packaged Ruby application or library.

"Gems can be used to extend or modify functionality in Ruby applications. Commonly they’re used to distribute reusable functionality that is shared with other Rubyists for use in their applications and libraries. Some gems provide command line utilities to help automate tasks and speed up your work".

... This is like how we used Maven to help build Java projects, storing items in the

From Bundler's GitHub project:

"Bundler makes sure Ruby applications run the same code on every machine.

"It does this by managing the gems that the application depends on. Given a list of gems, it can automatically download and install those gems, as well as any other gems needed by the gems that are listed. Before installing gems, it checks the versions of every gem to make sure that they are compatible, and can all be loaded at the same time. After the gems have been installed, Bundler can help you update some or all of them when new versions become available. Finally, it records the exact versions that have been installed, so that others can install the exact same gems".

... If you also want to learn even more about Bundler, check their site and read, What is Bundler?

Install Gauge-Ruby

We've covered ThoughtWorks Gauge, a human readable way to set up tests, quite extensively on this blog:
 ... It is basically Cucumber with bullet points and a Markdown format. We use it at work. Since we have many moving parts where multiple steps need to happen all at once to get environments spun up and agents installed, it suits our needs.

We will be following the documentation in Docs.Gauge.Org for the Latest Installation:

To install Gauge via Homebrew:
  •  brew install gauge
To install the Ruby plugin for Gauge, along with HTML reporting:
  • gauge install ruby
  • gauge install html-report
Want an XML report? Also do:
  • gauge install xml-report
Want an JSON report? Also do:
  • gauge install json-report
Want to see some sample reports generated by running the finished product? Take a look at the project directory on GitHub of my capybara-gauge project:

Scaffold Initial Gauge-Ruby Project

To build out scaffolding for your first Gauge project:
  • gauge init ruby
You should receive a message saying: "Successfully initialized the project. Run specifications with "bundle exec gauge run specs/".

Run the command:
  • bundle exec gauge run specs/
... You will see that Ruby gem metadata is fetched from,  dependencies are resolved, and Bundler installs and updates everything that Gauge needs to run, and installs everything in the subdirectory, /vendor/bundle.

It also runs two mock tests, checking that given a word, it can count vowels in single or multiple words. Need more information? Run the tests in verbose mode!
  • bundle exec gauge run specs/ -v

View The Project

Open the project using your favorite IDE (Integrated Development Environment) or text editor such as RubyMine,, VS Code or Sublime Text Editor... Though, at the time of this writing, only VS Code supports a Gauge debugger.

You will see a structure much like this:

The important parts:
  • Specs: The specifications for your application, used for testing purposes. This is where we will putting the test scenarios we came up with last time
  • Step Implementations: Joining the steps listed in the specs with code to act out what is needed in the tests. 
  • Reports: View what passed and what failed in the HTML Reports. 
  • Gemfile: Where we store our Ruby dependencies. 
Next time, now that we have an environment, we will set up Capybara to open up a browser.

Happy Testing!

-T.J. Maher

Sr. QA Engineer, Software Engineer in Test
Meetup Organizer, Ministry of Testing - Boston

Twitter | YouTubeLinkedIn | Articles


official said...

this is a very good and interesting site thanks for sharing this with us

rice purity said...

Cool stuff you have and you keep overhaul every one of us

Unknown said...

If your looking for Online Illinois license plate sticker renewals then you have need to come to the right place mobdro apk for iphone

Harry jack said...

How may want to having no Internet have an effect on the general non-public individual?is it better to use online fax or email for documents

Anonymous said...

This blog has very distinct features. Thanks
successful solution method bonus

Kevin said...
I’m eager to find the valuable information and for me this is the right place to get the good stuff.

Danieal Brian said...


Ashley said...

Extremely proactive and collaborative in their approach,best UI design team takes a genuine interest in the success of the company's products and goals.

tike mik said...

Look long and hard at your marketing programs and be impartial about which ones are worth spending energy on and which ones need to be dropped. learn this here now

tike mik said...

It is the way in which products or services are promoted and sold over the Internet. Internet marketing, also called web marketing, online-marketing and even "i" or "e" -Marketing uses the Internet to deliver all types of media to a global and even local market. Lead generation

Cynthia Boyd said...


Free said...

this is the best website i love that "Dental Assistant Courses Near Me"

soap packaging said...

The soap packaging | soap packaging are as extraordinary as they are unique and work wonders for businesses Custom Printing is aiming at creating boxes from extremely biodegradable material. They taking small stores to local domination, to national level brands to multi-national organization.

Rodney Janis said...

They also enjoyed the ability to think from the perspective of targeted users, and would highly recommend them.
branding firm in San Francisco

tike mik said...

It is important to have a single point of contact for your project to ensure nothing gets lost in translation. A Project Manager should be assigned to all web projects. If you are working with a small web company, however, the Project Manager may also be the web designer and/or web developer himself.

poojasharma said...

Immerse yourself in the goodness of our SEO services Delhi. Our offerings and discounts are one of a kind, without leaving any room for inconsistencies. Email or call us as soon as possible! Seo Services Delhi

poojasharma said...

Our designs speak volumes for your brand and act as a prolific medium of communication for your objectives.

writers4you said...

Great work! This is the kind of information that should be shared across the internet.
Disgrace on the search engines for not positioning this put up upper!
content writing company in delhi
travel content writer in delhi

Amit Gupta said...

This blog post has very informative inspired my thought.

Expose to Sunlight said...

This project seems to be interesting..

High Technologies Solutions said...

I really enjoyed while reading your article, the information you have mentioned in this post is really good. I am waiting for your upcoming post.

Software Testing – Beginner to Advanced Online Course in Delhi
Excel & Advanced Excel Training Course in Delhi, NCR
Basic- Advanced MS Office Training Course in Delhi
Tally ERP.9 Training Course in Delhi, NCR

tike mik said...

A frequent mistake that businesses make is hiring an internet marketing company too quickly -- primarily based on price. Your website is a visual representation of your business and a poorly designed site can frustrate visitors, misrepresent your products and even lose sales. Before you hire a internet marketing firm, research the answers to these questions: Melbourne SEO company

Ad Filmmakers said...

Hey, Nice Article Please Checkout my website Advertising Agency in Hyderabad