The latest release of Selenium Fury is ready for your install. Checkout the new cucumber features at the project home https://github.com/scottcsims/SeleniumFury. This version includes extended page element recognition, custom generators, and the git hub project includes support for bundler and rvm.

I have been working on converting our page object factory to open source for a few weeks. Now it is time to launch the HomeAway sponsored open source project under the Apache 2.0 license. It is a furiously quick way to implement test automation. I am planning to add more configuration options in the future.

This project started when I had to test a page with 300+ check boxes and I did not want to enter them by hand. I used the page object generator to build a page of ruby variables with Selenium locators. Everything was great until some number of the check boxes changed their ids and my tests started failing. I needed a quick way to find out how many changed so I could update the locators by hand or regenerate the page. This is where the validators came in. I used Ruby’s support of reflection to open a class, navigate to the url of the page and use Selenium to validate the locators and return a list of missing locators on the page. It worked perfectly for my page of 300+ check boxes. I had over 40 that changed I quickly regenerated the page.

Deep test allows you to run ruby rspec tests in parallel by providing a spec task that you include in your rake file. The 2.0 prerelease version of deep tests offers support for rspec 1.1.12. You can install it buy running: gem install deep_test_pre. Require it in your rake file like this:

gem “deep_test_pre”, “=2.0”

require “deep_test”

gem “deep_test_pre”, “=2.0”
require “deep_test”

There currently is a bug that occurs if you run Test::Unit tests with the deep test spec runner. The tests will all run twice but are reported once.

I tried to run tests in parallel against IE using the selenium grid for a few days before I found this important message on the selenium grid FAQ.

If you try to run multiple selenium remote controls for IE on one machine it will work for a while. Your test will execute without any problems, but then you start getting sporadic error messages from IE. I assumed that the xpath expressions I was using for the tests in Firefox were throwing errors in IE. I tried different configurations for security settings in IE for a while and then I finally found out that it was a memory sharing issue that prevents the selenium remote from launching more than one IE instance. For now I am just requesting more VMs to run a single IE remote on each. I use ruby with deep test to run test in parallel on the grid. I configure deep test to run 6 tests at a time, so I would only need 6 VMs for IE to run.

It puzzling to me that Watin tests run in parallel against IE without any problems on the same machine, but selenium tests cannot. For now I will add more VMs and wait for Selenium Grid 1.2 to fix the IE problem.

I recently found out why my automated tests run in parallel from my workstation, but then run in sequence from a team city build agent. It all comes down to the rake runner in team city. Team city uses a customized rake runner that extends rspec’s spec task. You get all of the per test reporting, graphing and historical information from team city’s customized rspec reporting. All this is great if you don’t mind running your tests in sequence, but If your using team city to launch automated web test using the selenium grid this is bad news.

I use a rake file to control the execution of my ruby selenium scripts. I modeled it from the ruby example in the selenium grid distribution. What is important to know about the run in parallel rake task is that it is not your normal rake task. It is first a rspec spec task. This is a test runner from rspec that allows you to use a rake task to run specs. Not only is it a spec task, it also has been overridden by deep test, the software package that adds parallelization. Since the spec task is actually deep test’s spec task and not the rspec spec task there are dependencies on what version of rspec deep tests needs. You must run with rspec 1.1.8 so that the spec task that deep test overrides will work correctly.

So what happens when you run your deep test spec task from team city with their rake runner? Deep test cannot launch your tests in parallel because Team City is using their customized spec task. The solution is to use the command line runner to launch your rake task for the selenium grid, then your spec task will have access to the correct rspec gem for deep test to use as a spec runner.

I have been running test/unit scripts on the grid for a while now and I was trying to remember where I got my test/unit syntax from. I was looking to create a live template to create new test scripts in Rubymine. You actually have to make sure that you create the Selenium Driver object in a specific way or your scripts will not run on the Selenium Grid or they will not run in parallel correctly. Your test class must also always have a setup and tear down, even if you call a method out side of the class to setup the driver.

There are 2 sources of information that you must understand and monitor for updates. First is the Selenium Grid home page. Recently when Firefox 3.5 became available, I needed to update the version of the grid software I was using. The other site is the site for the selenium client gem. You can find documentation here on how to structure your spec and test/unit scripts so that they run on the grid. The gem and the grid are both maintained by the same person. I revisit the sites often to pick up tips on how to structure rake files and get tips for running scripts in parallel. In working with this software, I have become very familiar with the files in the rspec, deeptest, and selenium-client gems.

I started using custom Firefox profiles so that I could get around the self signed cert error in firefox. I found a way to easily maintain one configured profile that is used across all Selenium remote control environments running on OS X and multiple windows versions.

Download the selenium grid software. I am using selenium-grid-1.0.4

Create a new directory called SeleniumFireFoxProfile in your selenium-grid-1.0.4 directory.

Create a test script to open a selenium client driver and navigate to the site that is getting the ssl cert error. Use a debugger to pause the execution of your script at the browser.open command

Execute your script to the break point and accept the cert in your Firefox browser.

Look for the creation of the cert_override.txt file in your user directory. With Firefox 3.0 I found it on my mac in /private/var/folders. I cd to the contained directory and run a find command to locate it sudo find . -name cert_override.txt.With Firefox 3.5 the profile is stored in the user directory ~/Library/Application Support/Firefox/Profiles.

You should see an entry in your cert_override.txt file after you accept the certificate. Now copy the cert_override.txt from your user directory to your SeleniumFireFoxProfile directory in your selenium grid directory.

Restart your remote control now using the profile with the cert_override.txt file in it. Rerun your test and break on the open command now you should see your page render instead of the security warning.

Just a warning about the cert_override.txt file. It is very white space sensitive, it is better to copy the whole file into your custom profile directory rather then copying a new line into an existing file.

I check in the override text file along with my selenium software. This way I can add a cert on my local machine and then run a SVN update on the distributed grid hosts to get the new cert information. This works for both windows and OS X.