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

aslak hellesoy aslak.hellesoy at gmail.com
Tue May 19 19:04:07 EDT 2009


> Any further thoughts on this, Aslak? I'd prefer to go with a solution in
> line with the future direction of Cucumber if possible.
>

Sorry, forgot to get back to you Luke.

I'm convinced. We'll add an AfterStep hook. Do you want to give a stab
at a patch? Start by writing a feature - see
features/after_block_exceptions.feature for a good example of the
style we like...

Aslak

> Cheers,
> Luke
>
> On May 15, 2009, at 5:12 PM, Luke Melia wrote:
>
>> On May 15, 2009, at 3:36 PM, aslak hellesoy wrote:
>>
>>> Thanks for doing that. I have one more favour to ask: Can you show me
>>> an example of a StepDefinition that would cause the file to be
>>> created?
>>
>> That is a tougher question, because any browser interaction that causes an
>> HTTP request to the app under test could result in a server error.
>>
>> Ajax requests can be triggered by javascript, and in various parts of our
>> app, they are triggered by clicking on links, submitting forms, dragging and
>> dropping divs, hovering over a div, waiting for a page load to complete, as
>> a callback from interacting with a 3rd party web service, or waiting for a
>> setTimeout to execute.
>>
>> So one way I could tackle it is to add a step to the end of every scenario
>> that says "Then the application should not have issued any responses with
>> 50x status codes", but that would be a) repetitive, and b) not fail until
>> all steps had run, making it harder to track down the step in the test where
>> the failure occurred.
>>
>> One way to look at may be that I'm trying to enforce an invariant. Under
>> no circumstances in my test suite is it appropriate for my app to raise a
>> 50x error. In my Rails integration suite, webrat enforces this particular
>> invariant for me, but can't find a good hook in the selenium test stack to
>> do this, which is why I'm looking at this route.
>>
>> 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
>
> --
> 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