LambdaTestAutomation Testing ● Running Automation Scripts on Selenium Grid Cloud Using Capybara Ruby

Running Automation Scripts on Selenium Grid Cloud Using Capybara Ruby

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 CapyBara Ruby on LambdaTest.

This topic will be focusing on:

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

Prerequisites For Running CapyBara Ruby Using Selenium Grid

All the code samples in this documentation can be found in the Capybara-Ruby 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 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 CapyBara Ruby.

    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 CapyBara Ruby.

    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 CapyBara Ruby

    Navigate to the directory where you cloned the sample of CapyBara Ruby 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 LambdaTest Tunnel. With LambdaTest Tunnel, you can execute your tests using CapyBara Ruby 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 LambdaTest Tunnel?

    Follow our documentation on LambdaTest 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 Using Capybara Ruby

    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 CapyBara Ruby with LambdaTest Selenium Grid, and ensure it looks robust across every browser to provide a seamless user experience to all your visitors. Happy Testing!