CAPABILITY GENERATOR

LambdaTest DocumentationAutomation Testing ● Quick Guide To Run Ruby Tests On LambdaTest Selenium Grid

Quick Guide To Run Ruby Tests On LambdaTest Selenium Grid


LambdaTest Selenium Automation Grid is a secure, scalable, and reliable Selenium grid on cloud that can help you run your Ruby automation scripts on 2000+ different browsers and operating system environments. The grid is specifically built for high performance and gives you not only a greater browser coverage but also an ability to run automation tests in parallel. This helps you reduce your automation test execution time significantly. This post will help you quickly get started with running Ruby test scripts on LambdaTest Selenium Grid.

Prerequisites


First, you would have to install Ruby and gem on your local system. We recommend installing the latest version of Ruby. Installing these platforms is a little different in each operating system

  • For windows, you can download the latest installed the official website.
  • 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

Installing Selenium Dependencies For Ruby


Once you have ruby and gem setup, you would now have to install Selenium dependencies. You can install Selenium via simple gem command

Sample Ruby and Selenium Test To Get You started


Once you have installed necessary dependencies, you are all set to run your Ruby automation scripts on LambdaTest Selenium grid. To get started you can try out the code below. It’s a simple Ruby scripts that opens up Google.com, search LambdaTest in Google search, and then output the title of the search result page. You can also fork it from our Ruby GitHub repository here.

Here’s how you can execute the test from your terminal.

The first thing to note in this code is the use of remote webdriver. To access LambdaTest grid, you would have to invoke remote webdriver instead of local webdrivers. In addition, the browser enthronement details are passed on through desired_capabilities.

In this example we are running a test on Windows 10, Chrome 67 environment. You can test your own choice of an environment by changing the parameters in the object. You can leverage our capabilities generator tool to create code for your environments.

Tear Down: The tear down method helps LambdaTest platform understand when the execution of a test is finished. It’s important to tear down each test or else it will give timeout errors.