The Problem

You may be just starting out with test automation, or you may have been a single engineer responsible for building, maintaining and running the suite. Suddenly there is a new QA in the team or other team members want to run the test to ensure they aren’t breaking anything. Immediately they are in dependency hell and you run a few “gem install” commands until everything seems OK, however there is some weird issue that you finally track down to being a different version of cucumber.

Surely this can’t go on…

Solution

Meet bundler, the dependency management tool for Ruby

Install bundler:

gem install bundler

You simply create a new file in your project called “Gemfile”

source 'https://rubygems.org'
gem 'cucumber'
gem 'watir-webdriver'

Install all gems from the Gemfile in the current directory

bundle install

Keep the Gemfile and the generated Gemfile.lock in source control to ensure everyone checking out the project has easy access to installing the correct versions of all gems required.

Even better you can use the Gemfile as part of a CI/CD pipeline to ensure all the required dependencies are available on your build/test slaves!