[rspec-users] [Cucumber] Fail a scenario from After or AfterStep

aslak hellesoy aslak.hellesoy at gmail.com
Fri May 15 10:16:58 EDT 2009


> On May 15, 2009, at 4:25 AM, aslak hellesoy wrote:
>
>> To be honest, I don't remember what happened to AfterStep. I think we
>> had it at some point, but can't see it in the codebase. Did I remove
>> it? Or was that back in the pre-Cucumber days? Help me remember
>> here...
>
> I'm not sure. I saw a reference for it on the wiki:
> [http://wiki.github.com/aslakhellesoy/cucumber/hooks] and it seemed to fit
> this problem, but it's not in the version of cucumber we're running. I
> thought perhaps it was in trunk but it sounds like that's not the case.
>
>> I'm not so sure I like the idea of AfterStep - smells like a
>> workaround for something that belongs elsewhere. Can't your have
>> selenium-rc (or a helper method you create around it) raise those
>> exceptions?
>>
>> Given /bla/ do
>>  # don't remember the API, but you get the idea
>>  @browser.goto_strict('/bla') # raises on 500 errors
>> end
>
> Yes, I'd prefer to be able to configure selenium-rc to fail on 500s. The
> problem I ran into is that selenium client doesn't appear to be able to
> access the HTTP response code. In addition, ajax-y HTTP requests can get
> kicked off in our app by lots of different things (a click here, a mouseover
> there, etc).
>
> In our suite today, of step matchers will usually fail if a 500 is raised,
> due to the user-facing impact (e.g. a div is not updated or a form does not
> appear), but it usually takes us a few minutes to realize that there was a
> 500 error raised (vs. incorrect javascript, etc.). I am hoping to
> short-circuit that investigation time and also catch the cases where a 500
> is triggered and we don't have a step matcher that fails.
>

Can you show me the code you would want to put in AfterStep that would
detect a 500 error?

Aslak

> The approach is a little smelly to me because it adds a little translucency
> to what is mostly black-box-testing, but I think it would be a net positive,
> at least for our app.
>
> Cheers,
> Luke
> --
> Luke Melia
> luke at lukemelia.com
> http://www.lukemelia.com/
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list