Headless Selenium Screenshots with Cucumber 2
I was finally able to get Selenium integrated with Webrat and Cucumber on my Linux development server. I followed this excellent guide to setting up the selenium server to run headless. This enables me to run my tests without actually seeing the Firefox window. This does, unfortunately, make debugging a bit more difficult.
Because of that, I created a Cucumber step to save a screenshot of the webpage in the tmp/screenshots folder. This includes the entire page, not just the viewable portion. Not only does this simplify debugging, but it also makes it trivially difficult to capture a large number of screenshots from the testing framework to compile visual reports. I believe that making sure everything looks right is as much a part of testing as making sure it actually works.
Then /^I save a screenshot with filename "([^\"]*)"$/ do |filename|
selenium.capture_entire_page_screenshot(File.expand_path("tmp/screenshots/#{filename}.png"), "")
end
Trackbacks
Use the following link to trackback from your own site:
http://littlebitofcode.com/trackbacks?article_id=18
How long have you been in this field? You seem to know a lot more than I do, I’d love to know your sources!
that guide has a nice idea, but is it really worth trying to run headless? At least for me, debugging ability is numero uno.