Bug 63455 - XPath Assertion: "True if nothing matches" does not work if XPath expression returns a boolean
Summary: XPath Assertion: "True if nothing matches" does not work if XPath expression ...
Status: RESOLVED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.10
Hardware: All All
: P2 normal (vote)
Target Milestone: JMETER_5.2
Assignee: JMeter issues mailing list
URL:
Keywords: FixedInTrunk, PatchAvailable
Depends on:
Blocks:
 
Reported: 2019-05-21 13:00 UTC by Philippe Mouawad
Modified: 2019-06-02 10:37 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Mouawad 2019-05-21 13:00:30 UTC
If you have this response:

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

With:

- XPath: count(//*[code=1])=1
- True if nothing matches checked


The expected result would be to have the Assertion fails as the XPath result is true.

 
The result you get is that there is no difference wether you check or not True if nothing matches checked and assertion succeeds.

There are in fact 2 issues:

- True if nothing matches checked is confusing, and should be named "Invert assertion" as that's what one is expecting
- Since the boolean function returns a node (True /False), True if nothing matches checked will always succeed
Comment 1 UbikLoadPack support 2019-05-21 13:12:58 UTC
Hello Team,

UbikLoadPack team is happy to contribute this bugfix to JMeter:

PR : https://github.com/apache/jmeter/pull/460

Regards

Twitter: @ubikloadpack
Blog: https://www.ubik-ingenierie.com/blog/
Youtube channel: https://www.youtube.com/channel/UCUv5MHnWDyD-bDkRgOr5lmw
Comment 2 Philippe Mouawad 2019-06-02 10:37:58 UTC
Author: pmouawad
Date: Sun Jun  2 10:37:36 2019
New Revision: 1860511

URL: http://svn.apache.org/viewvc?rev=1860511&view=rev
Log:
Bug 63455 - XPath Assertion: "True if nothing matches" does not work if XPath expression returns a boolean

Contributed by UbikLoadPack (https://ubikloadpack.com)

This closes #460
Bugzilla Id: 63455

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/XPathPanel.java
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
    jmeter/trunk/src/core/org/apache/jmeter/util/XPathUtil.java
    jmeter/trunk/test/src/org/apache/jmeter/assertions/XPathAssertionTest.java
    jmeter/trunk/xdocs/changes.xml
    jmeter/trunk/xdocs/usermanual/component_reference.xml
Comment 3 The ASF infrastructure team 2022-09-24 20:38:17 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/5080