Bug 53145 - HTTP Sampler - function in path evaluated too early
HTTP Sampler - function in path evaluated too early
Status: RESOLVED FIXED
Product: JMeter
Classification: Unclassified
Component: Main
2.6
PC All
: P2 normal (vote)
: ---
Assigned To: JMeter issues mailing list
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2012-04-25 10:42 UTC by jerald
Modified: 2012-04-25 12:29 UTC (History)
0 users



Attachments
jmx script file which explains the bug in simple manner (7.76 KB, application/octet-stream)
2012-04-25 10:42 UTC, jerald
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jerald 2012-04-25 10:42:04 UTC
Created attachment 28676 [details]
jmx script file which explains the bug in simple manner

i tried with defining two variables test1 and test2 with values 10 and 20 respectively using user defined variables. both variables are used inside the function __intSum and the variables used are resolved and expression is executed with out any error. But if i use the variable created using regular expression extractor, it is not resolved and it throws NumberFormatException in jmeter logs.

I have attached a sample jmx scrript file which sends a GET request to google.com and then extracts a number from its image file name using REE and assigning that value to variable test3. This variable test3 is not resolved inside the function __intSum and it throws NumberFormatException.
Comment 1 Sebb 2012-04-25 11:59:18 UTC
The problem is that the function is being evaluated before the variable has been defined.

Use the test plan toe initialise test3 as a valid number (e.g. 1) and the test will then work.

However, this does point to a possible bug in JMeter - I'm not yet sure why the function is being executed at test startup. If it's necessary to do so, the code could perhaps be more tolerant of the error.
Comment 2 Sebb 2012-04-25 12:27:02 UTC
URL: http://svn.apache.org/viewvc?rev=1330236&view=rev
Log:
Bug 53145 - HTTP Sampler - function in path evaluated too early

Modified:
   jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
   jmeter/trunk/xdocs/changes.xml


Tidied up code so it only extracts the property value if it's a StringProperty.
Previously the debug statements were executing the function as part of building their string parameters.