Bug 46491

Summary: Incorrect value for the last variable in "CSV Data Set Config" - when the value is empty
Product: JMeter - Now in Github Reporter: Yaroslav <slavko_h>
Component: MainAssignee: JMeter issues mailing list <issues>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 2.3.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Attachments: Data file
Test plan
Sample output
my cvs file
simple TestPlan

Description Yaroslav 2009-01-07 16:29:32 UTC
Use "CSV Data Set Config" element in your test-plan. Use there a few variables (3 or more) - assume there are {VAR1, VAR2, VAR3} (I'm using here "{ and }" for better explanation).
Create data file for it.
The first line has non-empty values - assume {1-1,1-2,1-3}.
The second line has {2-1,2-2,} where the third value is empty (I need like this TC).
So, when a thread is picking the second line from the CVS file - VAR3 value will be "1-3" (from previous line).

ER: VAR3 value is equal to value from the second line - in this case - empty(nothing).

The issue is valid only for the last variable in CVS file.
I'm trying also to use (Allow quoted data = True) in the CVS file like {2-1,2-2,""} and it does not help as well.
Comment 1 Sebb 2009-01-07 17:00:04 UTC
The second line needs to be

2-1,2-2

If you use

2-1,2-2,
or
2-1,2-2,""

then you are defining the 3rd column as the empty string.
Comment 2 Yaroslav 2009-01-09 09:30:18 UTC
Reopened

That what I need - I need to have third parameter as empty string, but the value is not empty, it is equal the value from the previous line.
Sorry, if the description is not clear.
Assume, that CVS file has description {VAR1,VAR2,VAR3} and data are like these:
1st line: {1-1,1-2,1-3}
2nd line: {2-1,2-2,} - third parameter is empty

AR(ActualResult): when 2nd line is processing ${VAR3} will be equal "1-3" (from previous line);
ER(ExpectedResult): for 2nd line - ${VAR3} is equal "" (empty string);

This is issue valid only for the last variable of CVS file.
Comment 3 Yaroslav 2009-01-23 16:08:50 UTC
Sorry for annoying...

What are you going to do with this bug?
Comment 4 Sebb 2009-01-24 05:09:18 UTC
Created attachment 23172 [details]
Data file
Comment 5 Sebb 2009-01-24 05:09:41 UTC
Created attachment 23173 [details]
Test plan
Comment 6 Sebb 2009-01-24 05:10:01 UTC
Created attachment 23174 [details]
Sample output
Comment 7 Sebb 2009-01-24 05:12:54 UTC
Works fine for me - see attached test plan etc.

If it does not work for you, please reopen and attach the simplest possible test plan that shows the problem, together with data file and sample output.
Comment 8 Yaroslav 2009-02-02 10:55:06 UTC
Created attachment 23213 [details]
my cvs file
Comment 9 Yaroslav 2009-02-02 11:01:44 UTC
Hi Sebb-2

I've attached simple "my cvs file" - 4 lines only.
When I do a printing by beanshell it show incorrect value for the last line.
Here is my beanshell script:
-------
print ("TC="+vars.get("TC") + "::" + "ID="+vars.get("ID") + "EmailGroup="+vars.get("EMAIL-GROUP") + "<>Password="+vars.get("PASSWORD") + "<>FirstName="+vars.get("FIRSTNAME") + "<>LastName=" + vars.get("LASTNAME") + "<>Position=" + vars.get("POSITION") + "<>");
-------

Here are test-result:
TC=SS-01-02-05::ID=aaa5EmailGroup=bluerealm.com<>Password=dadada<>FirstName=firs
tName<>LastName=                                  <>Position=5<>
TC=SS-01-02-06::ID=aaa6EmailGroup=bluerealm.com<>Password=dadada<>FirstName=firs
tName<>LastName=lastName<>Position=5<>
-------

ER: the last line is shown as:
TC=SS-01-02-06::ID=aaa6EmailGroup=bluerealm.com<>Password=dadada<>FirstName=firs
tName<>LastName=lastName<>Position=null<>

========

Comment 10 Yaroslav 2009-02-02 11:02:44 UTC
I've also attached "simple TestPlan"
Comment 11 Yaroslav 2009-02-02 11:03:38 UTC
Created attachment 23214 [details]
simple TestPlan
Comment 12 Sebb 2009-02-02 11:54:08 UTC
There is a subtle difference between the CSV Dataset settings in my test plan and yours - I put "Allow quoted data" = False, and you put True.

Try setting the value to False and see if that solves the problem. It does for me.

Of course, quoted data needs to behave the same as unquoted, so I'll investigate fixing that.
Comment 13 Yaroslav 2009-02-02 12:39:47 UTC
Yes, you are right.
"Quoted" flag is causing the problem, but even I've quoted the last field (like, {a,b,""}) with "quoted"=True - it will not help.

So, here are two "issues" (maybe related - I'm mean duplicated - this is just for myself when I a fix-verification will do):
1) "quoted" flag == True when data are non-quoted;
2) if the flag == True and data is quoted (all or partially) (like [a,b,""] or ["a","b",""] - it causes the problem as well;
Comment 14 Sebb 2009-02-02 12:55:37 UTC
Setting the "Allow quoted data flag" to true should not affect how *unquoted* data is treated. However at present the routine that processes quoted data doesn't handle a trailing delimiter correctly. I'm in the process of fixing that.

If your data is not quoted, then don't set Allow Quoted = true.

If your data is quoted, then you need to set Allow Quoted = true, but in that case you cannot set the last variable to empty, as the code treats {abc,} exactly the same as {abc,""}. This is a bug.



Comment 15 Sebb 2009-02-02 15:02:39 UTC
*** Bug 46651 has been marked as a duplicate of this bug. ***
Comment 16 Sebb 2009-02-02 17:39:11 UTC
Fixed in SVN in r740183:

URL: http://svn.apache.org/viewvc?rev=740183&view=rev
Log:
Bug 46491 - Incorrect value for the last variable in "CSV Data Set Config" (error in processing quoted strings)
Comment 17 The ASF infrastructure team 2022-09-24 20:37:42 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2189