Thanks for your quick feedback ?

Where should I do that ? inside the spring configuration file ?
Can it also be done outside of spring config XML file ? and How should that 
look like ?


In some way the tests are running again, but I still get an error when a 
screenshot is made. driver = null

<bean id="screenshot" class="org.spilgames.ScreenshootingHtmlFormat">
    <constructor-arg ref="provider" />
  </bean>
  <bean
    class="org.jbehave.core.configuration.spring.SpringStoryReporterBuilder"
    init-method="withDefaultFormats">
    <property name="formats">
      <list>
        <ref bean="screenshot"/>
        <value>CONSOLE</value>
        <value>TXT</value>
        <value>XML</value>
      </list>
    </property>
  </bean>

This will let the test run, but gives me the driver = null error;



________________________________
Van: louis gueye [[email protected]]
Verzonden: dinsdag 19 februari 2013 14:12
Aan: [email protected]
Onderwerp: Re: [jbehave-user] Configure Custom reporter by Spring config XML 
file

Hi Roy,

Spring supports implicit conversion from string to Enum.
Other formats are Enum.
I guess you won't be able to inject non Enum value unless your init-method (i.e 
withDefaultFormats) supports it.
I would pass a list of String as parameter to withDefaultFormat method and then 
convert each string into the right formatter instance then store it.


--
Cordialement/Regards,

Louis GUEYE
linkedin<http://fr.linkedin.com/in/louisgueye> | 
blog<http://deepintojee.wordpress.com/> | 
twitter<http://twitter.com/#%21/lgueye>



2013/2/19 Roy de Kleijn 
<[email protected]<mailto:[email protected]>>
Hello,

I have the following question.

I implemented a custom reporter format 
(http://jaroslav-sedlacek.blogspot.nl/2011/05/screenshots-in-jbehave-reports.html)
 which creates a screenshot on failure and add a link to the reports. Which 
works fine when using a single thread.

This is how I configured it in a class which extends from JUnitStories:

    StoryReporterBuilder reporter = new StoryReporterBuilder();
    reporter.withCodeLocation(
        CodeLocations
            .codeLocationFromClass(embeddableClass))
        .withFormats(new ScreenshootingHtmlFormat(driverProvider), XML, 
CONSOLE, TXT);

This doesn't work when using multiple threads. Which seems to be logical since 
the driverProvider is null.

So I added this custom reporter to the spring configuration xml file. This is 
actually the place where I distribute the driverProvider. I see that the 
screenshots are being made (file are stored in a folder). However the HTML 
reports are not generated properly.

So I tried to move the StoryReporterBuilder to the spring configuration file is 
well: so it looks like this:

  <bean id="screenshot" class="org.spilgames.ScreenshootingHtmlFormat">
    <constructor-arg ref="provider" />
  </bean>

  <bean
    class="org.jbehave.core.configuration.spring.SpringStoryReporterBuilder"
    init-method="withDefaultFormats">
    <property name="formats">
      <list>
        <value>CONSOLE</value>
        <value>TXT</value>
        <value>screenshot</value>
        <value>XML</value>
      </list>
    </property>
  </bean>

However this doesn't work for customformats. Is there a workaround? or is there 
another to do this ? How can I define the custom format in the Spring 
Configuration XML file?

The first bean in the above example is working (screenshots are being made)
The second bean needs some modification, because it gets stuck at the third 
parameter.


Any help is appreciated!

Thanks,
Roy








Reply via email to