CAPABILITY GENERATOR

LambdaTest DocumentationAutomation Testing ● Ruby with CapyBara- Running Automation Scripts on LambdaTest Selenium Grid

Ruby with CapyBara- Running Automation Scripts on LambdaTest 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 Selenium for Ruby + CapyBara on LambdaTest.

This topic will be focusing on:

  • Running a sample Selenium with Ruby & CapyBara on LambdaTest Automation.
  • Setting up environment for testing your locally hosted web pages or website.
  • Running multiple ruby tests in parallel with CapyBara using LambdaTest Selenium Grid.

Prerequisites For Running Ruby With CapyBara Using Selenium Grid


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 https://rubyinstaller.org/downloads/.
  • 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 tests in parallel you will require the parallel_tests gem.
  • LambdaTest binary file for running tests on your locally hosted web pages.
  • LambdaTest Authentication Credentials
  • Be aware of your LambdaTest authentication credentials i.e. your LambdaTest username, access key and HubURL. You need to set them up as your environment variables. You can retrieve them from your LambdaTest automation dashboard by clicking on the key icon near the help button.

    For Linux/Mac:

    For Windows:

    Installing Selenium Dependencies For RSpec


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

    Setting Up The Environment


    You need to clone our GitHub repository which demonstrates a sample of Ruby-CapyBara.

    After cloning, you need to navigate to the cloned directory and install project dependencies using the below command:

    The example mentioned below would help you to execute your automation test using Ruby with CapyBara.

    Now Create the support rb file.

    Note: Update *.config.yml files inside the config/ directory with your [LambdaTest Username and Access Key].

    Running Tests Using Ruby & CapyBara


    Navigate to the directory where you cloned the sample of Ruby-CapyBara and run the following command.

    → To run a single test.

    Testing Locally Hosted or Privately Hosted Projects


    To help you perform cross browser testing of your locally stored web pages, LambdaTest provides an SSH(Secure Shell) tunnel connection with the name Lambda Tunnel. With Lambda Tunnel, you can execute your Ruby tests using CapyBara to perform automated cross browser testing on browsers offered by online Selenium grid at LambdaTest. So you make sure how well your changes look, even before your customers. Curious to know more about Lambda Tunnel?

    Follow our documentation on Lambda Tunnel to know it all. OS specific instructions to download and setup tunnel binary can be found at the following links.

    Use the below command for running a local test.

    Running Tests In Parallel


    Parallel Testing is one of the most demanding features of LambdaTest Selenium Grid. By parallel testing, you can run more than one test case, simultaneously. This means that Parallel testing would allow you to execute numerous automation test cases altogether. So you execute a single test scenario across different browsers or could run different test scenarios across the same browser but with different browser versions. Wondering how many parallel test cases can you run? That depends entirely on the number of concurrent session under your opted plan.

    Monitor and analyze your test result on the LambdaTest Automation Dashboard.

    Deploy your code in a reliable manner at scale using Ruby & CapyBara with LambdaTest Selenium Grid, and ensure it looks robust across every browser to provide a seamless user experience to all your visitors. Happy Testing!