*I would also be interested in knowing how to get information about the
scenario/step.
*
On Tue, Aug 24, 2010 at 3:20 PM, Cristiano Gavião <[email protected]>wrote:

> Mauro,
>
> Is there a way to get the failure scenario name inside the method annotated
> by @AfterScenario(uponOutcome=FAILURE) ?
>
> cheers
>
> Mauro Talevi escreveu:
>
>   Hi,
>>
>> you can use @AfterScenario(uponOutcome=FAILURE) to annotate amethod that
>> are only executed if a scenario fails.
>> In this method, you can invoke Selenium's capture methods.
>>
>> Cheers
>>
>> On 24/08/2010 12:07, Pranav Singh wrote:
>>
>>
>>> Hi,
>>>
>>> I'm using JBehave 2.x with selenium (web version). I am trying to add
>>> a means to take a screenshot of the browser when the test throws an
>>> exception. Selenium provides methods to capture the screen;
>>> captureEntireScreen and captureScreenshot.
>>>
>>> The problem I am facing is that I cannot integrate this feature, in a
>>> generalized manner, when an exception or error occurs. Either I am
>>> implementing them incorrectly or I am using the wrong approach. Is
>>> there a proper way on achieving this? Feedback would be appreciated.
>>>
>>> Here are the following methods I tried:
>>>
>>> 1)
>>> https://dev.youdevise.com/YDBlog/index.php?title=capture_screenshots_of_selenium_browser_&more=1&c=1&tb=1&pb=1
>>> <
>>> https://dev.youdevise.com/YDBlog/index.php?title=capture_screenshots_of_selenium_browser_&more=1&c=1&tb=1&pb=1>
>>> By
>>> creating a custom JUnit runner and a new annotation. The idea is
>>> override junit class runner methods and call the methods with the
>>> annotation when an error occurs. Since the steps are in other class,
>>> then it doesn't recognize and find those methods.
>>>
>>> 2)
>>> http://blog.xebia.com/2010/03/30/making-screenshots-from-selenium-with-junit-rules/using
>>> @Rules to capture exceptions, but it needs to be applied to a field,
>>> which is defined in JBehave.
>>>
>>> 3)
>>> http://api.dpml.net/junit/4.2/org/junit/runner/notification/RunListener.htmlOverride
>>> the method when a test fails. This needs to be run through JUnitCore.
>>>
>>> Thanks, Pran.
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>
>

Reply via email to