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

Test function name containing < and > is not considered valid.

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: xunit-plugin
    • Labels:
      None
    • Environment:
      Windows XP
      Hudson 1.374
      xunit 1.7
      boost test 1.39
    • Similar Issues:

      Description

      We test templated c++ functions using boost test's template binding test tool BOOST_AUTO_TEST_CASE_TEMPLATE. This results in the names of the unit tests containing the templated parameter type, e.g. TestExample<int>, TestExample<double>. These names appear in the output XML like so:

      <TestCase name="TestExample<int>">
      ...
      ...
      </TestCase>

      When xunit comes to parse this, the following error is raised:

      [xUnit] [WARNING] - At line 1 of file:/D:/Develop/boost-test-TestGeneral.xml:cvc-datatype-valid.1.2.1: 'TestAddX<int>' is not a valid value for 'NMTOKEN'.
      [xUnit] [WARNING] - At line 1 of file:/D:/Develop/boost-test-TestGeneral.xml:cvc-attribute.3: The value 'TestAddX<int>' of attribute 'name' on element 'TestCase' is not valid with respect to its type, 'NMTOKEN'.

        Attachments

          Activity

          Hide
          gbois Gregory Boissinot added a comment -

          The following XML file is not valid
          <TestCase name="TestExample<int>">
          ...
          </TestCase>
          -> The character '<' cannot be used in an attribute value.

          You have to for example
          <TestCase name="TestExample<int>">
          ...
          </TestCase>

          I suggest you should contact the Boost Test team for having a valid output file.

          Show
          gbois Gregory Boissinot added a comment - The following XML file is not valid <TestCase name="TestExample<int>"> ... </TestCase> -> The character '<' cannot be used in an attribute value. You have to for example <TestCase name="TestExample<int>"> ... </TestCase> I suggest you should contact the Boost Test team for having a valid output file.
          Hide
          rioch rioch added a comment - - edited

          Sorry, I think JIRA formatted what I wrote. The XML contains the HTML codes for < and >, which I think is valid XML:

          <TestCase name="TestExample&lt;int&gt;">
          ...
          ...
          </TestCase>
          

          The error message shows these codes converted.

          Show
          rioch rioch added a comment - - edited Sorry, I think JIRA formatted what I wrote. The XML contains the HTML codes for < and >, which I think is valid XML: <TestCase name="TestExample&lt;int&gt;"> ... ... </TestCase> The error message shows these codes converted.
          Hide
          gbois Gregory Boissinot added a comment -

          Ok, please send me an input file sample and I going to try updating the boost test XSD for your use case.

          Show
          gbois Gregory Boissinot added a comment - Ok, please send me an input file sample and I going to try updating the boost test XSD for your use case.
          Hide
          jailin jailin added a comment -

          Hi, we have the same problem as well after upgraded plugin version.
          We found that if test case name contains bracket or equal sign will be considered as invalid format as well.

          eg.
          {{

          { <TestCase name="tests with AllowNewInstrumentDefaultOverwrite = true"> }

          }}
          {{

          { [xUnit] [WARNING] - At line 49 of file:/home/hudson//workspace/ML_data/boosttest.xml:cvc-datatype-valid.1.2.1: 'tests with AllowNewInstrumentDefaultOverwrite = true' is not a valid value for 'NMTOKEN'. }

          }}

          {{

          { <TestCase name="(TestMessageSizes)"> }

          }}
          {{

          { [xUnit] [WARNING] - At line 4 of file:/home/hudson/workspace/ML_flex/boosttest.xml:cvc-datatype-valid.1.2.1: '(TestMessageSizes)' is not a valid value for 'NMTOKEN'. }

          }}

          What we can do now is revert the plugin version.

          Show
          jailin jailin added a comment - Hi, we have the same problem as well after upgraded plugin version. We found that if test case name contains bracket or equal sign will be considered as invalid format as well. eg. {{ { <TestCase name="tests with AllowNewInstrumentDefaultOverwrite = true"> } }} {{ { [xUnit] [WARNING] - At line 49 of file:/home/hudson//workspace/ML_data/boosttest.xml:cvc-datatype-valid.1.2.1: 'tests with AllowNewInstrumentDefaultOverwrite = true' is not a valid value for 'NMTOKEN'. } }} {{ { <TestCase name="(TestMessageSizes)"> } }} {{ { [xUnit] [WARNING] - At line 4 of file:/home/hudson/workspace/ML_flex/boosttest.xml:cvc-datatype-valid.1.2.1: '(TestMessageSizes)' is not a valid value for 'NMTOKEN'. } }} What we can do now is revert the plugin version.
          Hide
          rioch rioch added a comment -

          The attached file is the boost test xml output containing < and > in the test names.

          Show
          rioch rioch added a comment - The attached file is the boost test xml output containing < and > in the test names.
          Hide
          gbois Gregory Boissinot added a comment -

          Fixed from xUnit 1.12 (with DTKIT 0.12).
          The issue status was not be updated. It's a forget from me.
          Do not hesitate to use latest xUnit version: 1.13

          Show
          gbois Gregory Boissinot added a comment - Fixed from xUnit 1.12 (with DTKIT 0.12). The issue status was not be updated. It's a forget from me. Do not hesitate to use latest xUnit version: 1.13

            People

            • Assignee:
              gbois Gregory Boissinot
              Reporter:
              rioch rioch
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: