apache / jmeter

Apache JMeter open-source load testing tool for analyzing and measuring the performance of a variety of services
https://jmeter.apache.org/
Apache License 2.0
8.11k stars 2.06k forks source link

Incorrect value for the last variable in "CSV Data Set Config" - when the value is empty #2189

Closed asfimport closed 15 years ago

asfimport commented 15 years ago

Yaroslav (Bug 46491): 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.

Severity: normal OS: Windows XP

Duplicates:

asfimport commented 15 years ago

Sebb (migrated from Bugzilla): 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.

asfimport commented 15 years ago

Yaroslav (migrated from Bugzilla): 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.

asfimport commented 15 years ago

Yaroslav (migrated from Bugzilla): Sorry for annoying...

What are you going to do with this bug?

asfimport commented 15 years ago

Sebb (migrated from Bugzilla): Created attachment csv46491.csv: Data file

csv46491.csv ```` 1-1,1-2,1-3 2-1,2-2 3-1,,3-3````
asfimport commented 15 years ago

Sebb (migrated from Bugzilla): Created attachment csv46491.jmx: Test plan

csv46491.jmx ````xml false false false 4 1 1 1232802288000 1232802288000 false continue , csv46491.csv false true All threads false A,B,C Sleep_Time 100 = Sleep_Mask 0xFF = Label A=${A} B=${B} C=${C} = ResponseCode = ResponseMessage = Status OK = SamplerData = ResultData = org.apache.jmeter.protocol.java.test.JavaTest false saveConfig true true true true true true true false true true false false false false false false false false 0 true csv46491.jtl ````
asfimport commented 15 years ago

Sebb (migrated from Bugzilla): Created attachment csv46491.jtl: Sample output

csv46491.jtl ````csv 1232802434913,266,A=1-1 B=1-2 C=1-3,,,Thread Group 1-1,,true,0,0 1232802435226,312,A=2-1 B=2-2 C=1-3,,,Thread Group 1-1,,true,0,0 1232802435538,110,A=3-1 B= C=3-3,,,Thread Group 1-1,,true,0,0 1232802435648,218,A=1-1 B=1-2 C=1-3,,,Thread Group 1-1,,true,0,0 ````
asfimport commented 15 years ago

Sebb (migrated from Bugzilla): 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.

asfimport commented 15 years ago

Yaroslav (migrated from Bugzilla): Created attachment testcsv.txt: my cvs file

testcsv.txt ```` #,TC,ID,EMAIL-GROUP,PASSWORD,FIRSTNAME,LASTNAME,POSITION SS-01-02-05,aaa5,bluerealm.com,dadada,firstName, ,5 #,Invalid Position SS-01-02-06,aaa6,bluerealm.com,dadada,firstName,lastName, ````
asfimport commented 15 years ago

Yaroslav (migrated from Bugzilla): 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<>

========

asfimport commented 15 years ago

Yaroslav (migrated from Bugzilla): I've also attached "simple TestPlan"

asfimport commented 15 years ago

Yaroslav (migrated from Bugzilla): Created attachment TestCVS.jmx: simple TestPlan

TestCVS.jmx ````xml false false storeshop3.qa.bluerealm.com , testcsv.txt true false All threads true TC,ID,EMAIL-GROUP,PASSWORD,FIRSTNAME,LASTNAME,POSITION false -1 1 1 1229016075000 1229016075000 false continue "${TC}" != "#" false 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") + "<>"); true false saveConfig true true true true true true true false true true false false true false false false false false 0 true ````
asfimport commented 15 years ago

Sebb (migrated from Bugzilla): 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.

asfimport commented 15 years ago

Yaroslav (migrated from Bugzilla): 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;

asfimport commented 15 years ago

Sebb (migrated from Bugzilla): 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.

asfimport commented 15 years ago

Sebb (migrated from Bugzilla): Fixed in SVN in r740183:

URL: http://svn.apache.org/viewvc?rev=740183&view=rev Log: https://github.com/apache/jmeter/issues/2189 - Incorrect value for the last variable in "CSV Data Set Config" (error in processing quoted strings)