You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by rajendra_sakpal <ra...@persistent.co.in> on 2007/05/31 09:48:41 UTC

Problem reading value of a test parameter from a data file.

Hi,

 

I am trying to create a data driven test in JMETER using the instructions on
http://wiki.apache.org/jakarta-jmeter/JMeterFAQ#head-87f846dad28fd6b2ad5eb0d
44d527d572f810653 under the question "How do I use external data files to in
my Test scripts?".

 

1-       I am not clear with the format for specifying value of the
parameter when using the "User Parameters" preprocessor.  I have given value
the parameter "fName" as "${_StringFromFile(user.dat)}".  Is the format for
specifying value of the parameter correct? However, JMETER doesn't attempt
to read from the data file user.dat. As a result, data posted for my
subsequent request is evaluated as firstName=${fName}.  The ${fName} is not
getting substituted by the value in the data file. Is _StringFromFile a
JMETER function that is invoked to read the data from the mentioned file?

 

2-       I have specified the data in "user.dat" with the first line reading
as FNAME & subsequent lines have values in it.  Is the data file format
correct?

 

What could be the problem?

 

Thanks in advance,

Rajendra

 

 

 


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

RE: Problem reading value of a test parameter from a data file.

Posted by Anjaneyulu Aerrolla <aa...@sapient.com>.
 _StringFromFile each time it's called it reads next line from the file,
So have a file with firstName,lastName in one line with some separator
then use the __split function to get firstName and lastName

e.g  if the content of user.dat are

lName1|fName1
lName2|fName2
lName3|fName3

then you can have 
name=${_StringFromFile(user.dat,name)}
VAR=${__split($name,VAR,|)}
${VAR_1} will  give you  lastName
And ${VAR_2} will  give firatName

OR

Use CSV Data set Config



Thanks 

_________________________________________________________

Anjan | Associate Technology | Sapient | Bangalore, India

aaerrolla@sapient.com | +91 80 41047003 (work) | +91 9886619293 (cell)


-----Original Message-----
From: rajendra_sakpal [mailto:rajendra_sakpal@persistent.co.in] 
Sent: Thursday, May 31, 2007 1:19 PM
To: jmeter-user@jakarta.apache.org
Cc: 'rajendra_sakpal'
Subject: Problem reading value of a test parameter from a data file.

Hi,

 

I am trying to create a data driven test in JMETER using the
instructions on
http://wiki.apache.org/jakarta-jmeter/JMeterFAQ#head-87f846dad28fd6b2ad5
eb0d
44d527d572f810653 under the question "How do I use external data files
to in
my Test scripts?".

 

1-       I am not clear with the format for specifying value of the
parameter when using the "User Parameters" preprocessor.  I have given
value
the parameter "fName" as "${_StringFromFile(user.dat)}".  Is the format
for
specifying value of the parameter correct? However, JMETER doesn't
attempt
to read from the data file user.dat. As a result, data posted for my
subsequent request is evaluated as firstName=${fName}.  The ${fName} is
not
getting substituted by the value in the data file. Is _StringFromFile a
JMETER function that is invoked to read the data from the mentioned
file?

 

2-       I have specified the data in "user.dat" with the first line
reading
as FNAME & subsequent lines have values in it.  Is the data file format
correct?

 

What could be the problem?

 

Thanks in advance,

Rajendra

 

 

 


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is
the property of Persistent Systems Pvt. Ltd. It is intended only for the
use of the individual or entity to which it is addressed. If you are not
the intended recipient, you are not authorized to read, retain, copy,
print, distribute or use this message. If you have received this
communication in error, please notify the sender and delete all copies
of this message. Persistent Systems Pvt. Ltd. does not accept any
liability for virus infected mails.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


RE: Problem reading value of a test parameter from a data file.

Posted by Matthew Coventon <ma...@iseinc.biz>.
I think it is better to use the CSV Data Set Config element.  There you
specify the filename, variable names, etc.  Then you just use the variables
in your test plan and the CSV Data Set Config takes care of reading the next
line for you.

Regards,

Matt C.

-----Original Message-----
From: rajendra_sakpal [mailto:rajendra_sakpal@persistent.co.in] 
Sent: Thursday, May 31, 2007 2:49 AM
To: jmeter-user@jakarta.apache.org
Cc: 'rajendra_sakpal'
Subject: Problem reading value of a test parameter from a data file.

Hi,

 

I am trying to create a data driven test in JMETER using the instructions on
http://wiki.apache.org/jakarta-jmeter/JMeterFAQ#head-87f846dad28fd6b2ad5eb0d
44d527d572f810653 under the question "How do I use external data files to in
my Test scripts?".

 

1-       I am not clear with the format for specifying value of the
parameter when using the "User Parameters" preprocessor.  I have given value
the parameter "fName" as "${_StringFromFile(user.dat)}".  Is the format for
specifying value of the parameter correct? However, JMETER doesn't attempt
to read from the data file user.dat. As a result, data posted for my
subsequent request is evaluated as firstName=${fName}.  The ${fName} is not
getting substituted by the value in the data file. Is _StringFromFile a
JMETER function that is invoked to read the data from the mentioned file?

 

2-       I have specified the data in "user.dat" with the first line reading
as FNAME & subsequent lines have values in it.  Is the data file format
correct?

 

What could be the problem?

 

Thanks in advance,

Rajendra

 

 

 


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the
property of Persistent Systems Pvt. Ltd. It is intended only for the use of
the individual or entity to which it is addressed. If you are not the
intended recipient, you are not authorized to read, retain, copy, print,
distribute or use this message. If you have received this communication in
error, please notify the sender and delete all copies of this message.
Persistent Systems Pvt. Ltd. does not accept any liability for virus
infected mails.



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org