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

Ben Mabey ben at benmabey.com
Tue May 19 23:16:22 EDT 2009


Ben Mabey wrote:
> Luke Melia wrote:
>> Any further thoughts on this, Aslak? I'd prefer to go with a solution 
>> in line with the future direction of Cucumber if possible.
>>
>> Cheers,
>> Luke
>
> Have you seen what Matt added recently?
>
> https://rspec.lighthouseapp.com/projects/16211/tickets/330-gracefully-handle-exceptions-in-after-block#ticket-330-11 
>
>
> I think this should cover your use case... WDYT?
>
> -Ben
>

Never mind, I just reread the thread...  :)
>>
>> 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
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users



More information about the rspec-users mailing list