Selenium With Test::Unit
Run Test::Unit tests on the TestMu AI cloud grid. This guide covers setup, running a sample test, configuring capabilities, and testing locally hosted pages.
All the code used in this guide is available in the sample repository.
Prerequisites
Complete the following steps before you start Ruby automation testing with Selenium.
- Install Ruby and gem on your local system. Follow these instructions to install on different operating systems.
- For Windows, download from the Ruby Installer for Windows.
- For Linux or Ubuntu, run a simple apt command like below:
sudo apt-get install ruby-full- For macOS, run a Homebrew command like this:
brew install ruby - Install the parallel_tests gem to run tests in parallel.
- Get the TestMu AI binary file for running tests on your locally hosted web pages.
Step 1: Clone the Sample Project
Clone the repository and install dependencies.
git clone https://github.com/LambdaTest-sample-test-frameworks/Ruby-UnitTest-Selenium.git
cd Ruby-UnitTest-Selenium
Install project dependencies:
bundle install
Step 2: Set Your Credentials
Configure your credentials to connect to the TestMu AI Selenium Grid.
Set TestMu AI Username and Access Key in environment variables.
- macOS / Linux
- Windows
export LT_USERNAME="undefined"
export LT_ACCESS_KEY="undefined"
set LT_USERNAME="undefined"
set LT_ACCESS_KEY="undefined"
Step 3: Configure Your Test Capabilities
Define browser, version, and OS settings for your test run.
In the test script, update your test capabilities. This code passes browser, browser version, and operating system information, along with TestMu AI Selenium grid capabilities via the capabilities object.
caps = {
:browserName => lt_browser,
:browser_version => lt_browser_version,
:platform_name => lt_os,
:name => "UnitTest Sample Test",
:build => "UnitTest Selenium Build"
}
Use the TestMu AI Capabilities Generator to auto-generate the capabilities class for your test requirements.
Step 4: Run the Test
Execute the Test::Unit test from the command line.
ruby LambdaTest.rb
Step 5: View Your Results
Check the test output on the console and the TestMu AI dashboard.
Visit the TestMu AI Automation Dashboard to view your test results. The dashboard provides:
- Text logs for each test step
- Screenshots captured during execution
- Video recordings of the full test session
Run Test::Unit Tests Using Agent Skills
Use AI coding assistants to generate and run Test::Unit tests with the TestMu AI Agent Skill.
The testunit-skill is part of TestMu AI Agent Skills - structured packages that teach AI coding assistants how to write production-grade test automation.
Install the skill:
git clone https://github.com/LambdaTest/agent-skills.git
cp -r agent-skills/testunit-skill .claude/skills/
# For Cursor / Copilot
cp -r agent-skills/testunit-skill .cursor/skills/
Install all available framework skills at once by cloning the repository directly into your tool's skills directory (e.g., .claude/skills/, .cursor/skills/).
