ACR Rules

⌘K
  1. Home
  2. Docs
  3. ACR Rules
  4. Reliability (41)
  5. Check for negative conditions in XPath should be done using not instead of !=

Check for negative conditions in XPath should be done using not instead of !=

Introduced in version: 1.3 (29 Jan 2020)

‘This is very likely a bug and should be changed. Negative conditions in Xpath do not work as intuitively expected.

Noncompliant example:

[Module.Association/Module.Entity/Module.Association2 != empty]
[Module.Association/Module.Entity/Module.Association2/Module.Entity/SomeAttribute != $Value]

the above will return false also when the path does not exist.
To fix this “not” has to be used.

Compliant example:

[not(Module.Association/Module.Entity/Module.Association2 = empty)]
[not(Module.Association/Module.Entity/Module.Association2/Module.Entity/SomeAttribute = $Value)]