apache / jmeter

Apache JMeter open-source load testing tool for analyzing and measuring the performance of a variety of services
https://jmeter.apache.org/
Apache License 2.0
8.3k stars 2.09k forks source link

CSV Data Set Config element cannot coexist with BSF Sampler in same Thread Plan #2747

Closed asfimport closed 12 years ago

asfimport commented 12 years ago

Bakir Jusufbegovic (Bug 52728): Here is a quick overview of the problem:

If there is a BSF sampler in JMeter script and also CSV Data Set Config that loads some external file like *.csv, for some reason, that represents a sign to BSF Sampler that this external file is BSF Script that needs to be loaded in JMeter during execution of the script (In general, these two components shouldn’t have anything to do with each other and variable from CSV Data Set Config shouldn’t be visible from BSF Sampler component). Because it cannot find this file on the path, error with following message will happen:

Response message: java.io.FileNotFoundException: ${SOME_FILE_PATH} (The system cannot find the file specified)

Also, with new JMeter 2.6 following drop down menu was added: Script file (overrides script) When trying to change value from drop down menu and then change focus to some other element and then retrieve back, drop down menu value was reset so it will always try to load bsf script from external file.

I think that two fixes need to be introduced:

  1. Sharing of variables between CSV Data Set Config and BSF Sampler component shouldnt be permitted
  2. Chosen value from Script File drop down menu in BSF Sampler should remain even if we change focus from that component

Severity: normal OS: All

Duplicates:

asfimport commented 12 years ago

@pmouawad (migrated from Bugzilla): Please submit a simplified Test Plan to reproduce the issue. Regards

asfimport commented 12 years ago

Bakir Jusufbegovic (migrated from Bugzilla): In orer

asfimport commented 12 years ago

Bakir Jusufbegovic (migrated from Bugzilla): Attached is simplified Test Plan that shows this defect. In this test plan there are two samplers:

  1. BSF Sampler
  2. BeanShell Sampler and one CSV Data Set Config

BeanShell Sampler will work without a problem but BSF will fail.

Created attachment BUG-52728.zip: Simplified Test Plan

asfimport commented 12 years ago

Sebb (migrated from Bugzilla): The problem is that the Config element variables from CSV Dataset are being merged into the variables for the BSF sampler. It so happens that they both use the same name, whereas BSH uses a different name.

This may not be easy to fix, as we need to maintain backwards compatibility.

asfimport commented 12 years ago

Sebb (migrated from Bugzilla): Created attachment bug52728.patch: Possible patch to prevent CSVDataset from affecting BSF Sampler

bug52728.patch ````diff Index: src/core/org/apache/jmeter/threads/TestCompiler.java =================================================================== --- src/core/org/apache/jmeter/threads/TestCompiler.java (revision 1242852) +++ src/core/org/apache/jmeter/threads/TestCompiler.java (working copy) @@ -27,6 +27,7 @@ import java.util.Set; import org.apache.jmeter.assertions.Assertion; +import org.apache.jmeter.config.CSVDataSet; import org.apache.jmeter.config.ConfigTestElement; import org.apache.jmeter.control.Controller; import org.apache.jmeter.control.TransactionController; @@ -285,7 +286,10 @@ private void configureWithConfigElements(Sampler sam, List configs) { sam.clearTestElementChildren(); for (ConfigTestElement config : configs) { - sam.addTestElement(config); + if (!(config instanceof CSVDataSet)) + { + sam.addTestElement(config); + } } } } ````
asfimport commented 12 years ago

Sebb (migrated from Bugzilla): Just realised that patch won't build with Ant, because CSVDataSet (components) is compiled after TestCompiler (core).

Could perhaps use a marker interface for Config elements that are stand-alone?

asfimport commented 12 years ago

Sebb (migrated from Bugzilla): Fixed using new marker interface.

URL: http://svn.apache.org/viewvc?rev=1293052&view=rev Log: https://github.com/apache/jmeter/issues/2747 - CSV Data Set Config element cannot coexist with BSF Sampler in same Thread Plan

Added: jmeter/trunk/src/core/org/apache/jmeter/engine/util/NoConfigMerge.java (with props) Modified: jmeter/trunk/src/components/org/apache/jmeter/config/CSVDataSet.java jmeter/trunk/src/core/org/apache/jmeter/threads/TestCompiler.java jmeter/trunk/xdocs/changes.xml

asfimport commented 12 years ago

jomebrew (migrated from Bugzilla): (In reply to comment 8)

https://github.com/apache/jmeter/issues/2801 has been marked as a duplicate of this bug.

Replaced the Bin and Lib directories with the last night (4/03) build.

Still has same problem.

Attaching simple procedure

asfimport commented 12 years ago

jomebrew (migrated from Bugzilla): Created attachment BSF_Sampler_FileNotFound.jmx: simple example