0.01
No commit activity in last 3 years
No release in over 3 years
Run QUnit tests through Selenium WebDriver
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 3.0

Runtime

 Project Readme

qunit-selenium

Ruby QUnit test runner for Selenium WebDriver

Install

In your Gemfile:

gem 'qunit-selenium'

Or in your ruby gems:

$ gem install qunit-selenium

Pre-requisites

This gem is a wrapper around the selenium-webdriver gem with the additional logic to parse the QUnit test results page and report the success/failure of your QUnit tests. Please refer to the selenium documentation for detail instructions and drivers/browsers support.

By default qunit-selenium will use the Selenium FirefoxDriver instantiated with a new Firefox profile.

If you wish to use a different driver, or to customise your driver behaviour you can still use qunit-selenium through its API (see below.)

Usage

Command line

$ qunit-selenium [--timeout=seconds] [--screenshot=FILE] URL

This command will open the QUnit test page at the given url and wait for the tests to complete before collecting and displaying the test run results. If the tests do not complete within the given timeout (by default it's 10 seconds) Selenium will raise an error and the command will fail.

More in general, if any error is raised by Selenium which would cause a premature end of the test run, the program will generate a screenshot of the error page (file qunit-selenium-error.png).

Example:

$ qunit-selenium --timeout 20 --screenshot mytests.png http://myserver/tests

Ruby API

Example:

require 'qunit/selenium/test_runner'

driver = ::Selenium::WebDriver.for :firefox
url = 'http://test.server.com:8080'

result = QUnit::Selenium::TestRunner.new(driver).open(url, timeout: 30)

puts "Total tests: #{result.tests[:total]}"
puts "Passed:      #{result.tests[:passed]}"
puts "Failed:      #{result.tests[:failed]}"

driver.quit