JBehave
  1. JBehave
  2. JBEHAVE-802

Some template-generated reports are invalid.

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.6.8
    • Fix Version/s: 3.6.9, 3.7
    • Component/s: Core
    • Labels:
      None
    • Number of attachments :
      2

      Description

      This bug appered when we started to use scenario level GivenStories keyword in our stories.

      Scenario: ...
      GivenStories: ...
      Given ...

      We use Hudson as CI with jenkins plugin for present reports. Probably, jbehave generates invalid xml, so exception occured(see StackTrace.txt in attachments) on post-build action "Publish testing tools result report".
      I investigated generated xml and found some weird things:
      1)missing "=" between attribute's name and value

      <givenStories keyword"GivenStories:">
      

      2)strange string like

      <givenStory >stories/Story_name.story/>
      

      3)escaping missed

      <failure>junit.framework.AssertionFailedError: expected <10> but was <1>
      

      instead

      <failure>junit.framework.AssertionFailedError: expected &lt;10&gt; but was &lt;1&gt;
      

      4)in two similar stories we have different xml
      first:

      <givenStories keyword"GivenStories:">
      <givenStory >stories/Story_name.story/>
      </givenStories>
      

      second:

      <scenario keyword="Scenario:" title="scenario title">   
      <step outcome="successful">
      Given given step {0} 
      </step>
      
      1. PseudoStory.txt
        1 kB
        Eugeny Batov
      2. StackTrace.txt
        3 kB
        Eugeny Batov

        Activity

        Hide
        Alexander Lehmann added a comment -

        the wiki syntax for jira breaks most source code type text, could you please add the description once more enclosed in

        {noformat}

        tags?

        (unless you did that already and the output is correct as it is displayed)

        Show
        Alexander Lehmann added a comment - the wiki syntax for jira breaks most source code type text, could you please add the description once more enclosed in {noformat} tags? (unless you did that already and the output is correct as it is displayed)
        Hide
        Alexander Lehmann added a comment -

        One other question: does this appear in the xml created by jbehave itself or by the jbehave-hudson plugin?

        Show
        Alexander Lehmann added a comment - One other question: does this appear in the xml created by jbehave itself or by the jbehave-hudson plugin?
        Hide
        Mauro Talevi added a comment -

        Can you please provide an example of the story that reproduces this behaviour?

        Show
        Mauro Talevi added a comment - Can you please provide an example of the story that reproduces this behaviour?
        Hide
        Eugeny Batov added a comment - - edited

        How can i edit description? There is no Edit link.

        Xml created by jbehave. It is place in target\jbehave*.xml

        Show
        Eugeny Batov added a comment - - edited How can i edit description? There is no Edit link. Xml created by jbehave. It is place in target\jbehave*.xml
        Hide
        Alexander Lehmann added a comment - - edited

        this jira doesn't allow the reporting user to edit the description, only the project owner can do that

        you have to add a comment, afaik (you can edit your comments, however)

        Show
        Alexander Lehmann added a comment - - edited this jira doesn't allow the reporting user to edit the description, only the project owner can do that you have to add a comment, afaik (you can edit your comments, however)
        Mauro Talevi made changes -
        Field Original Value New Value
        Description This bug appered when we started to use scenario level GivenStories keyword in our stories.

        Scenario: ...
        GivenStories: ...
        Given ...

        We use Hudson as CI with jenkins plugin for present reports. Probably, jbehave generates invalid xml, so exception occured(see StackTrace.txt in attachments) on post-build action "Publish testing tools result report".
        I investigated generated xml and found some weird things:
        1)missing "=" betwean attribute's name and value
        <givenStories keyword"GivenStories:">

        2)strange string like
        <givenStory >stories/Story_name.story/>

        3)escaping missed
        <failure>junit.framework.AssertionFailedError: expected <10> but was <1>
        instead
        <failure>junit.framework.AssertionFailedError: expected &lt;10&gt; but was &lt;1&gt;

        4)in two similar stories we have different xml
        first:
        <givenStories keyword"GivenStories:">
        <givenStory >stories/Story_name.story/>
        </givenStories>

        second:
        <scenario keyword="Scenario:" title="scenario title">
        <step outcome="successful">
        Given given step {0}
        </step>

         
        This bug appered when we started to use scenario level GivenStories keyword in our stories.

        Scenario: ...
        GivenStories: ...
        Given ...

        We use Hudson as CI with jenkins plugin for present reports. Probably, jbehave generates invalid xml, so exception occured(see StackTrace.txt in attachments) on post-build action "Publish testing tools result report".
        I investigated generated xml and found some weird things:
        1)missing "=" between attribute's name and value
        {xml}
        <givenStories keyword"GivenStories:">
        {xml}

        2)strange string like
        {xml}
        <givenStory >stories/Story_name.story/>
        {xml}

        3)escaping missed
        {xml}
        <failure>junit.framework.AssertionFailedError: expected <10> but was <1>
        {xml}
        instead
        {xml}
        <failure>junit.framework.AssertionFailedError: expected &lt;10&gt; but was &lt;1&gt;
        {xml}

        4)in two similar stories we have different xml
        first:
        {xml}
        <givenStories keyword"GivenStories:">
        <givenStory >stories/Story_name.story/>
        </givenStories>
        {xml}

        second:
        {xml}
        <scenario keyword="Scenario:" title="scenario title">
        <step outcome="successful">
        Given given step {0}
        </step>
        {xml}

         
        Mauro Talevi made changes -
        Description This bug appered when we started to use scenario level GivenStories keyword in our stories.

        Scenario: ...
        GivenStories: ...
        Given ...

        We use Hudson as CI with jenkins plugin for present reports. Probably, jbehave generates invalid xml, so exception occured(see StackTrace.txt in attachments) on post-build action "Publish testing tools result report".
        I investigated generated xml and found some weird things:
        1)missing "=" between attribute's name and value
        {xml}
        <givenStories keyword"GivenStories:">
        {xml}

        2)strange string like
        {xml}
        <givenStory >stories/Story_name.story/>
        {xml}

        3)escaping missed
        {xml}
        <failure>junit.framework.AssertionFailedError: expected <10> but was <1>
        {xml}
        instead
        {xml}
        <failure>junit.framework.AssertionFailedError: expected &lt;10&gt; but was &lt;1&gt;
        {xml}

        4)in two similar stories we have different xml
        first:
        {xml}
        <givenStories keyword"GivenStories:">
        <givenStory >stories/Story_name.story/>
        </givenStories>
        {xml}

        second:
        {xml}
        <scenario keyword="Scenario:" title="scenario title">
        <step outcome="successful">
        Given given step {0}
        </step>
        {xml}

         
        This bug appered when we started to use scenario level GivenStories keyword in our stories.

        Scenario: ...
        GivenStories: ...
        Given ...

        We use Hudson as CI with jenkins plugin for present reports. Probably, jbehave generates invalid xml, so exception occured(see StackTrace.txt in attachments) on post-build action "Publish testing tools result report".
        I investigated generated xml and found some weird things:
        1)missing "=" between attribute's name and value
        {code:xml}
        <givenStories keyword"GivenStories:">
        {code}

        2)strange string like
        {code:xml}
        <givenStory >stories/Story_name.story/>
        {code}

        3)escaping missed
        {code:xml}
        <failure>junit.framework.AssertionFailedError: expected <10> but was <1>
        {code}
        instead
        {code:xml}
        <failure>junit.framework.AssertionFailedError: expected &lt;10&gt; but was &lt;1&gt;
        {code}

        4)in two similar stories we have different xml
        first:
        {code:xml}
        <givenStories keyword"GivenStories:">
        <givenStory >stories/Story_name.story/>
        </givenStories>
        {code}

        second:
        {code:xml}
        <scenario keyword="Scenario:" title="scenario title">
        <step outcome="successful">
        Given given step {0}
        </step>
        {code}
         
        Hide
        Eugeny Batov added a comment - - edited

        Unfortunetly, i can't publish real story. I attached pseudo story(PseudoStory.txt) that fully repeated real story structure. Please, let me know if you need additional information.

        Show
        Eugeny Batov added a comment - - edited Unfortunetly, i can't publish real story. I attached pseudo story(PseudoStory.txt) that fully repeated real story structure. Please, let me know if you need additional information.
        Eugeny Batov made changes -
        Attachment PseudoStory.txt [ 60713 ]
        Hide
        Alexander Lehmann added a comment -

        the issue comes from a few format errors in the jbehave-xml-output.ftl freemarker template, i can take a look at it hopefully this evening.

        Show
        Alexander Lehmann added a comment - the issue comes from a few format errors in the jbehave-xml-output.ftl freemarker template, i can take a look at it hopefully this evening.
        Hide
        Alexander Lehmann added a comment -

        Can you please try to change your xml report from Format.XML_TEMPLATE to Format.XML?

        It seems like only the template-based reports are broken.

        Show
        Alexander Lehmann added a comment - Can you please try to change your xml report from Format.XML_TEMPLATE to Format.XML? It seems like only the template-based reports are broken.
        Hide
        Eugeny Batov added a comment -

        I changed Format.XML_Template to Format_XML. Xml is valid now.

        Show
        Eugeny Batov added a comment - I changed Format.XML_Template to Format_XML. Xml is valid now.
        Hide
        Alexander Lehmann added a comment -

        I looked into the template file yesterday. Didn't quite get it finished, but I can commit a fix maybe Friday.
        This is easy to fix but it should have a test to detect broken xml in the build process.

        Show
        Alexander Lehmann added a comment - I looked into the template file yesterday. Didn't quite get it finished, but I can commit a fix maybe Friday. This is easy to fix but it should have a test to detect broken xml in the build process.
        Hide
        Eugeny Batov added a comment -

        Please, look also in the jbehave-html-output.ftl freemarker template.
        It generates incorrect html for stories with GivenStories keyword even if xml is valid.
        Thank you in advance.

        Show
        Eugeny Batov added a comment - Please, look also in the jbehave-html-output.ftl freemarker template. It generates incorrect html for stories with GivenStories keyword even if xml is valid. Thank you in advance.
        Mauro Talevi made changes -
        Summary Invalid xml generated for reports. Some XML template-generated reports are invalid.
        Assignee Mauro Talevi [ maurotalevi ]
        Fix Version/s 3.6.9 [ 18650 ]
        Component/s Core [ 11086 ]
        Component/s Jenkins Support [ 15054 ]
        Mauro Talevi made changes -
        Summary Some XML template-generated reports are invalid. Some template-generated reports are invalid.
        Hide
        Mauro Talevi added a comment -

        Fixed the handling of GivenStories (issue only reproducible with XML, not HTML).
        Added escaping of all HTML and XML chars in user-defined values (including the failure messages).
        Updated unit test story to include two scenarios, one parameterised and one not.

        Publishing snapshot. Can you please verify against it that it works for your build?

        Show
        Mauro Talevi added a comment - Fixed the handling of GivenStories (issue only reproducible with XML, not HTML). Added escaping of all HTML and XML chars in user-defined values (including the failure messages). Updated unit test story to include two scenarios, one parameterised and one not. Publishing snapshot. Can you please verify against it that it works for your build?
        Mauro Talevi made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        Alexander Lehmann added a comment - - edited

        added a few more fixes/tests to the xml template

        https://github.com/alexlehm/jbehave-core/commit/73deb6b92daa752b355cf7c7b64e2f38f085906b

        I didn't change the expected file for the xml result yet, the test is failing for me (already before my changes) due to a different stracktrace in the test output, can you please change the expected file?

        Show
        Alexander Lehmann added a comment - - edited added a few more fixes/tests to the xml template https://github.com/alexlehm/jbehave-core/commit/73deb6b92daa752b355cf7c7b64e2f38f085906b I didn't change the expected file for the xml result yet, the test is failing for me (already before my changes) due to a different stracktrace in the test output, can you please change the expected file?
        Hide
        Alexander Lehmann added a comment -

        Eugeny: the only issue I cannot reproduce with the story is the example at the end with "Given given step

        {0}

        "

        Show
        Alexander Lehmann added a comment - Eugeny: the only issue I cannot reproduce with the story is the example at the end with "Given given step {0} "
        Hide
        Alexander Lehmann added a comment -

        fixed another bit in html template https://github.com/alexlehm/jbehave-core/commit/1e9970744c20e5fb951ab837c44e9a02a4d5d934
        excess backslashes in class attribute

        Show
        Alexander Lehmann added a comment - fixed another bit in html template https://github.com/alexlehm/jbehave-core/commit/1e9970744c20e5fb951ab837c44e9a02a4d5d934 excess backslashes in class attribute
        Hide
        Mauro Talevi added a comment -

        Applied the backslash fix but not the improvement of the unit test, as the merge failed (amongst other things the xmlunit dependency was not declared). Let's track that change via a different issue.

        Show
        Mauro Talevi added a comment - Applied the backslash fix but not the improvement of the unit test, as the merge failed (amongst other things the xmlunit dependency was not declared). Let's track that change via a different issue.
        Hide
        Alexander Lehmann added a comment -

        Apparently I missed the correct commits, can you please try to pick up the two commits

        https://github.com/alexlehm/jbehave-core/commit/174380b39fff804822b1f58f0f258c14099638b4
        https://github.com/alexlehm/jbehave-core/commit/73deb6b92daa752b355cf7c7b64e2f38f085906b

        if that is not working, I can reset to the main branch and resubmit it in one commit

        Show
        Alexander Lehmann added a comment - Apparently I missed the correct commits, can you please try to pick up the two commits https://github.com/alexlehm/jbehave-core/commit/174380b39fff804822b1f58f0f258c14099638b4 https://github.com/alexlehm/jbehave-core/commit/73deb6b92daa752b355cf7c7b64e2f38f085906b if that is not working, I can reset to the main branch and resubmit it in one commit
        Hide
        Mauro Talevi added a comment -

        Applied patches with thanks.

        Show
        Mauro Talevi added a comment - Applied patches with thanks.
        Mauro Talevi made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Mauro Talevi made changes -
        Fix Version/s 3.7 [ 18390 ]

          People

          • Assignee:
            Mauro Talevi
            Reporter:
            Eugeny Batov
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: