SeleniumSpecr
This is a library/plugin that aims to ease the creation and maintenance of Selenium functional tests.
SeleniumSpecr operates in one of two modes: as a Rails plug-in, or as a stand-alone project to test any running web application.
Using SeleniumSpecr Stand-Alone
Generate your test project using the ‘specr’ application generator:
specr my_test_project
This will create a new project directory called ‘my_test_project’. Start creating selenium specs by using the included spec generator:
cd my_test_project
script/generate selenium_spec open_page
Run your specs using the included rake task:
rake test:selenium
Configuration
Your test project will include a YAML configuration file that tells SeleniumSpecr where to find your web application. You can find it in ‘config/selenium.yml’.
If you provide ‘start’ and ‘stop’ configurations, SeleniumSpecr will start and stop your application server for you by executing the provided commands in a shell. For example, the following configuration snippet will instruct SeleniumSpecr to start and stop a mongrel rails server before and after each test run:
app_server:
url: http://localhost:3800
start: mongrel_rails start -d -p 3800 -P log/mongrel.pid
stop: mongrel_rails stop -P log/mongrel.pid && rm -f log/mongrel.pid
# Note: P Gross has requested this be converted from YAML to just a Ruby file. Sounds like a plan.
Using SeleniumSpecr as a Rails plug-in
Installation
You can SeleniumSpecr as a git submodule (if you’re using git for your Rails project) like this:
git submodule add git://github.com/tobytripp/selenium-specr.git vendor/plugins/selenium_specr
or, if you’re using Rails 2.0.2 or later, you can use script/plugin to install it from github:
./script/plugin install git://github.com/tobytripp/selenium-specr.git
TODO
-
Make Selenium tests easier to run by bundling a set of Rake tasks that manage starting the selenium RC server, starting the application server, running all the specs, and then shutting the whole thing down when it’s finished.
-
Make Selenium tests easier to write by including a set of action macros and spec generators.
-
Make Selenium tests easier to maintain by making it easier to push specs down into unit or integration tests.