LambdaTestAutomation Testing ● RSpec With Selenium – Run RSpec Tests On LambdaTest’s Selenium Grid

RSpec With Selenium – Run RSpec Tests On LambdaTest’s Selenium Grid

LambdaTest provides support with Selenium WebDriver for pacing the execution of your automation test scripts. LambdaTest is a cloud-based, cross browser testing tool, providing a Selenium grid of 2000+ browsers and browser versions running through real operating systems to speed up automation testing of your web-app or website. This topic will help you to automate your website testing using RSpec with Selenium on LambdaTest.

This topic will be focusing on:

  1. Running a sample RSpec with Selenium on LambdaTest Automation.
  2. Setting up environment for testing your locally hosted web pages or website.
  3. Core Capabilities: understanding and configuring them in your Selenium test suite.
  4. Exploring advanced features of LambdaTest.

Prerequisites To Run RSpec Tests With Selenium

All the code samples in this documentation can be found in the RSpec LambdaTest Repository on GitHub. You can either download or clone the repository to quickly run your tests.

First, you would have to install Ruby and gem on your local system. Installing these platforms is a little different in each operating system

  • For windows, you can download the latest installed here
  • If you are using Linux or Ubuntu OS, you can run a simple apt command like below. You can also refer to this doc to know more about which command suits your OS better.
  • If you are using MacOS, you can run a homebrew command like this:
  • To run RSpec tests in parallel you will require the parallel_tests gem.
  • LambdaTest binary file to run RSpec tests on your locally hosted web pages.

Installing Selenium Dependencies To Run RSpec Tests

Once you have ruby and gem setup, you would now have to install Selenium dependencies. Use the below gem command for installing Selenium:

Getting Started Using RSpec with Selenium Automation & LambdaTest

Now that we are all set with prerequisites. It is time we look at a sample code, this code will validate if there is any change in the title of Google’s home page. This code is also available on our RSpec GitHub repository for you to clone and play around.

By using this code example, we will first validate your LambdaTest credentials for authentication purpose. Later, the code will select the basic capabilities such as OS, browser, browser version and so on.

Now, lets create config.conf file.

Now, add readConfig.rb file.

The Selenium Webdriver test would open a URL, mark the first two items in the list as done, add an item in the list, and return the total number of pending item. Your results would be displayed on the test console (or command-line interface if you are using terminal/cmd) and on LambdaTest dashboard. LambdaTest Dashboard will help you view all your text logs, screenshots and video recording for your entire Selenium tests.

Execute The Test Using RSpec With Selenium

You would need to execute the below command in your terminal/cmd.