How to do UI automation with Ruby Raider — Part 1: Creating a new project

Agustin Pequeno
3 min readJun 2, 2022

Hello everybody!

This is the beginning of a series, in which we will learn together how to do UI automation using Ruby Raider, Watir, and Rspec.

In this tutorial, we will create a new test automation project and run an example test.

What is Ruby Raider?

Ruby Raider is a gem built to facilitate the creation of UI test automation frameworks in ruby, and to help developers and QA to increase their productivity by providing scaffolding and reporting out of the box.

What is Rspec?

Rspec is a testing tool created and written in Ruby for BDD (Behaviour driven development)

What is Watir?

Watir is an automated testing library written on top of selenium to facilitate writing test automation (Watir stands for Web Application Testing in Ruby)

Part 1 — Installing Ruby

Let’s install RVM (If you have RVM already installed you can skip this section).

RVM stands for Ruby Version Manager, and it allows us to install, manage and use multiple ruby versions easily.

If you are using a windows machine install (https://docs.microsoft.com/en-us/windows/wsl/install) before following these steps

To install RVM do:

gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

If you don’t have gpg installed you can do:

For Mac:

brew install gnupg

For Linux or WSL:

sudo apt update
sudo apt install gnupg2

And if you don’t have brew installed on your Mac you can do:

/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

In case the key server throws you an error that the server is not available you can use instead:

gpg — keyserver keyserver.ubuntu.com — recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

Afterward in any of the systems, you can do:

\curl -sSL https://get.rvm.io -o rvm.sh

And now let’s install the latest version of ruby:

rvm install ruby

Part 2 — Creating our framework

Now is time to finally install ruby raider

gem install ruby_raider

Once the installation is done we can use Ruby Raider to generate a new framework:

raider new test_framework

We will be presented in our terminal with multiple options for the case of this tutorial we press 2 on our keyboard to select Watir.

And afterward, we press 1 to select Rspec

Now all the files needed for our framework have been created and all of our gems have been installed

Part 3 — Running our example test

Open the newly created framework on your favorite IDE, in my case that is RubyMine and run one of the example tests

If you want to run all the tests from the terminal you can do

raider raid

Summing up

After the first part of this series we have a framework created, we have examples of tests we can run and in the following part we will dig deeper into how these tests run and we will create a new test.

Resources:

Rspec — https://relishapp.com/rspec/

Watir — http://watir.com/guides/

RVM — https://rvm.io/rvm/install

Ruby Raider — https://ruby-raider.com/

Ruby Raider Github — https://github.com/RubyRaider/ruby_raider

gpg — https://gnupg.org/

--

--