I couldn’t find in the JsonPath documentation an operator for ‘not equals’ such as ‘!=’ in Scala or ‘<>’ in SQL.
Using a JSON such as this one:
{“array”:{“items”:[{“item”:“expectedValue”},{“item”:“invalidValue”}]}}
I would like to run this jsonPath query in a check AND make sure I get an empty list:
$.array.items[?(@.item!=‘expectedValue’)]
The problem is that both the ‘!=’ and the ‘<>’ operators seem to be unsupported in JsonPath.
Thanks in advance.
Use ofType in order to grab the parts of the JSON tree you’re interested in, and then Either use a transform step, or write your own Validator if your logic is too complex.
Thanks.
How do I create a custom validator? I couldn’t find details in the documentation you shared.
Do I need to create an extractor an extractorFactory and a checkBuilder like you did in the Gatling code?
If yes, is there possibly a simpler way to do it?
For some reason the change you made is still not available in the documentation. Strange…
Still, I don’t get it. Using version 2.1.7 within a check I do not have a “validate” method available for call. What I do have are
ValidatorCheckBuilder2Check
ValidatorCheckBuilder2CheckBuilder
Can you please assemble a minimal code sample that would show how to use custom validators?
Thanks in advance
Ori
For some reason the change you made is still not available in the
documentation. Strange...
Doc is only published when we release.
Still, I don't get it. Using version 2.1.7 within a check I do not have a
"validate" method available for call. What I do have are
ValidatorCheckBuilder2Check
ValidatorCheckBuilder2CheckBuilder
It's definitively there:
https://github.com/gatling/gatling/blob/2.1.X/gatling-core/src/main/scala/io/gatling/core/check/CheckBuilder.scala#L112
Can you please assemble a minimal code sample that would show how to use
custom validators?
Sorry, don't have time.
Have a look at the doc commit.