You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by "asfimport (via GitHub)" <gi...@apache.org> on 2023/04/24 18:52:00 UTC

[GitHub] [jmeter] asfimport opened a new issue, #5539: Incorrect display of decimal numbers in JSON related elements

asfimport opened a new issue, #5539:
URL: https://github.com/apache/jmeter/issues/5539

   **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
   <details open><summary>wrongDisplayOfDecmalNumber.jmx</summary>
   
   ````xml
   <?xml version="1.0" encoding="UTF-8"?>
   <jmeterTestPlan version="1.2" properties="5.0" jmeter="5.5-SNAPSHOT e0e9787">
     <hashTree>
       <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
         <stringProp name="TestPlan.comments"></stringProp>
         <boolProp name="TestPlan.functional_mode">false</boolProp>
         <boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
         <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
         <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
           <collectionProp name="Arguments.arguments"/>
         </elementProp>
         <stringProp name="TestPlan.user_define_classpath"></stringProp>
       </TestPlan>
       <hashTree>
         <Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
           <collectionProp name="Arguments.arguments">
             <elementProp name="response" elementType="Argument">
               <stringProp name="Argument.name">response</stringProp>
               <stringProp name="Argument.value">{&quot;number&quot;:2147483647.5000,&quot;username&quot;:&quot;test&quot;}</stringProp>
               <stringProp name="Argument.metadata">=</stringProp>
             </elementProp>
           </collectionProp>
         </Arguments>
         <hashTree/>
         <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
           <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
           <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
             <boolProp name="LoopController.continue_forever">false</boolProp>
             <stringProp name="LoopController.loops">1</stringProp>
           </elementProp>
           <stringProp name="ThreadGroup.num_threads">1</stringProp>
           <stringProp name="ThreadGroup.ramp_time">1</stringProp>
           <boolProp name="ThreadGroup.scheduler">false</boolProp>
           <stringProp name="ThreadGroup.duration"></stringProp>
           <stringProp name="ThreadGroup.delay"></stringProp>
           <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
         </ThreadGroup>
         <hashTree>
           <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
             <boolProp name="ResultCollector.error_logging">false</boolProp>
             <objProp>
               <name>saveConfig</name>
               <value class="SampleSaveConfiguration">
                 <time>true</time>
                 <latency>true</latency>
                 <timestamp>true</timestamp>
                 <success>true</success>
                 <label>true</label>
                 <code>true</code>
                 <message>true</message>
                 <threadName>true</threadName>
                 <dataType>true</dataType>
                 <encoding>false</encoding>
                 <assertions>true</assertions>
                 <subresults>true</subresults>
                 <responseData>false</responseData>
                 <samplerData>false</samplerData>
                 <xml>false</xml>
                 <fieldNames>true</fieldNames>
                 <responseHeaders>false</responseHeaders>
                 <requestHeaders>false</requestHeaders>
                 <responseDataOnError>false</responseDataOnError>
                 <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
                 <assertionsResultsToSave>0</assertionsResultsToSave>
                 <bytes>true</bytes>
                 <sentBytes>true</sentBytes>
                 <url>true</url>
                 <threadCounts>true</threadCounts>
                 <idleTime>true</idleTime>
                 <connectTime>true</connectTime>
               </value>
             </objProp>
             <stringProp name="filename"></stringProp>
           </ResultCollector>
           <hashTree/>
           <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="JSR223 Sampler" enabled="true">
             <stringProp name="cacheKey">true</stringProp>
             <stringProp name="filename"></stringProp>
             <stringProp name="parameters"></stringProp>
             <stringProp name="script">SampleResult.setResponseData(vars.get(&quot;response&quot;))</stringProp>
             <stringProp name="scriptLanguage">groovy</stringProp>
           </JSR223Sampler>
           <hashTree>
             <JMESPathExtractor guiclass="JMESPathExtractorGui" testclass="JMESPathExtractor" testname="JSON JMESPath Extractor - JMESPathNumber" enabled="true">
               <stringProp name="JMESExtractor.referenceName">JMESPathNumber</stringProp>
               <stringProp name="JMESExtractor.jmesPathExpr">number</stringProp>
               <stringProp name="JMESExtractor.matchNumber">1</stringProp>
             </JMESPathExtractor>
             <hashTree/>
             <JSONPostProcessor guiclass="JSONPostProcessorGui" testclass="JSONPostProcessor" testname="JSON Extractor - JSONPathNumber" enabled="true">
               <stringProp name="JSONPostProcessor.referenceNames">JSONPathNumber</stringProp>
               <stringProp name="JSONPostProcessor.jsonPathExprs">$.number</stringProp>
               <stringProp name="JSONPostProcessor.match_numbers">1</stringProp>
             </JSONPostProcessor>
             <hashTree/>
             <JSONPathAssertion guiclass="JSONPathAssertionGui" testclass="JSONPathAssertion" testname="JSON Assertion - number" enabled="true">
               <stringProp name="JSON_PATH">$.number</stringProp>
               <stringProp name="EXPECTED_VALUE">2147483647.5000</stringProp>
               <boolProp name="JSONVALIDATION">true</boolProp>
               <boolProp name="EXPECT_NULL">false</boolProp>
               <boolProp name="INVERT">false</boolProp>
               <boolProp name="ISREGEX">false</boolProp>
             </JSONPathAssertion>
             <hashTree/>
             <JMESPathAssertion guiclass="JMESPathAssertionGui" testclass="JMESPathAssertion" testname="JSON JMESPath Assertion - number" enabled="true">
               <stringProp name="JMES_PATH">number</stringProp>
               <stringProp name="EXPECTED_VALUE">2147483647.5000</stringProp>
               <boolProp name="JSONVALIDATION">true</boolProp>
               <boolProp name="EXPECT_NULL">false</boolProp>
               <boolProp name="INVERT">false</boolProp>
               <boolProp name="ISREGEX">false</boolProp>
             </JMESPathAssertion>
             <hashTree/>
             <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion - JMESPathNumber" enabled="true">
               <collectionProp name="Asserion.test_strings">
                 <stringProp name="586969693">2147483647.5000</stringProp>
               </collectionProp>
               <stringProp name="Assertion.custom_message"></stringProp>
               <stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
               <boolProp name="Assertion.assume_success">false</boolProp>
               <intProp name="Assertion.test_type">8</intProp>
               <stringProp name="Assertion.scope">variable</stringProp>
               <stringProp name="Scope.variable">JMESPathNumber</stringProp>
             </ResponseAssertion>
             <hashTree/>
             <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion - JSONPathNumber" enabled="true">
               <collectionProp name="Asserion.test_strings">
                 <stringProp name="586969693">2147483647.5000</stringProp>
               </collectionProp>
               <stringProp name="Assertion.custom_message"></stringProp>
               <stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
               <boolProp name="Assertion.assume_success">false</boolProp>
               <intProp name="Assertion.test_type">8</intProp>
               <stringProp name="Assertion.scope">variable</stringProp>
               <stringProp name="Scope.variable">JSONPathNumber</stringProp>
             </ResponseAssertion>
             <hashTree/>
           </hashTree>
           <DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="Debug Sampler" enabled="true">
             <boolProp name="displayJMeterProperties">false</boolProp>
             <boolProp name="displayJMeterVariables">true</boolProp>
             <boolProp name="displaySystemProperties">false</boolProp>
           </DebugSampler>
           <hashTree/>
         </hashTree>
       </hashTree>
     </hashTree>
   </jmeterTestPlan>
   ````
   
   </details>
   
   Version: Nightly
   Severity: normal
   OS: All


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jmeter.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [jmeter] FSchumacher commented on issue #5539: Incorrect display of decimal numbers in JSON related elements

