Closed asfimport closed 12 years ago
@pmouawad (migrated from Bugzilla): Created attachment Capture d’écran 2011-12-04 à 11.37.40.png: Run result
@pmouawad (migrated from Bugzilla): Created attachment Archive.zip: Test data
@pmouawad (migrated from Bugzilla): (In reply to comment 0)
Created attachment 28023 [details] Test plan
I think there is an issue in StringFromFile function. In the docs and javadocs it is said that:
- JMeter instantiates a copy of each function for every reference in a Sampler or elsewhere; each instance will open its own copy of the the file
This part is OK in fact, I mixed up Thread and multiple usage
But debugging the attached Test Case , I see only one instance of StringFromFile shared by the 3 threads. So this leads to a buggy result. Expected result shoud be that each time threadNum should match file Num (not the case) And each file should be read, depending on execution some files are not read at all.
The issue is more in Synchronisation as described in Test Plan
Sebb (migrated from Bugzilla): Function references are only instantiated once per occurrence in the test Plan.
So if a sampler references StringFromFile, all threads will use the same instance of the function.
This allows the same data file to be shared between threads.
The file is opened once, on the first reference, so will use whatever thread number happens to run the first sample.
This is similar to how the global counter (IterationCounter) works.
StringFromFile was designed to share the data across threads.
CSV Dataset can be used for per-thread data files.
It would be possible to implement a per-thread version of StringFromFile by using ThreadLocal storage for the file details. However I'm not sure there's a good use case for it, given that we already have CSV Dataset.
I'll update the Javadoc and function desc.
Sebb (migrated from Bugzilla): Docs updated.
URL: http://svn.apache.org/viewvc?rev=1212996&view=rev Log: Clarify docs (https://github.com/apache/jmeter/issues/2670)
Modified: jmeter/trunk/src/functions/org/apache/jmeter/functions/StringFromFile.java jmeter/trunk/xdocs/usermanual/functions.xml
@pmouawad (Bug 52284): I think there is an issue in StringFromFile function. In the docs and javadocs it is said that:
But debugging the attached Test Case , I see only one instance of StringFromFile shared by the 3 threads. So this leads to a buggy result. Expected result shoud be that each time threadNum should match file Num (not the case) And each file should be read, depending on execution some files are not read at all.
Created attachment TestFunction.jmx: Test plan
TestFunction.jmx
````xmltrue
OS: All