Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-1077

incorrect xsl transformation

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: plugin-proposals
    • Labels:
      None
    • Environment:
      Platform: All, OS: All
    • Similar Issues:

      Description

      I have this Nunit formated file

      <test-results name='IEUnit Tests' total='6' failures='0' not-run='0'
      date='6/12/2007' time='2:46 PM'>
      <test-suite name='AdministrationPasswordTest' success='true' time='35.396'>
      <results>
      <test-case name='testChangePasswordFailEmptyForm' executed='true'
      success='true' time='5.065'></test-case>
      <test-case name='testChangePasswordFailOldPasswordKO' executed='true'
      success='true' time='5.066'></test-case>
      <test-case name='testChangePasswordFailNewPasswordTooShort' executed='true'
      success='true' time='5.049'></test-case>
      <test-case name='testChangePasswordFailNewPasswordNotRepeated' executed='true'
      success='true' time='5.05'></test-case>
      <test-case name='testChangePasswordFailNewPasswordKO' executed='true'
      success='true' time='5.066'></test-case>
      <test-case name='testChangePassword' executed='true' success='true'
      time='10.1'></test-case>
      </results>
      </test-suite>
      </test-results>

      it is found and processed by the plugin, but the output is nearly empty:
      <?xml version='1.0' encoding='UTF-8'?>
      <result>
      <suites>
      <suite>
      <name>AdministrationPasswordTest</name>
      <duration>0.0</duration>
      <cases/>
      </suite>
      </suites>
      <duration>0.0</duration>
      </result>

      FYI, here's the xsl I'm using with Bamboo to convert the file in a more JUnit
      format:
      <?xml version="1.0" encoding="utf-8"?>

      <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method="xml" indent="yes" encoding="utf-8" version="1.0"
      cdata-section-elements="failure" />

      <xsl:template match="test-results">
      <xsl:element name="testsuite">

      <xsl:attribute name="errors">0</xsl:attribute>

      <xsl:attribute name="skipped"><xsl:value-of select="@not-run"
      /></xsl:attribute>

      <xsl:attribute name="tests"><xsl:value-of select="@total" /></xsl:attribute>

      <xsl:attribute name="time"><xsl:value-of
      select="current()/test-suite/@time" /></xsl:attribute>

      <xsl:attribute name="failures"><xsl:value-of select="@failures"
      /></xsl:attribute>

      <xsl:attribute name="name"><xsl:value-of select="@name" /></xsl:attribute>

      <xsl:apply-templates select="current()/test-suite/results" mode="resultsMode" />

      </xsl:element>
      </xsl:template >

      <!-- DECLARING WHAT TO DO WHEN FINDING A "RESULTS" ELEMENT -->
      <xsl:template mode="resultsMode" match="results">
      <xsl:message>processing a result element</xsl:message>
      <xsl:apply-templates select="current()/test-case" mode="testCaseMode" />
      </xsl:template>

      <!-- DECLARING WHAT TO DO WHEN FINDING A "TEST-CASE" ELEMENT -->
      <xsl:template mode="testCaseMode" match="test-case">

      <xsl:element name="testcase">
      <xsl:attribute name="time"><xsl:value-of select="@time" /></xsl:attribute>

      <xsl:attribute name="name">in file <xsl:value-of
      select="current()/../../@name" />.js, <xsl:value-of select="@name"
      /></xsl:attribute>

      <xsl:apply-templates select="current()/failure" mode="failureMode" />
      </xsl:element>

      </xsl:template>

      <!-- DECLARING WHAT TO DO WHEN FINDING A "FAILURE" ELEMENT -->
      <xsl:template mode="failureMode" match="failure">

      <xsl:element name="failure">
      <xsl:attribute name="type">IEunit failure</xsl:attribute>

      <xsl:attribute name="message"><xsl:value-of select="current()/message/."
      /></xsl:attribute>
      </xsl:element>
      </xsl:template>

      </xsl:stylesheet>

      Hope this helps


      Vincent FUCHS

        Attachments

          Activity

          Hide
          vfuchs vfuchs added a comment -

          some more info, copied from our discussion:

          Here is another source file:
          <test-results name='IEUnit Tests' total='23' failures='0' not-run='0'
          date='6/12/2007' time='5:29 PM'>

          <test-suite name='AdministrationPasswordTest' success='true'
          time='35.541000000000004'>
          <results>
          <test-case name='testChangePasswordFailEmptyForm' executed='true'
          success='true' time='5.075'></test-case>
          <test-case name='testChangePasswordFailOldPasswordKO' executed='true'
          success='true' time='5.075'></test-case>
          <test-case name='testChangePasswordFailNewPasswordTooShort' executed='true'
          success='true' time='5.075'></test-case>
          <test-case name='testChangePasswordFailNewPasswordNotRepeated'
          executed='true' success='true' time='5.075'></test-case>
          <test-case name='testChangePasswordFailNewPasswordKO' executed='true'
          success='true' time='5.091'></test-case>
          <test-case name='testChangePassword' executed='true' success='true'
          time='10.15'></test-case>
          </results>
          </test-suite>

          <test-suite name='AdministrationTechnicalTest' success='true'
          time='257.82899999999995'>
          <results>
          <test-case name='testEmptyDocumentTrash' executed='true' success='true'
          time='15.163'></test-case>
          <test-case name='testListManagementAddRemoveTitle' executed='true'
          success='true' time='12.891'></test-case>
          <test-case name='testListManagementAddRemoveTeam' executed='true'
          success='true' time='12.703'></test-case>
          <test-case name='testListManagementAddRemoveCategory' executed='true'
          success='true' time='12.688'></test-case>
          <test-case name='testListManagementAddEmptyTeam' executed='true'
          success='true' time='10.151'></test-case>
          <test-case name='testListManagementAddEmptyTitle' executed='true'
          success='true' time='10.134'></test-case>
          <test-case name='testListManagementAddEmptyCategory' executed='true'
          success='true' time='10.182'></test-case>
          <test-case name='testListManagementAddDuplicateTitle' executed='true'
          success='true' time='10.166'></test-case>
          <test-case name='testListManagementAddDuplicateTeam' executed='true'
          success='true' time='10.166'></test-case>
          <test-case name='testListManagementAddDuplicateCategory' executed='true'
          success='true' time='10.166'></test-case>
          <test-case name='testListManagementRemoveUsedTeam' executed='true'
          success='true' time='10.165'></test-case>
          <test-case name='testListManagementRemoveUsedCategory' executed='true'
          success='true' time='10.166'></test-case>
          <test-case name='testDefaultValuesAddEmpty' executed='true' success='true'
          time='10.166'></test-case>
          <test-case name='testDefaultValuesAddAndDelete' executed='true'
          success='true' time='15.241'></test-case>
          <test-case name='testDefaultValuesAddAll' executed='true' success='true'
          time='22.823'></test-case>
          <test-case name='testCustomThemeList' executed='true' success='true'
          time='44.642'></test-case>
          <test-case name='testIndexesReset' executed='true' success='true'
          time='30.216'></test-case>
          </results>
          </test-suite>

          </test-results>

          AdministrationPasswordTest and AdministrationTechnicalTest are files containing
          unit tests. Ideally, each file would be a package in Hudson GUI, so that we see
          which file failed. Unfortunately, here's the current result:
          <?xml version='1.0' encoding='UTF-8'?>
          <result>
          <suites>
          <suite>
          <name>AdministrationPasswordTest</name>
          <duration>0.0</duration>
          <cases/>
          </suite>
          <suite>
          <name>AdministrationTechnicalTest</name>
          <duration>0.0</duration>
          <cases/>
          </suite>
          </suites>
          <duration>0.0</duration>
          </result>

          Show
          vfuchs vfuchs added a comment - some more info, copied from our discussion: Here is another source file: <test-results name='IEUnit Tests' total='23' failures='0' not-run='0' date='6/12/2007' time='5:29 PM'> <test-suite name='AdministrationPasswordTest' success='true' time='35.541000000000004'> <results> <test-case name='testChangePasswordFailEmptyForm' executed='true' success='true' time='5.075'></test-case> <test-case name='testChangePasswordFailOldPasswordKO' executed='true' success='true' time='5.075'></test-case> <test-case name='testChangePasswordFailNewPasswordTooShort' executed='true' success='true' time='5.075'></test-case> <test-case name='testChangePasswordFailNewPasswordNotRepeated' executed='true' success='true' time='5.075'></test-case> <test-case name='testChangePasswordFailNewPasswordKO' executed='true' success='true' time='5.091'></test-case> <test-case name='testChangePassword' executed='true' success='true' time='10.15'></test-case> </results> </test-suite> <test-suite name='AdministrationTechnicalTest' success='true' time='257.82899999999995'> <results> <test-case name='testEmptyDocumentTrash' executed='true' success='true' time='15.163'></test-case> <test-case name='testListManagementAddRemoveTitle' executed='true' success='true' time='12.891'></test-case> <test-case name='testListManagementAddRemoveTeam' executed='true' success='true' time='12.703'></test-case> <test-case name='testListManagementAddRemoveCategory' executed='true' success='true' time='12.688'></test-case> <test-case name='testListManagementAddEmptyTeam' executed='true' success='true' time='10.151'></test-case> <test-case name='testListManagementAddEmptyTitle' executed='true' success='true' time='10.134'></test-case> <test-case name='testListManagementAddEmptyCategory' executed='true' success='true' time='10.182'></test-case> <test-case name='testListManagementAddDuplicateTitle' executed='true' success='true' time='10.166'></test-case> <test-case name='testListManagementAddDuplicateTeam' executed='true' success='true' time='10.166'></test-case> <test-case name='testListManagementAddDuplicateCategory' executed='true' success='true' time='10.166'></test-case> <test-case name='testListManagementRemoveUsedTeam' executed='true' success='true' time='10.165'></test-case> <test-case name='testListManagementRemoveUsedCategory' executed='true' success='true' time='10.166'></test-case> <test-case name='testDefaultValuesAddEmpty' executed='true' success='true' time='10.166'></test-case> <test-case name='testDefaultValuesAddAndDelete' executed='true' success='true' time='15.241'></test-case> <test-case name='testDefaultValuesAddAll' executed='true' success='true' time='22.823'></test-case> <test-case name='testCustomThemeList' executed='true' success='true' time='44.642'></test-case> <test-case name='testIndexesReset' executed='true' success='true' time='30.216'></test-case> </results> </test-suite> </test-results> AdministrationPasswordTest and AdministrationTechnicalTest are files containing unit tests. Ideally, each file would be a package in Hudson GUI, so that we see which file failed. Unfortunately, here's the current result: <?xml version='1.0' encoding='UTF-8'?> <result> <suites> <suite> <name>AdministrationPasswordTest</name> <duration>0.0</duration> <cases/> </suite> <suite> <name>AdministrationTechnicalTest</name> <duration>0.0</duration> <cases/> </suite> </suites> <duration>0.0</duration> </result>
          Hide
          redsolo redsolo added a comment -

          Confirmed

          Show
          redsolo redsolo added a comment - Confirmed
          Hide
          redsolo redsolo added a comment -

          Fixed, made XSL more error tolerant.

          Show
          redsolo redsolo added a comment - Fixed, made XSL more error tolerant.

            People

            • Assignee:
              Unassigned
              Reporter:
              vfuchs vfuchs
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: