CAPABILITY GENERATOR

LambdaTestAutomation Testing ● TestUnit with Selenium: Run TestUnit Automation Scripts on Selenium Grid Cloud

TestUnit with Selenium: Run TestUnit Automation Scripts on Selenium Grid Cloud


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 TestUnit with Selenium on LambdaTest.

This topic will be focusing on:

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

Prerequisites For Running TestUnit With Selenium


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.

Installing Selenium Dependencies For TestUnit Automation


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 TestUnit With Selenium & 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 TestUnit Automation 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 TestUnit automation tests.

Execute The Tests Using TestUnit Automation


To perform the tests using TestUnit with Selenium, you would need to execute the below command in your terminal/cmd.