[rspec-devel] Feedback on spec_ui and screenshots

aslak hellesoy aslak.hellesoy at gmail.com
Wed Jun 20 03:13:52 EDT 2007

On 6/20/07, Bob Cotton <bob.cotton at rallydev.com> wrote:
> Having just implemented a screenshot capability into Selenium RC
> (which, BTW is cross platform and uses Java's Robot class), I have
> some feedback on the implementation in spec_ui
> Because the selenium server is doing the screenshot, then encoding the
> data and returning it over the wire to the test driver, taking a
> screenshot for after(:each) seems run a bit slow.

I agree. The encoding feature is experimental, and I think I'll turn
it off by default, with an option to turn it on.

> It would be nice if it only took screenshots when there was a
> failure. Unfortunately there are no hooks to configure formatters
> other than the command line, or are there?

We don't have any other hooks than the standard options on the
commandline. I realise there is a need for more fine grained options.
Do you have any suggestions about how to implement it without coupling
RSpec to Spec::Ui?

> Also, we tend to run both GUI specs and non-gui specs in the same run,
> so hooking up the screenshot in Spec::Runner.configure is cumbersome.
> Sort of a variant on not being able to configure the reporter.

You should be able to use:

config.after(:each, :behaviour_type => 'selenium') {}


describe "Rally rocks", :behaviour_type => 'selenium' {}

to filter it out. I haven't tried this particular case, but it
*should* work. Holler if it doesn't.

> I could always subclass the Screenshot formatter. Is there a better
> way?

Not for now, but I'm looking for one.

>  -Bob
> _______________________________________________
> rspec-devel mailing list
> rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel

More information about the rspec-devel mailing list