Posted by "FSchumacher (via GitHub)" <gi...@apache.org>.
FSchumacher commented on issue #5539:
URL: https://github.com/apache/jmeter/issues/5539#issuecomment-1519030193

   On my setup the test works without problems, that is, no assertion fails.
   Therefore I close this issue. Feel free to re-open it, if you think it is still relevant.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [jmeter] FSchumacher commented on issue #5539: Incorrect display of decimal numbers in JSON related elements

Posted by "FSchumacher (via GitHub)" <gi...@apache.org>.
FSchumacher commented on issue #5539:
URL: https://github.com/apache/jmeter/issues/5539#issuecomment-1521162968

   That is a good reason to set it.
   (Still wonder why it works on my setup)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [jmeter] FSchumacher closed issue #5539: Incorrect display of decimal numbers in JSON related elements

Posted by "FSchumacher (via GitHub)" <gi...@apache.org>.
FSchumacher closed issue #5539: Incorrect display of decimal numbers in JSON related elements
URL: https://github.com/apache/jmeter/issues/5539


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [jmeter] vlsi commented on issue #5539: Incorrect display of decimal numbers in JSON related elements

Posted by "vlsi (via GitHub)" <gi...@apache.org>.
vlsi commented on issue #5539:
URL: https://github.com/apache/jmeter/issues/5539#issuecomment-1521160467

   JSON standard says the floating separator is always a dot: https://www.json.org/json-en.html, so it should not be locale-dependant.
   
   If JMeter produces comma, then it look like a bug to me.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [jmeter] asfimport commented on issue #5539: Incorrect display of decimal numbers in JSON related elements

