apache / apache/jmeter

Incorrect display of decimal numbers in JSON related elements

Open
#5,539 10 comments 0 reactions 0 assignees View on GitHub
os: All P2
Dominant language
Java
Stars
9.5k
Forks
2.3k
Avg merge
1d 22h
Merged PRs (30d)
5

Description

**eR@SeR** ([Bug 65318](https://bz.apache.org/bugzilla//show_bug.cgi?id=65318&redirect=false)):
Hello,

In the attached test plan, there are JSON Extractor, JSON JMESPath Extractor, JSON Assertion, JSON JMESPath Assertion, and Response Assertion elements. There are several issues found when the test is executed:

1. Provided decimal number is shown as the scientific notation "2.1474836475E9" in VRT (JSON, JSON Path Tester, and JSON JMESPath Tester), but it should be "2147483647.5000". Same number is shown if "$.number" or "number" JSON paths are used in corresponding JSON Testers.
----
2. JSON Assertion shows the message "Value expected to be '2147483647.5000', but found '2147483647,5'". Expected result should be "2147483647.5000", and assertion should pass.
----
3. JSON JMESPath Assertion shows the message "Value expected to be equal to 2147483647.5000". From this message it cannot be known what value is evaluated from the provided path. The expected message could be "Value expected to be '2147483647.5000', but found '2147483647,5'", same as in JSON Assertion (if the assertion fails of course). The expected result should be "2147483647.5000", and the assertion should pass.
----
4. JSON Extractor and JSON JMESPath Extractor extract values as the scientific notation "2.1474836475E9" so when variables are checked in Response Assertion they fail. Please check Debug Sampler in VRT. The expected result should be "2147483647.5000".

IMO, all JSON-related elements should evaluate literal decimal numbers since they cannot be properly asserted without using a code (String.format() function for example).

P.S. I use non-English localization settings where the decimal number symbol is a comma.

Jmeter 5.5 e0e9787
Microsoft Windows 10 Enterprise 64-bit
java version "15.0.1" 2020-10-20

Created attachment [wrongDisplayOfDecmalNumber.jmx](https://apache.github.io/jmeter-bugzilla-attachments/18/65318/37869/wrongDisplayOfDecmalNumber.jmx): wrongDisplayOfDecmalNumber
wrongDisplayOfDecmalNumber.jmx

````xml




false
true
false









response
{"number":2147483647.5000,"username":"test"}
=





continue

false
1

1
1
false


true



false

saveConfig


true
true
true
true
true
true
true
true
false
true
true
false
false
false
true
false
false
false
true
0
true
true
true
true
true
true






true


SampleResult.setResponseData(vars.get("response"))
groovy



JMESPathNumber
number
1



JSONPathNumber
$.number
1



$.number
2147483647.5000
true
false
false
false



number
2147483647.5000
true
false
false
false




2147483647.5000


Assertion.response_data
false
8
variable
JMESPathNumber




2147483647.5000


Assertion.response_data
false
8
variable
JSONPathNumber




false
true
false




````

Version: Nightly
Severity: normal
OS: All

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.