DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42088>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42088

           Summary: XPath Assertion component does not work for queries
                    which result in boolean, numbers etc
           Product: JMeter
           Version: 2.2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Main
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


The JMeter XPath Assertion (classname: 
org.jmeter.components.assertions.XpathAssertion) component does not work for a 
subset of XPath queries.

Current behaviour: The XpathAssertion *only* works for XPath queries which 
return a NodeList. For any other queries that return a non-NodeList result, 
XpathAssertion fails with a TransformerException.

Eg:
<response>
  <code>1</code>
  <error>Print Error</error>
  <error>Network Error</error>
</response>

XpathAssertion works for //*[code=1]

XpathAssertion does not work for count(//*error)=2   {this is valid XPath}
It returns a TransformerException.

Proposed Solution:
We need additional meat in XpathAssertion#getResult(SampleResult):
1. Use generic XPathAPI.eval, instead of XPathAPI.selectNodeList 
2. Make decision based on the return value of point 1.
   a. If NodeList, do as earlier.
   b. If boolean, then fail if false, else pass.
   c. So on for other types.


After the fix, the following assertions must be successful,

<response>
  <code>1</code>
  <error>Print Error</error>
  <error>Network Error</error>
</response>

Query 1
count(//*error)=2

Query 2
count(//*[code=1])=1

These would be unsuccessful:

Query 3
count(//*error)=1

Query 4
count(//*[code=2])=1

(Further tests can be added, depending on what return values from XPath 
queries are being supported - boolean, number etc)

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to