Summary: | BSF JavaScript Preprocessor cannot access sampler variable on first interation | ||
---|---|---|---|
Product: | JMeter - Now in Github | Reporter: | Thomas Johnson <NTmatter> |
Component: | Main | Assignee: | JMeter issues mailing list <issues> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | 2.3.2 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Mac OS X 10.4 | ||
Attachments: | Test Case illustrating issue |
Description
Thomas Johnson
2008-12-07 04:14:22 UTC
In version 2.3.2, this issue affects both the Pre and Post Processors. As of the current trunk (722032) this only affects the Pre Processor. Thanks for the report and test case. This appears to be due to a bug in either BSF or Rhino, not JMeter. It does not appear to be possible to define a script variable with a null value to Javascript using BSF. Furthermore, any variables which are defined after the null value will also be inaccessible. The null variable in this case is "prev", so a work-round is to ensure that there is at least one previous sample result. The JMeter code can be rearanged to define the "prev" variable last, but obviously that is also only a work-round. Some research indicates that BSF used to have an issue with registering (but not declaring) a null bean back in mid-2004 (Ref 1). From the snippet below, a quick run of the test case shows that BSF Jexl handles the null "prev" object just fine. As BSF Jexl and JS get set up by the same code, it is most likely that the issue lies in or close to Rhino itself. -- Test Case output -- BSF Jexl Context: false Variables: false Sampler: false BSF JS Context: false Variables: false -- References -- (1) Commits fixing BSF issue 20355: http://markmail.org/message/ymna5ppb4556og4k As far as I can tell, the problem is in BSF, in the Javascript engine wrapper. I raised https://issues.apache.org/jira/browse/BSF-22 for the error. I've added a temporary work-round in r724446 and r724445. This is in the current nightlies (from r724447) if you want to try it out. Please reopen if the fix does not work This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2180 |