JBehave
  1. JBehave
  2. JBEHAVE-491

Add JBehave Spring Namespace support for easier configuration

    Details

    • Type: New Feature New Feature
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 3.x
    • Component/s: Spring Support
    • Labels:
      None
    • Patch Submitted:
      Yes
    • Number of attachments :
      0

      Description

      I have implemented an initial version, it is a clone of master branch of jbehave project. My implementation is on git@github.com:maggandalf/jbehave-core.git

      Configuring Embedder for working with Spring shall be:

      <jbehave:embedder id="embedder">

      <jbehave:classpathLoader>target/classes</jbehave:classpathLoader>

      <jbehave:output>TXT</jbehave:output>

      <jbehave:output>HTML</jbehave:output>

      <jbehave:output>CONSOLE</jbehave:output>

      </jbehave:embedder>

        Activity

        Mauro Talevi made changes -
        Field Original Value New Value
        Assignee Mauro Talevi [ maurotalevi ]
        Fix Version/s 3.4 [ 17278 ]
        Mauro Talevi made changes -
        Summary Implements JBehave Spring Namespace for easier integration between JBehave and Spring Add JBehave Spring Namespace support for easier configuration
        Mauro Talevi made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        Mauro Talevi added a comment -

        Hi Alex, thanks for the very good contribution. I've pulled it in master.

        A couple of comments:

        • wouldn't the schema be more appropriately called "jbehave" rather than "embedder"
        • ditto when the registering of the bean definition parser

        What is not quite clear is your goal, i.e. you want to provide a namespaced version of the normal spring configuration or to just allow the construction of the embedder.

        It's be very useful if you could also provide a unit-level behaviour that clarified your intent. You could start from SpringAnnotationBuilderBehaviour as a based for you SpringNamespaceConfigurationBehaviour.

        Show
        Mauro Talevi added a comment - Hi Alex, thanks for the very good contribution. I've pulled it in master. A couple of comments: wouldn't the schema be more appropriately called "jbehave" rather than "embedder" ditto when the registering of the bean definition parser What is not quite clear is your goal, i.e. you want to provide a namespaced version of the normal spring configuration or to just allow the construction of the embedder. It's be very useful if you could also provide a unit-level behaviour that clarified your intent. You could start from SpringAnnotationBuilderBehaviour as a based for you SpringNamespaceConfigurationBehaviour.
        Hide
        Alex Soto Bueno added a comment -

        Yes I agree with you jbehave would be better than embedder in schema name. About registering bean definition <jbehave:embedder id="embedder"> maybe embedder is better because we are registering an embedder for running JBehave with Spring.

        For now my first goal is allow the construction of the EmbedderClassLoader using namespaces so less configuration is required, and for final users will be easier. But of course my idea is continue improving this integration.

        For now I only want that user instead of writing:

        <bean class="org.jbehave.core.io.LoadFromClasspath">

        <constructor-arg>

        <bean class="org.jbehave.core.embedder.EmbedderClassLoader">

        <constructor-arg>

        <list>

        <value>target/classes</value>

        </list>

        </constructor-arg>

        </bean>

        </constructor-arg>

        </bean>

        <bean class="org.jbehave.core.parsers.RegexPrefixCapturingPatternParser">

        <constructor-arg value="$" />

        </bean>

        <bean class="org.jbehave.core.configuration.spring.SpringStoryControls">

        <property name="dryRun" value="false" />

        <property name="skipScenariosAfterFailure" value="false" />

        </bean>

        <bean

        class="org.jbehave.core.configuration.spring.SpringStoryReporterBuilder"

        init-method="withDefaultFormats">

        <property name="formats">

        <list>

        <value>CONSOLE</value>

        <value>TXT</value>

        <value>HTML</value>

        <value>XML</value>

        </list>

        </property>

        </bean>

        could write

        <jbehave:embedder id="embedder">

        <jbehave:classpathLoader>target/classes</jbehave:classpathLoader>

        <jbehave:output>TXT</jbehave:output>

        <jbehave:output>HTML</jbehave:output>

        <jbehave:output>CONSOLE</jbehave:output>

        </jbehave:embedder>

        but as I have explained my idea is adding more features, I am open to ideas of course.

        About "It's be very useful if you could also provide a unit-level behaviour that clarified your intent. You could start from SpringAnnotationBuilderBehaviour as a based for you SpringNamespaceConfigurationBehaviour." sorry but I don't understand exactly what you mean.

        Show
        Alex Soto Bueno added a comment - Yes I agree with you jbehave would be better than embedder in schema name. About registering bean definition <jbehave:embedder id="embedder"> maybe embedder is better because we are registering an embedder for running JBehave with Spring. For now my first goal is allow the construction of the EmbedderClassLoader using namespaces so less configuration is required, and for final users will be easier. But of course my idea is continue improving this integration. For now I only want that user instead of writing: <bean class="org.jbehave.core.io.LoadFromClasspath"> <constructor-arg> <bean class="org.jbehave.core.embedder.EmbedderClassLoader"> <constructor-arg> <list> <value>target/classes</value> </list> </constructor-arg> </bean> </constructor-arg> </bean> <bean class="org.jbehave.core.parsers.RegexPrefixCapturingPatternParser"> <constructor-arg value="$" /> </bean> <bean class="org.jbehave.core.configuration.spring.SpringStoryControls"> <property name="dryRun" value="false" /> <property name="skipScenariosAfterFailure" value="false" /> </bean> <bean class="org.jbehave.core.configuration.spring.SpringStoryReporterBuilder" init-method="withDefaultFormats"> <property name="formats"> <list> <value>CONSOLE</value> <value>TXT</value> <value>HTML</value> <value>XML</value> </list> </property> </bean> could write <jbehave:embedder id="embedder"> <jbehave:classpathLoader>target/classes</jbehave:classpathLoader> <jbehave:output>TXT</jbehave:output> <jbehave:output>HTML</jbehave:output> <jbehave:output>CONSOLE</jbehave:output> </jbehave:embedder> but as I have explained my idea is adding more features, I am open to ideas of course. About "It's be very useful if you could also provide a unit-level behaviour that clarified your intent. You could start from SpringAnnotationBuilderBehaviour as a based for you SpringNamespaceConfigurationBehaviour." sorry but I don't understand exactly what you mean.
        Hide
        Mauro Talevi added a comment -

        Yes, I agree, but that is not what I meant. I've pushed some minor renames. The schema is now called jbehave-spring-1.0.xsd and lives in url http://jbehave.org/schemas/spring. Within the same schema we can define multiple elements, Embedder being one of them.

        And if you could add a unit test that tests all this it would help to test the schema in isolation and communicate better the intend of what you've developed.

        Show
        Mauro Talevi added a comment - Yes, I agree, but that is not what I meant. I've pushed some minor renames. The schema is now called jbehave-spring-1.0.xsd and lives in url http://jbehave.org/schemas/spring . Within the same schema we can define multiple elements, Embedder being one of them. And if you could add a unit test that tests all this it would help to test the schema in isolation and communicate better the intend of what you've developed.
        Hide
        Mauro Talevi added a comment -

        I've made a start on unit test with NamespaceHandlerBehaviour.

        The syntax above seems to suggest that an Embedder instance is created, not just a LoadFromClasspath loader.

        IMO, we should have all configuration beans supported by the schema, else it'd be confusing.

        Show
        Mauro Talevi added a comment - I've made a start on unit test with NamespaceHandlerBehaviour. The syntax above seems to suggest that an Embedder instance is created, not just a LoadFromClasspath loader. IMO, we should have all configuration beans supported by the schema, else it'd be confusing.
        Mauro Talevi made changes -
        Fix Version/s 3.x [ 16979 ]
        Fix Version/s 3.4 [ 17278 ]
        Affects Version/s 3.x [ 16979 ]
        Hide
        Mauro Talevi added a comment -

        Moved to jbehave-spring-namespace branch until ready for release.

        Show
        Mauro Talevi added a comment - Moved to jbehave-spring-namespace branch until ready for release.
        Mauro Talevi made changes -
        Status In Progress [ 3 ] Open [ 1 ]

          People

          • Assignee:
            Mauro Talevi
            Reporter:
            Alex Soto Bueno
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: