Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Predicates with not qualifier #39

Closed
fabricereix opened this issue Oct 15, 2020 · 2 comments
Closed

Predicates with not qualifier #39

fabricereix opened this issue Oct 15, 2020 · 2 comments
Assignees
Labels
documentation Improvements or additions to documentation
Milestone

Comments

@fabricereix
Copy link
Collaborator

The not qualifier in the predicate negates most of the time the predicate result.

But there are a few cases, for which it does not invert a predicate failure.
Hurl detects some inconsistencies between the predicate and the value to which it is applied and prefer to make the assert fail.

Example 1 - the value (returned by the query) is 1 (integer)

All the following predicates fail:

equals 2
equals null
contains "toto"

Negating the predicate does not necessarily make the predicate succeeds.

not equals 2       
not equals null  
not contains "toto" => failure

The last one fails because the contains predicate only apply to String value, and thus it does not make sense to apply it to a integer value.
This is equivalent to a type error.

Example 2 - the value is not found

All the following predicates fail:

exist
equals 1
contains "toto"

all these predicates will success if there are negated

not exist
not equals 1
not contains "toto"

There can't be any "type checking" when no value is returned.

Example 3 - the value is present but does not have a value

for example, the Secure cookie attribute, it is present or not
but it does not have a value

All the following predicates fail:

equals true
equals false
equals 1
contains "toto"

All these predicates will fail even if they are negated.

not equals true
not equals false
not equals 1
not contains "toto"

They must be applied to a value.
exist is the only predicate that can be applied.

@fabricereix fabricereix added the documentation Improvements or additions to documentation label Oct 15, 2020
@fabricereix
Copy link
Collaborator Author

for predicate success, not will always negate as predicate failure

jcamiel added a commit to Orange-OpenSource/hurl-jvm that referenced this issue Oct 18, 2020
jcamiel added a commit to Orange-OpenSource/hurl-jvm that referenced this issue Oct 18, 2020
@fabricereix
Copy link
Collaborator Author

implemented in #43

@lepapareil lepapareil added this to the 0.99 milestone Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants