Open Thomasdezeeuw opened 5 months ago
The error is also misleading if the condition fails (i.e. we get the value that we didn't want):
error: Assert failure
--> FILE.hurl:2038:0
|
| GET URL
| ...
2038 | jsonpath "$.data" != "text"
| actual: string <text>
| expected: string <text>
|
Thanks @Thomasdezeeuw for reporting the bug. The error message is indeed misleading.
We could simply display the expected type along with the predicate
error: Assert failure
--> FILE.hurl:3682:0
3682 | jsonpath "$PATH" != "NOT EXPECTED"
| actual: none
| expected: string != "NOT EXPECTED"
or repeating the predicate may be overkilling
error: Assert failure
--> FILE.hurl:3682:0
3682 | jsonpath "$PATH" != "NOT EXPECTED"
| actual: none
| expected: string
with the exists
predicate, we display the following error message
error: Assert failure
--> tests_failed/predicate.hurl:43:0
|
| GET http://localhost:8000/predicate/error/type
| ...
43 | jsonpath "$.not-exist" exists
| actual: none
| expected: something
|
We could also reuse the same message (something
, similar to your anything
).
What is the current bug behavior?
The
!=
(not equal) operator creates an error message where it "expects" the value we don't want to match. SeeSteps to reproduce
Create webserver that returns some JSON data, doesn't matter what, as long as it doesn't match below.
Create Hurl file that makes a request and has the following assertion:
What is the expected correct behavior?
An error message that says expected anything but value. For example
Execution context
hurl --version
):Possible fixes