rollno748 / Extended-csv-dataset-config

This plugin will enable Apache JMeter users to have similar parameter advantage as LoadRunner
MIT License
25 stars 7 forks source link

Last Data Row is not getting used, instead 2nd last is reused #16

Closed JamieQAC closed 3 months ago

JamieQAC commented 7 months ago

I was playing around with this today as I'm learning JMeter (but very familiar with LoadRunner) and glad to see something designed to handle the data like LR does, however I am encountering what appears to be a bug.

I setup a thread group with 3 threads and a loop count of 3. Initially I purposefully provided too few rows of data into the data file and wanted to see what it looked like when I altered the 'when out of values' but I noticed something strange, that my last row of data was not being reused, instead the 2nd last row was there twice.

So I updated the file to have exactly the number of rows needed (9 due to the 3x3) and tried again and still got the 2nd last row being reused. I did recall LR having an issue at one time if the data file didn't have a blank line, so tried with and without and still seeing same behavior. I ended up having to put 2 blank lines in my files end to get it to work. So there is a workaround I suppose, but in my mind It's a bug because I was using Unique and it reused a value. I varied the When out of values, and with abort thread i still got 2nd last row twice. I changed it to Continue cyclic and it was same, so based on this it doesn't seem to believe it's out of data (it's not).

For this example I'm just using a Java Request with the name - Java Request${user}${password}_${__threadNum}

And my CSV looks like: user,password jojo1,bean jojo2,bean jojo3,bean jojo4,bean jojo5,bean jojo6,bean jojo7,bean jojo8,bean jojo9,bean {this is a blank row - just putting the text here for clarification)

My config for the step is here image

And the result here shows thread 3 using jojo8 twice and never used jojo9.
image

If I left all other settings the same, but put 2 blank rows, then it worked correctly -> but 2 blank rows is really weird. Also to note, the behavior is same with 0 or 1 blank row at bottom of file.

rollno748 commented 7 months ago

Hey @JamieQAC

Thanks for bringing this up. It's definitely a bug. I have added this to the issue list. will fix it soon and release a newer version of this.

Meanwhile, please play around without and give me shout - if you find more. Thanks for helping !

rollno748 commented 6 months ago

Found that, it works well with JMeter-5.5 without any issues

image image The dot represent a new line present in the EOF image

image

rollno748 commented 6 months ago

Hello @JamieQAC I am trying to fix the issue - unfortunately, I am unable to replicate it today I tried with 5.6.2 version - it works well

image

Can you please try with the JMX file and let me know, if you still face the issues cred.csv

csv.txt

Please change the csv.txt to csv.jmx - as i am unable to upload the jmx file in here.

JamieQAC commented 6 months ago

Sorry for the delay responding, was away on some vacation and holidays. I was trying to compare what you have in your files and mine and I believe technically the bug is still existing, but you aren't seeing it in your results due to your setup.

You have the threads set to 3 and iterations to 4.
In your data file you are allocating 3 rows of the data file to each thread, and have it set to abort the thread when out of data.

Now really you can have whatever amount of data in the file, but probably it'd be typical that someone would put 12 rows (3 threads x 4 iterations), however you have the data file assigning 3 rows so maybe you do 9 rows (3 threads by 3 rows).

In any case what I see is that you have 10 rows of data plus a blank line, which is effectively the same as my original comment where I mentioned it worked with 2 blank rows.
If you remove your 10th data row (user10,password10), and leave only the single blank row you will get the thread3 user reusing user8-password8 instead of 7, 8, and 9.

image

rollno748 commented 6 months ago

I got your point.. thanks for explaining again @JamieQAC

When i run with 10 rows leaving last line blank - didn't cause any issue

Image

Image

But, When i keep the consider first line as variable to true - I see the issue getting replicated

Image

Image

rollno748 commented 5 months ago

Hello @JamieQAC

I have pushed the changes for the issue. Can you please validate the 2.1 version

You can obtain the jar from : https://github.com/rollno748/Extended-csv-dataset-config/releases/download/2.1/di-extended-csv-2.1.jar

Steps to apply:

  1. Download the jar from the above link
  2. Navigate to the \<JMeter installed directory>/lib/ext/
  3. Remove the older jar (di-extended-csv-2.0.jar)
  4. Paste the downloaded jar (di-extended-csv-2.1.jar)
  5. Restart the JMeter

Please let me know, if you need any further information.

JamieQAC commented 5 months ago

Tried it today and fix doesn’t seem to work as I expected. It still requires 2 extra rows to work properly. Ie if I have only up to user9 I get the blank params (which is also odd as the user is set to abort) Same if I have user10,password10, but if I add user11,password11 then the run looks correct (where I can see user9 in results) @.***

From: Mohamed Ibrahim @.> Sent: Thursday, January 4, 2024 5:38 PM To: rollno748/Extended-csv-dataset-config @.> Cc: James Samson @.>; Assign @.> Subject: Re: [rollno748/Extended-csv-dataset-config] Last Data Row is not getting used, instead 2nd last is reused (Issue #16)

EXTERNAL: Use caution with links and attachments.

Assigned #16https://github.com/rollno748/Extended-csv-dataset-config/issues/16 to @JamieQAChttps://github.com/JamieQAC.

— Reply to this email directly, view it on GitHubhttps://github.com/rollno748/Extended-csv-dataset-config/issues/16#event-11395628250, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BD5XMS6LPQGZLYUB2ESB2X3YM4VLXAVCNFSM6AAAAAA7VGJQXOVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJRGM4TKNRSHAZDKMA. You are receiving this because you were assigned.Message ID: @.**@.>>

rollno748 commented 5 months ago

The way this plugin is designed is to read each line and split the values using the delimiter and assign it to respective variables.

Technically when a thread fetches an empty line, it looks to split using the delimiter - since it's an empty line, I am assigning a null value to the variables

The concept here is, empty line != \<EOF>

When it hits EOF(End of file), it will abort as expected. If you are expecting to abort it for an empty line, then it would be a logical error.

Consider if you have 10 rows of records where the 5th row is an empty row.. it will abort the thread according to the logic you are expecting.

Maybe, I can create a logic to remove empty lines in the file, that would make it tedious

Pls let me know your view on this, Again thoughts are welcome.

JamieQAC commented 5 months ago

I’m not entirely sure we are following one another. I’ll try and explain my side below but first a couple comments.

-if the fifth row is empty -> they really should not be having empty lines in the middle of a CSV data file. -> in my logic, I wouldn’t expect it to abort due to line 5, but I’d expect it to error due to blank params.

Consider if we have 3 threads and set to allocate 3 rows to each thread (I’ll use excel here for better visualization of the CSV and where I show a blank row there is a physical blank row in the csv) I’d expect if we had this setup (1 blank row 11) that it should use all the data. Right now with this setup it will not use user9 @.***

If it worked on this file (no blank line at end) that’d be awesome but I wouldn’t expect it to work based on what I was previously used to in LoadRunner. @.***

Right now what I’m seeing is to make it work I need to do something like these examples. It’s only when I have at least 2 rows after user9 (blank or not) that it will even use user9. @.***

Not sure if that makes any more sense. But to me in previous build it was reusing user8 which it should never have done given that I had it set to abort. Well it should have used user9, but if for some reason couldn’t read it should have aborted. In new build, it’s almost like it’s skipping user9 to read the blank on the next row, however that doesn’t make sense either because when I put data like user10 it still did blank param. I had to physically have 2 extra rows like user10, user11 (although rows could have been blank) for it to ever use user9.

Jamie

From: Mohamed Ibrahim @.> Sent: Friday, January 5, 2024 1:40 PM To: rollno748/Extended-csv-dataset-config @.> Cc: James Samson @.>; Mention @.> Subject: Re: [rollno748/Extended-csv-dataset-config] Last Data Row is not getting used, instead 2nd last is reused (Issue #16)

EXTERNAL: Use caution with links and attachments.

The way this plugin is designed is to reach each line and split the variables according to the delimiter.

Technically when a thread fetches an empty line, it looks to split using the delimiter - since it's an empty line, I am assigning a null value to the variables

The concept here is, empty line !=

When it hits EOF(End of file), it will abort as expected. If you are expecting to abort it for an empty line, then it would be a logical error.

Consider if you have 10 rows of records where the 5th row is an empty row.. it will abort the thread according to the logic you are expecting.

Maybe, I can create a logic to remove empty lines in the file, that would make it tedious

Pls let me know you view on this, Again thoughts are welcome.

— Reply to this email directly, view it on GitHubhttps://github.com/rollno748/Extended-csv-dataset-config/issues/16#issuecomment-1879108123, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BD5XMSYZSVSLJWT4MY7GHLLYNBCJHAVCNFSM6AAAAAA7VGJQXOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZZGEYDQMJSGM. You are receiving this because you were mentioned.Message ID: @.**@.>>

JamieQAC commented 5 months ago

Looks like email responses don't allow the images to show up so hopefully this works better.. should be same as above but with the images.

I’m not entirely sure we are following one another. I’ll try and explain my side below but first a couple comments.

-if the fifth row is empty -> they really should not be having empty lines in the middle of a CSV data file. -> in my logic, I wouldn’t expect it to abort due to line 5, but I’d expect it to error due to blank params.

Consider if we have 3 threads and set to allocate 3 rows to each thread (I’ll use excel here for better visualization of the CSV and where I show a blank row there is a physical blank row in the csv) I’d expect if we had this setup (1 blank row 11) that it should use all the data. Right now with this setup it will not use user9

image

If it worked on this file (no blank line at end) that’d be awesome but I wouldn’t expect it to work based on what I was previously used to in LoadRunner.

image

Right now what I’m seeing is to make it work I need to do something like these examples. It’s only when I have at least 2 rows after user9 (blank or not) that it will even use user9.

image

Not sure if that makes any more sense. But to me in previous build it was reusing user8 which it should never have done given that I had it set to abort. Well it should have used user9, but if for some reason couldn’t read it should have aborted. In new build, it’s almost like it’s skipping user9 to read the blank on the next row, however that doesn’t make sense either because when I put data like user10 it still did blank param. I had to physically have 2 extra rows like user10, user11 (although rows could have been blank) for it to ever use user9.

Jamie

rollno748 commented 5 months ago

Hello @JamieQAC

Can you try this version and let me know - https://github.com/rollno748/Extended-csv-dataset-config/releases/download/2.1/di-extended-csv-2.1.jar

I will push the changes to plugins manager upon confirmation.

Thanks,

JamieQAC commented 5 months ago

I think I'd say this is working better but still not exactly as I expected. It appears to be handling the out of rows situation better (ie not running instead of running with blank params). But it's still needing 2 extra rows (can be blank rows) for it to use the last row. Maybe just add comments in the instructions for users to have at least 2 more rows than necessary.

rollno748 commented 3 months ago

Closing this issue