Skip to content

Commit

Permalink
JBEHAVE-655: a comment before "Scenario" ends up as package name in j…
Browse files Browse the repository at this point in the history
…behave-plugin-jenkins

always use testcase/@path instead of @title
this way we get package.file.story as title, which matches the normal junit results with package.classname.methodname
  • Loading branch information
alexlehm committed Feb 25, 2012
1 parent 3d22f27 commit 31bf5eb
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@
<xsl:output method="xml" indent="yes" />

<xsl:variable name="storyTitle">
<xsl:choose>
<xsl:when test="string(//story/@title)">
<xsl:value-of select="//story/@title" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//story/@path" />
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="//story/@path" />
</xsl:variable>

<xsl:template match="/">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ public void transformFilterStoryReport() throws FileNotFoundException, Throwable
assertEquals("0", engine.evaluate(TESTCASE_FAILURE, document));
}

@Test
public void testsuiteNameTitle() throws FileNotFoundException, Throwable {
runStories("title.story");
Document document = tranformReport("title.xml");
assertEquals("title.story", engine.evaluate(TESTSUITE_NAME_ATTRIBUTE, document));
}

private void runStories(String... storyPaths) {
StoryReporterBuilder storyReporterBuilder = new StoryReporterBuilder().withDefaultFormats()
.withCodeLocation(CodeLocations.codeLocationFromClass(ReportTransformBehaviour.class))
Expand Down
7 changes: 7 additions & 0 deletions jbehave-hudson-plugin/src/test/resources/title.story
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This story has a lengthy introduction text to exhibit
a jenkins xunit plugin problem with the title

Scenario: Something

When I do something

Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@
<xsl:output method="xml" indent="yes" />

<xsl:variable name="storyTitle">
<xsl:choose>
<xsl:when test="string(//story/@title)">
<xsl:value-of select="//story/@title" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//story/@path" />
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="//story/@path" />
</xsl:variable>

<xsl:template match="/">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ public void transformFilterStoryReport() throws FileNotFoundException, Throwable
assertEquals("0", engine.evaluate(TESTCASE_FAILURE, document));
}

@Test
public void testsuiteNameTitle() throws FileNotFoundException, Throwable {
runStories("title.story");
Document document = tranformReport("title.xml");
assertEquals("title.story", engine.evaluate(TESTSUITE_NAME_ATTRIBUTE, document));
}

private void runStories(String... storyPaths) {
StoryReporterBuilder storyReporterBuilder = new StoryReporterBuilder().withDefaultFormats()
.withCodeLocation(CodeLocations.codeLocationFromClass(ReportTransformBehaviour.class))
Expand Down
7 changes: 7 additions & 0 deletions jbehave-jenkins-plugin/src/test/resources/title.story
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This story has a lengthy introduction text to exhibit
a jenkins/hudson xunit plugin problem with the title

Scenario: Something

When I do something

0 comments on commit 31bf5eb

Please sign in to comment.