Search code examples
javajsonjmeterassertion

Jmeter 5.5 error with assertion value type, string not equal to int


I have a test that used to work perfect in jmeter 5.4.1. Then I upgraded to jmeter 5.5 recently and all JSON assertions stopped working.

this is the message I get from all JSON assertions :

Assertion failure message:Value expected to be '8', but found '8'

the value is the same, but I realized that now it checks the type (string != number), but in previous versions, it used to work.

this is my Json assert :
enter image description here

And this is an example of the JSON response :

{
  "person": {
    "age": "8"
  }
}

Anyone knows how to disable the type check or how to make it works like previous versions?

If I change the JSON assertion value like this, it works :

[enter image description here](https://i.sstatic.net/98GKg.png)

The problem is that I have a lot of tests, and it's better for me to find a different solution, like enable/disable a parameter, or something like that.

Thanks !


Solution

  • It's a side-effect of the bug fix for the JMeter Issue 5543, you might want to report it

    Looking into this line:

    Object expected = JSONValue.parse(getExpectedValue());
    

    there is no possibility to revert to the previous behaviour via property. You might want to tick "Match as regular expression" box:

    enter image description here

    however it might break more complex assertions especially if they contain meta characters

    So you either need to downgrade and wait for the decision or scan assertion failure messages using JSR223 Assertion and Groovy language and set the assertion result as passed if "expected" and "found" values are equal