I’ve been using gatling on and off for a year now. I really like it. I’m load testing a REST service and we recently found a thread leak. So the developers wrote a ‘canary page’ that just returns the number of threads used by the JVM. I’d like to assert that the thread count doesn’t go above 200. Is there a way to do that?
You could try a combination of ofType[Int] and lessThan(), but there are some caveats:
ofType[Int] needs the original value to be typed int, here “41” is a string, so it won’t work
Your jsonPath doesn’t look valid, the first comparison needs a double equal sign, such as @.name == ‘JVM:Info’, and the .‘Thread Count’ notation isn’t the right way to do it either, take a look at the spec here: https://github.com/gatling/jsonpath/blob/master/README.md
Cheers,
The name of the json field is ‘Thread Count’ so how does scala’s JsonPath want me to reference that field? What would a correct jsonpath look like?
FWIW, I wrote that jsonpath with the help of https://jsonpath.curiousconcept.com/
Is there a better jsonpath checker for gatlings implementation?
The original question is this, "How can I assert/check that some value in a response body is lessThan or greaterThan some known value or a variable.
Here’s what I came up with. It seems clunky so I’m hoping someone can improve it! I hope there is someway to do a check on a session variable, but I couldn’t figure it out so I hacked around it with a checkIf(), then a bogus call to substring(), which just helps me to know what I was really trying to test. Please, I’d really like a cleaner solution to the problem.