Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8286091

Improve XPath test coverage



    • Bug
    • Resolution: Delivered
    • P4
    • 20
    • 11, 17, 18, 19
    • xml


      Recent activities involving XPath have exposed that there are some areas lacking complete test coverage. Existing tests, both functional and/or unit tests, are mostly focused on the public APIs. There are very few tests that exercise the XPath functionality itself, and especially around XPath expressions.

      A good start would be to simply follow the XPath specification and work through the various types of expressions. The test for JDK-8284920 was created to serve the base for additional test cases. It provided various cases for locating the parent (one of which caused the issue as reported in JDK-8284920). Additional location expressions can be directly added to the DataProvider, while other type of expressions may be in other providers for their type.

      -- Basic XPath Expression Testing

      Tasks could potentially be split in accordance with the types of expressions as specified in the XPath specification (https://www.w3.org/TR/1999/REC-xpath-19991116/), e.g. Axes, Node Tests, Predicates, Operators, Functions, though they may overlap. Tests may also be split by the purpose they intend to achieve, for example the test for JDK-8284920 contained various ways for locating the parent and self nodes.

      -- Old API vs new API (those added since 9)
      Since JDK 9, new APIs that took advantage of newer features had been added. It would therefore be helpful to run each test case through both the older and newer API (for example, XPath::evaluate, XPath::evaluateExpression).

      -- Unexpected Exceptions

      JDK-8284548 was a case where invalid expressions could cause the XPath processor to throw unexpected exceptions. It may be helpful to create some broken expressions based on those in the Basic Expression test, and verify whether the processor handles them properly.




            joehw Joe Wang
            joehw Joe Wang
            0 Vote for this issue
            3 Start watching this issue