The solution from Andreas Ebbert-Karroum or Codecentric is cutom tailored
for IBM Rational Functional Tester. It seems to modify the JBehave story
reporter so that log4j loggings are added to the HTML test result. There is
a method which is used to create a screenshot and save it somewhere. In
this method it is logged that a screenshot was created and a link with a
small preview image is written as HTML text like: LOG.info("Screenshot
saved into file " + outFile + " : " + "<a href='" + relpath + "'><img
height='100px' width='100px' src='" + relpath + "'/></a>");

But that solution does not work if you use jbehave-web with Selenium
underneath like me. There is this callback method:
org.jbehave.web.selenium.WebDriverScreenshotOnFailure.afterScenarioFailure(UUIDExceptionWrapper)

In it a screenshot is created  by calling:
org.jbehave.web.selenium.WebDriverProvider.saveScreenshotTo(String)

System-out-printlines are used like: System.out.println("Screenshot of page
'" + currentUrl + "' has been saved to '" + screenshotPath +"' with " + new
File(screenshotPath).length() + " bytes");

But in WebDriverScreenshotOnFailure.afterScenarioFailure(...) the
StoryReporter is not used to print that a screenshot was created. I don't
know how to get to the story reporter since I need to provide a story path.
But in the method WebDriverScreenshotOnFailure.afterScenarioFailure(...) it
is unknown which story is currently running. My knowledget of the JBehave
design is too small currently to find a way.

The solution must be easy. The difficult part is only how to know which
story is currently running when
WebDriverScreenshotOnFailure.afterScenarioFailure(...) was called from the
StoryRunner.

Maybe you know a way how that could be achieved in order to integrate
screenshots in the HTML test result ... as a JBehave user?


Am 15. Oktober 2013 17:40 schrieb Mauro Talevi <[email protected]>:

>  Hi Andreas,
>
> if you have a solution you'd like to share we'd be happy to consider it
> and make it available to the wider community.
>
> Cheers
>
>
> On 15/10/2013 12:59, Andreas Ebbert-Karroum wrote:
>
>  Hans,
>
>  I assume that you are working in that compandy, where codecentric helped
> to introduced JBehave. Please consult with the people there, they can show
> you how we implemented that.
>
>  Andreas
>
>
> 2013/10/15 Hans Schwäbli <[email protected]>
>
>>  On failure screenshots are made by JBehave. I have configured it so
>> that this is done.
>>
>> They appear in the target folder.
>>
>> But if I open the HTML report, they are not included in the HTML page. Is
>> it possible to include it on the report pages?
>>
>
>
>
>  --
> Mit freundlichen Grüßen / Best regards
>
> Andreas Ebbert-Karroum | Agile Principal Consultant
>
> codecentric AG | Merscheider Straße 1 | 42699 Solingen | Deutschland
> tel: +49 (0) 212.23362825 | fax: +49 (0) 212.23362879 | mobil: +49 (0)
> 175.2664109
> www.codecentric.de | blog.codecentric.de | www.meettheexperts.de |
> www.more4fi.de
>
> Sitz der Gesellschaft: Düsseldorf | HRB 63043
> Vorstand: Klaus Jäger (Vorsitzender) . Michael Hochgürtel . Mirko
> Novakovic . Rainer Vehns
> Aufsichtsrat: Patric Fedlmeier (Vorsitzender) . Bernd Klinkmann . Jürgen
> Schütz
>
> Diese E-Mail einschließlich evtl. beigefügter Dateien enthält vertrauliche
> und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige
> Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie
> bitte sofort den Absender und löschen Sie diese E-Mail und evtl.
> beigefügter Dateien umgehend. Das unerlaubte Kopieren, Nutzen oder Öffnen
> evtl. beigefügter Dateien sowie die unbefugte Weitergabe dieser E-Mail ist
> nicht gestattet.
>
>
>

Reply via email to