Improve Error Messages in Reports?

So, in the reports, I errors reported as following:

regex.notExists didn’t match: unexpectedly found
jsonPath.is didn’t match: (3) didn’t match: found 2
jsonPath.is didn’t match: (10) didn’t match: found 5
jsonPath.is didn’t match: (10) didn’t match: found 6
jsonPath.is didn’t match: (10) didn’t match: found 4

It’d be a lot more useful if the errors were reported with the failing expression, e.g.

regex(“.+”).notExists didn’t match: unexpectedly found foo

jsonPath(“$[*]”).is didn’t match: (3) didn’t match: found 2

This would be especially useful where I have long chains of checks on content - then I’d know exactly where my check chain is failing.

I’ve nosed around the code already to see if that would be an easy obvious fix.

Looks like the message is generated at gatling-core/src/main/scala/io/gatling/core/check/Check.scala, line 65
Which would make extractor.name the culprit

So, the JsonPathExtractor has a name, which is assigned just “jsonPath”

I see that all the subclasses of JsonPathExtractor are passed a criterion which is an Expression[String]

At first, I thought I could just place that in the parent class and then use it as part of the name, but that didn’t seem to work.

I think it probably has something to do with criterion being an Expression[String], which I know is typed to be (Session) => String - but I’m not really sure what to do with that at construction time so that I can set the name the way I’d like.

name = “jsonPath(” + criterion + “)”

just resulted in “jsonPath().is” being printed for the reported error.

So, any pointers where I’m going wrong here?

–Spencer

Are you now using a SNAPSHOT version ?

I just did this quick test :

val scn3 = scenario(“Scenario3”)
.exec(http(“Home”).get("/")
.check(jsonPath("$.foo").is(“bar”)))

setUp(scn3.inject(atOnceUsers(1))).protocols(httpConf)

Then, in the console, I get :

17:12:58.285 [WARN ] i.g.h.a.AsyncHandlerActor - Request ‘Home’ failed : jsonPath($.foo).is(bar) didn’t match: found nothing

And in the report, I have :
image.png

How do your checks look like ?

Cheers
Nicolas

Oops - my fault, I messed up the versions when testing.

I think I fixed it : https://github.com/excilys/gatling/commit/d3bc7680aae8f29cdc36a79091ffa5688190c609

image.png