Hello, this is my first patch for JMeter. If you have two or more CSV Data Sets in your test plan, which use the same file you may have a problem (like me). The file is only opened once (one instance). So every read from a CSV-file (regardless of which thread) will cause a jump to the next line. I wrote a patch so you can choose in the CSV-Data Set whether the file reading shall be independet (the file will be opened again even it is already open ) or not (the old behavior). A screenshot is also added to the archive. Please contact me if you have questions or annotations. Thanks
Created attachment 21524 [details] Patch with Screenshot
Created attachment 21550 [details] A testplan for my patch. Here is a testplan for my patch. You need beanshell for this. Two threads with two CSV Data Sets are reading from the same csv-file. Without my patch the output (print) is like: line1 line2 with my patch you can set on both CSV-Data Sets "Independent CSV-Data reading" to true: line1 line1 The csv-data is read independently. It doesn't matter if other threads are reading from the same file.
Just tried the patch - it does not work reliably. The FileServer relies on retrieving the FileEntry using just the file name as key, so if the same name is used more than once, the second entry will overwrite the first. It is too restrictive to insist on unique file names. For independent files, the FileServer could use the CSV Dataset instance (this) as the key. There's also a typo in the patch - the new reserveFile parameter should be boolean, not Boolean.
Created attachment 21580 [details] Another patch for an independent CSV Data Source I've created a similar patch which makes the CSV Data Source optional independent. You can also specify, how many loops throug the file you want to do if recycle is TRUE. Greetings
Created attachment 21583 [details] New patch for CSVDataSet Hey, wow another patch! Thanks Tobias! I' ll test it too. Here is my new patch. My first patch was stupid. Thanks to Sebb for his comments. I hope you test my new patch and contact me.
The existing API needs to be retained, in case any 3rd party add-ons have used it. It's OK to add new methods, or new method signatures, but the old ones must still work as before. Also, please ensure that patch files are uploaded as text, and don't contain unrelated changes.
Created attachment 21591 [details] Patch for CSVDataSet for independent file reading with Doku changes Hey, here is the full patch with API Doku changes. I hope this is what you wanted. If I forgot something or you have further questions please contact me. Best regards
Hello, is the patch ok or do I have to change anything? Please contact me if I can do something. Thanks
See also Bug 42178
Added options to restrict file sharing to thread group, thread etc URL: http://svn.apache.org/viewvc?rev=654944&view=rev Log: Bug 44418/42178 - CSV Dataset file handling improvements
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2072