AFAIK, there isn't a method to do a "readNext" on the CSV file.
Maybe using a BeanShell Post-Processor to simulate part of
the iterationStart method in CSVDataSet class is a way to solve it.
Code extracted from iterationStart method that is relevant to the question:
103 FileServer server = FileServer.getFileServer();
...
113 String _fileName = getFilename();
114 String mode = getShareMode();
115 int modeInt = CSVDataSetBeanInfo.getShareModeAsInt(mode);
116 switch(modeInt){
117 case CSVDataSetBeanInfo.SHARE_ALL:
118 alias = _fileName;
119 break;
120 case CSVDataSetBeanInfo.SHARE_GROUP:
121 alias =
_fileName+"@"+System.identityHashCode(context.getThreadGroup());
122 break;
123 case CSVDataSetBeanInfo.SHARE_THREAD:
124 alias =
_fileName+"@"+System.identityHashCode(context.getThread());
125 break;
126 default:
127 alias = _fileName+"@"+mode; // user-specified key
128 break;
129 }
...
149 if (getQuotedData()) {
150 lineValues = server.getParsedLine(alias, recycle,
firstLineIsNames, delim.charAt(0));
151 } else {
152 String line = server.readLine(alias, recycle,
firstLineIsNames);
153 lineValues = JOrphanUtils.split(line, delim, false);
154 }
With some aspects already known from CSV Dataset Config you could restrict
the code executed in BeanShell to a few lines.
2013/4/15 Shmuel Krakower <[email protected]>
> Hi all,
> The normal behavior of CSV dataset is to give us the next value with each
> iteration on the local thread. I.e. single thread test will get new value
> as new iteration begins.
>
> I have a need that with each time I reference the variable from the CSV
> config element, I'll get the next value.
> Maybe that's something silly easy, but I cannot find how to do that.
>
> Best,
>
> Shmuel Krakower.
> www.Beatsoo.org - re-use your jmeter scripts for application performance
> monitoring from worldwide locations for free.
>