Bug 46407 - BSF elements do not load script files, attempt to interpret filename as script
BSF elements do not load script files, attempt to interpret filename as script
Status: RESOLVED FIXED
Product: JMeter
Classification: Unclassified
Component: Main
Nightly (Please specify date)
PC Mac OS X 10.4
: P2 normal (vote)
: ---
Assigned To: JMeter issues mailing list
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2008-12-16 08:18 UTC by Thomas Johnson
Modified: 2008-12-19 19:55 UTC (History)
0 users



Attachments
Test case illustrating issue (watch the console output) (2.64 KB, text/plain)
2008-12-16 08:20 UTC, Thomas Johnson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Johnson 2008-12-16 08:18:21 UTC
When specifying a script file in the BSF post-processor, the filename is treated as a code snippet instead of being loaded, taking precedence over the regular script.

This likely also affects the BSF Preprocessor, Assertion, and Listener, as they all call the BSFTestElement.processFileOrScript(BSFManager) method. The processFileOrScript method currently takes the filename and passes it directly to the script manager for evaluation instead of loading the file and passing its contents to the script manager.

Steps to Reproduce:
 - Create new Test Plan
 - Add a new Thread Group
 - Add a new sampler (tested with a Debug Sampler)
 - Add a new BSF Postprocessor
 - Choose an available BSF language (Tested with "javascript")
 - Input valid javascript as filename (Tested with OUT.println("--- filename ---"))
 - Input valid javascript as script (Tested with OUT.println("--- script ---");)
 - Execute test

Expected Results:
 - Postprocessor fails, unable to find file

Actual Results:
 - Console output: "--- filename ---"
Comment 1 Thomas Johnson 2008-12-16 08:20:44 UTC
Created attachment 23031 [details]
Test case illustrating issue (watch the console output)
Comment 2 Thomas Johnson 2008-12-16 08:22:54 UTC
Affects nightly build from r724447
Comment 3 Sebb 2008-12-19 19:55:44 UTC
Thanks for the bug report.

The code for processing script files was completely broken - it did not bother reading the file - oops!

Fixed in SVN in r728228.