Selenium

Selenium Remote Control is a test tool that allows you to write automated web application UI tests in any programming language against any HTTP website using any mainstream JavaScript-enabled browser.

Selenium Remote Control provides a Selenium Server, which can automatically start/stop/control any supported browser.

To use Selenium from Ruby:

First, install the selenium and rspec gems from rubyforge:

gem install selenium
gem install rspec

Then, download the selenium server and start an instance from a command window:

java -jar selenium-server.jar

Now you are ready to create your first ruby selenium test. Here is a sample script showing how you call Raakt in an rspec test:

require 'spec'
require 'selenium'
require 'raakt'
 
context 'Test Google' do
  setup do
    @sel = Selenium::SeleniumDriver.new("localhost", 4444, "*iexplore", "http://www.google.com", 15000)
    @sel.start
  end
 
  specify'assert start page accessibility' do
    @sel.open("http://www.google.com/webhp")
    raakttest = Raakt::Test.new(@sel.get_html_source)
    result = raakttest.all
    result.should be([])
  end
 
  teardown do
    @sel.stop
  end
end
 
frameworks/selenium.txt · Last modified: 2007-03-30 22:33 by peterkz
Recent changes RSS feed, Powered by DokuWiki