You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by James Yu <cy...@gmail.com> on 2015/06/15 20:19:38 UTC
How to let each sample to read different line from CSV?
Hi all,
My test plan is like this:
Test plan
Thread group (loop = forever)
CSV data config (recycle on EOF = false, stop thread on EOF = true)
Simple controller
HTTP sampler1
HTTP sampler2
Result tree
I would like to have HTTP sample1 and HTTP sampler2 to read 1st and 2nd
line from my CSV file, So I would see only 2 entries in Result tree (one
from sampler1 and the other from sampler2).
However, what I get is both 1st and 2nd lines from my CSV are apply to HTTP
sampler1 and HTTP sampler2, which means I have 4 entries in Result tree
(two from sampler1 and the other two from sampler2).
How can I achieve my original goal that each line of CSV is used on one
sampler only?
Thank you.
This is a UTF-8 formatted mail
-----------------------------------------------
James C.-C.Yu
+886988713275
Re: How to let each sample to read different line from CSV?
Posted by Deepak Shetty <sh...@gmail.com>.
Hi
within the same iteration , the CSV Data Set config pointer will stay at
the same location in the file so what you see if expected . You have
different options
a) Change the structure of your CSV file so that a single line represents
the data for Sampler 1 and Sampler 2. So for e.g. if your CSV file is
Val1, Val2
Val3, Val4
Val5, Val6
val7, Val8
Then change your CSV file to be
Val1, Val2, Val3, Val4
Val5, Val6, Val7, Val8
You could do this as part of a setup thread group too.
b) Use CSVRead function (different drawbacks)-
http://jmeter.apache.org/usermanual/functions.html#__CSVRead or
StringFromFile (and parse the CSV string)
c) Use a loop controller to make the pointer go ahead - Add some
conditionals so that only particular samplers get executed .(so sampler1
gets executed for iteration 1 - skips samplers 2, next time sampler1 gets
skipped and sampler 2 gets executed but the CSV data set config is under
the loop controller so it will move which line you are reading
regards
deepak
On Mon, Jun 15, 2015 at 11:19 AM, James Yu <cy...@gmail.com> wrote:
> Hi all,
>
> My test plan is like this:
> Test plan
> Thread group (loop = forever)
> CSV data config (recycle on EOF = false, stop thread on EOF = true)
> Simple controller
> HTTP sampler1
> HTTP sampler2
> Result tree
>
> I would like to have HTTP sample1 and HTTP sampler2 to read 1st and 2nd
> line from my CSV file, So I would see only 2 entries in Result tree (one
> from sampler1 and the other from sampler2).
> However, what I get is both 1st and 2nd lines from my CSV are apply to HTTP
> sampler1 and HTTP sampler2, which means I have 4 entries in Result tree
> (two from sampler1 and the other two from sampler2).
>
> How can I achieve my original goal that each line of CSV is used on one
> sampler only?
>
> Thank you.
>
>
> This is a UTF-8 formatted mail
> -----------------------------------------------
> James C.-C.Yu
> +886988713275
>
Re: How to let each sample to read different line from CSV?
Posted by chaitanya bhatt <bh...@gmail.com>.
I vouch for Redis plugin:http://jmeter-plugins.org/wiki/RedisDataSet/
It can do wonders, which you can't dream of doing using the basic CSV
sampler. In your case, you need unique data per request, this use case
probably perfectly fits to the reason why Redis plugin was built.
Alternatively, if you are working with smaller data set you may also want
to try using __CSVRead() function, which offers a feature that lets to
pick the next line but I am not sure if it lets you get unique rows across
all the threads.
Thanks
Chaitanya M Bhatt
http://www.performancecompetence.com
On Mon, Jun 15, 2015 at 11:19 AM, James Yu <cy...@gmail.com> wrote:
> Hi all,
>
> My test plan is like this:
> Test plan
> Thread group (loop = forever)
> CSV data config (recycle on EOF = false, stop thread on EOF = true)
> Simple controller
> HTTP sampler1
> HTTP sampler2
> Result tree
>
> I would like to have HTTP sample1 and HTTP sampler2 to read 1st and 2nd
> line from my CSV file, So I would see only 2 entries in Result tree (one
> from sampler1 and the other from sampler2).
> However, what I get is both 1st and 2nd lines from my CSV are apply to HTTP
> sampler1 and HTTP sampler2, which means I have 4 entries in Result tree
> (two from sampler1 and the other two from sampler2).
>
> How can I achieve my original goal that each line of CSV is used on one
> sampler only?
>
> Thank you.
>
>
> This is a UTF-8 formatted mail
> -----------------------------------------------
> James C.-C.Yu
> +886988713275
>