Posted by GitBox <gi...@apache.org>.
asfimport commented on issue #5539:
URL: https://github.com/apache/jmeter/issues/5539#issuecomment-1256926063

   **andreaslind01** ([migrated from Bugzilla](https://bz.apache.org/bugzilla//show_bug.cgi?id=65318&redirect=false#c3)):
   Hello,
   
   I created a PR that should fix the issues with the JSON Assertion:
   https://github.com/apache/jmeter/pull/723


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [jmeter] andreaslind01 commented on issue #5539: Incorrect display of decimal numbers in JSON related elements

Posted by "andreaslind01 (via GitHub)" <gi...@apache.org>.
andreaslind01 commented on issue #5539:
URL: https://github.com/apache/jmeter/issues/5539#issuecomment-1522992182

   Just an additional info: This is the [commit](https://github.com/apache/jmeter/commit/ee0c973bffcdce9832a3437614fab0e59ab222c4) that causes the current issues with decimal numbers. JSON Assertions worked for me as expected with JMeter 5.4.x.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [jmeter] andreaslind01 commented on issue #5539: Incorrect display of decimal numbers in JSON related elements

Posted by "andreaslind01 (via GitHub)" <gi...@apache.org>.
andreaslind01 commented on issue #5539:
URL: https://github.com/apache/jmeter/issues/5539#issuecomment-1520035988

   Hi,
   I still get an assertion error with the attached test [jsonassertion_bug.jmx](https://apache.github.io/jmeter-bugzilla-attachments/18/65318/38361/jsonassertion_bug.jmx) using the current nightly (5.5.1-SNAPSHOT b90f122):
   ![image](https://user-images.githubusercontent.com/1842659/233991210-5b6b8bdb-04d9-4b27-a4b7-a03e8b5f4568.png)
   ![image](https://user-images.githubusercontent.com/1842659/233991249-0bc8044c-e742-44a9-839e-7c9776509cbf.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [jmeter] FSchumacher commented on issue #5539: Incorrect display of decimal numbers in JSON related elements

Posted by "FSchumacher (via GitHub)" <gi...@apache.org>.
FSchumacher commented on issue #5539:
URL: https://github.com/apache/jmeter/issues/5539#issuecomment-1520679227

   I still wonder, why it doesn't fail on my setup (I have a German locale, so numbers should have a comma to separate the digits).
   
   The second question is still, why are you trying to match a number using a regex? What are you trying to achieve there?
   
   My fears applying this patch is, that we change the number format, which others could rely on and assert against. Maybe, we could add another flag to make it configurable (on the other hand side, we already have way too many flags).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [jmeter] asfimport commented on issue #5539: Incorrect display of decimal numbers in JSON related elements

Posted by GitBox <gi...@apache.org>.
asfimport commented on issue #5539:
URL: https://github.com/apache/jmeter/issues/5539#issuecomment-1256926068

   **andreaslind01** ([migrated from Bugzilla](https://bz.apache.org/bugzilla//show_bug.cgi?id=65318&redirect=false#c4)):
   Created attachment [jsonassertion_bug.jmx](https://apache.github.io/jmeter-bugzilla-attachments/18/65318/38361/jsonassertion_bug.jmx): Example testplan for JSON Assertion bug
   <details open><summary>jsonassertion_bug.jmx</summary>
   
   ````xml
   <?xml version="1.0" encoding="UTF-8"?>
   <jmeterTestPlan version="1.2" properties="5.0" jmeter="5.5">
     <hashTree>
       <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
         <stringProp name="TestPlan.comments"></stringProp>
         <boolProp name="TestPlan.functional_mode">false</boolProp>
         <boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
         <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
         <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
           <collectionProp name="Arguments.arguments"/>
         </elementProp>
         <stringProp name="TestPlan.user_define_classpath"></stringProp>
       </TestPlan>
       <hashTree>
         <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
           <boolProp name="ResultCollector.error_logging">false</boolProp>
           <objProp>
             <name>saveConfig</name>
             <value class="SampleSaveConfiguration">
               <time>true</time>
               <latency>true</latency>
               <timestamp>true</timestamp>
               <success>true</success>
               <label>true</label>
               <code>true</code>
               <message>true</message>
               <threadName>true</threadName>
               <dataType>true</dataType>
               <encoding>false</encoding>
               <assertions>true</assertions>
               <subresults>true</subresults>
               <responseData>false</responseData>
               <samplerData>false</samplerData>
               <xml>false</xml>
               <fieldNames>true</fieldNames>
               <responseHeaders>false</responseHeaders>
               <requestHeaders>false</requestHeaders>
               <responseDataOnError>false</responseDataOnError>
               <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
               <assertionsResultsToSave>0</assertionsResultsToSave>
               <bytes>true</bytes>
               <sentBytes>true</sentBytes>
               <url>true</url>
               <threadCounts>true</threadCounts>
               <idleTime>true</idleTime>
               <connectTime>true</connectTime>
             </value>
           </objProp>
           <stringProp name="filename"></stringProp>
         </ResultCollector>
         <hashTree/>
         <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
           <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
           <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
             <boolProp name="LoopController.continue_forever">false</boolProp>
             <stringProp name="LoopController.loops">1</stringProp>
           </elementProp>
           <stringProp name="ThreadGroup.num_threads">1</stringProp>
           <stringProp name="ThreadGroup.ramp_time">1</stringProp>
           <boolProp name="ThreadGroup.scheduler">false</boolProp>
           <stringProp name="ThreadGroup.duration"></stringProp>
           <stringProp name="ThreadGroup.delay"></stringProp>
           <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
         </ThreadGroup>
         <hashTree>
           <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="JSR223 Sampler" enabled="true">
             <stringProp name="cacheKey">true</stringProp>
             <stringProp name="filename"></stringProp>
             <stringProp name="parameters"></stringProp>
             <stringProp name="script">return &quot;&quot;&quot;{
     &quot;name&quot;: &quot;apple&quot;,
     &quot;price&quot;: 0.8,
     &quot;amount&quot;: 1,
     &quot;currency&quot;: &quot;EUR&quot;
   }&quot;&quot;&quot;;</stringProp>
             <stringProp name="scriptLanguage">groovy</stringProp>
           </JSR223Sampler>
           <hashTree>
             <JSONPathAssertion guiclass="JSONPathAssertionGui" testclass="JSONPathAssertion" testname="JSON Assertion - price" enabled="true">
               <stringProp name="JSON_PATH">$.price</stringProp>
               <stringProp name="EXPECTED_VALUE">0.8</stringProp>
               <boolProp name="JSONVALIDATION">true</boolProp>
               <boolProp name="EXPECT_NULL">false</boolProp>
               <boolProp name="INVERT">false</boolProp>
               <boolProp name="ISREGEX">false</boolProp>
             </JSONPathAssertion>
             <hashTree/>
             <JSONPathAssertion guiclass="JSONPathAssertionGui" testclass="JSONPathAssertion" testname="JSON Assertion - price - regex" enabled="true">
               <stringProp name="JSON_PATH">$.price</stringProp>
               <stringProp name="EXPECTED_VALUE">\d+\.?\d*</stringProp>
               <boolProp name="JSONVALIDATION">true</boolProp>
               <boolProp name="EXPECT_NULL">false</boolProp>
               <boolProp name="INVERT">false</boolProp>
               <boolProp name="ISREGEX">true</boolProp>
             </JSONPathAssertion>
             <hashTree/>
           </hashTree>
         </hashTree>
       </hashTree>
     </hashTree>
   </jmeterTestPlan>
   ````
   
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org