Have a look at the trader runner stories: http://git.codehaus.org/gitweb.cgi?p=jbehave-web.git;a=tree;f=examples/trader-runner-stories
In particular, the TraderWebStories http://git.codehaus.org/gitweb.cgi?p=jbehave-web.git;a=blob;f=examples/trader-runner-stories/src/main/java/org/jbehave/web/examples/trader/TraderWebStories.java where we use the SeleniumStepMonitor to interact with the SeleniumContext to display the current scenario and the current step in the Selenium RC browser. This example also has a FailingScenarioScreenshotCapture steps configured. On 25/08/2010 16:52, Pranav Singh wrote: > Then, is there a way to interact with the reporter and get information > about the failing step so I can get a snapshot of the screen. From my > understanding the reported only generates the report at the end of > calling and running all the steps. > > On Wed, Aug 25, 2010 at 2:40 PM, Mauro Talevi > <[email protected] <mailto:[email protected]>> wrote: > > This is currently not possible because the methods annotated with > @Before/After do not take any parameters. > > It wouldn't be complicated to pass in the scenario model object > that failed, but we need to ask ourselves it > this does not duplicate the functionality of the story reporter. > In other words, what is the real scope of having the > scenario object pass to the method? > > > On 25/08/2010 10:23, Pranav Singh wrote: >> /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] <mailto:[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> >> >> <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.html >> Override >> 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 >> >> >> > >
