Parameterizing a file path

449 views
Skip to first unread message

Anand Rao

unread,
Jul 19, 2011, 3:41:57 AM7/19/11
to LoadRunner
Dear LR experts,

Greetings..!

Recently, I have come across an issue of parameterizing a file path.
In the system being tested, one flow is like one user logs into the
system, performs some actions and the attaches any type of documents
(like, .doc, .jpg, .txt, etc.). The script runs successfully for one
user and would also run for many users provided that they attach the
same document that is recorded in the VuGen Script.

My query is how can I make every user to select an unique document and
attach it...? How can I parameterize the path of the file..?

Following is the snippet of the code from VuGen Script.

"Name=issueAttach.wrkflwstepconfigId", "Value=33", ENDITEM,
"Name=issueAttach.issueNumber", "Value={WCSParam_Diff2}", ENDITEM,
"Name=issueAttach.associatedStep", "Value=Test_BW2Definition",
ENDITEM,
"Name=issueAttach.memoId", "Value=", ENDITEM,
"Name=workflowId", "Value=0", ENDITEM,
"Name=issueAttach.urlattachTyp", "Value=false", ENDITEM,
"Name=userImage", "Value=C:\\\\Anand\\\\horse.jpg", "File=Yes",
ENDITEM,
"Name=issueAttach.attachmenttitle", "Value=", ENDITEM,
LAST);

Please help. Awaiting suggestions.

Thank and Regards,

Anand Rao

James Pulley

unread,
Jul 19, 2011, 9:06:59 AM7/19/11
to LoadRunner
Using your programming skills create a file of random name and random
length (within your defined bounds) within your virtual user
subdirectory. Upload This file. Then, as part of cleanup, delete
the file. You will no longer have to worry then about location for
the file

"Name=userImage", "Value=random_name.ext",
"File=Yes",

And you will no longer have to worry about pre-staging files in a
directory which is commonly accessible from your load
generator(s). It is not recommended that you combine this model
with anything other than logging when an error occurs as you will be
introducing extra stress to the file system with the consistent writes
and deletes. Intelligent disk subsystems recommended, RAID/FCAL
encouraged on the generators.

See fopen(), fprintf(), rand() for inspiration

James Pulley, http://www.loadrunnerbythehour.com/PricingMatrix

Anand Rao

unread,
Jul 28, 2011, 4:35:26 AM7/28/11
to LoadRunner
Hey James,

Thanks a ton for your kind reply.
I tried doing it but no luck as I'm not a programmer (just a basic
knowledge of programming). But from your suggestion what I did is :
1. I parameterized the file path C:\\\\Anand\\\\horse.jpg.
2. In that parameter file I mentioned the 100 different type of
documents to be picked up and uploaded by the user.
3. I stored those documents under the directory as mentioned above.
4. The script runs fine for each iteration (meaning different file is
uploaded on each iteration)

I have not taken the test with controller yet. So now the question
is :
As each LG will have the local copy of the script, would each VUser
pick up the file to upload from the controller..?

I seek your healthy reply on this.

Thanks again.

Anand Rao

On Jul 19, 6:06 pm, James Pulley <loadrunner-li...@jamespulley.com>
wrote:
> Using your programming skills create a file of random name and random
> length (within your defined bounds) within your virtual user
> subdirectory.   Upload This file.  Then, as part of cleanup, delete
> the file.   You will no longer have to worry then about location for
> the file
>
>                 "Name=userImage", "Value=random_name.ext",
> "File=Yes",
>
> And you will no longer have to worry about pre-staging files in a
> directory which is commonly accessible from your load
> generator(s).     It is not recommended that you combine this model
> with anything other than logging when an error occurs as you will be
> introducing extra stress to the file system with the consistent writes
> and deletes.   Intelligent disk subsystems recommended, RAID/FCAL
> encouraged on the generators.
>
> See fopen(), fprintf(), rand() for inspiration
>
> James Pulley,http://www.loadrunnerbythehour.com/PricingMatrix

James Pulley

unread,
Jul 28, 2011, 7:05:26 AM7/28/11
to lr-loa...@googlegroups.com
Files would need to be local in context to the execution of the virtual
user, so all of your files will need to be copied to the load generators and
the c:\anand\ subdirectory

Hey James,

Thanks again.

Anand Rao

--
You received this message because you are subscribed to the Google
"LoadRunner" group.
To post to this group, send email to LR-Loa...@googlegroups.com
To unsubscribe from this group, send email to
LR-LoadRunne...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/LR-LoadRunner?hl=en

Isaí Azael Villarreal

unread,
Jul 28, 2011, 6:45:12 PM7/28/11
to LoadRunner


That seems to be a quite fair approach and should work with no
problem.

Just make sure Load generatos have those files at the path you are
using.. you can randomize paths as well as files in order to make look
your test more real.

Cheers!

Anand Rao

unread,
Jul 29, 2011, 6:03:01 AM7/29/11
to LoadRunner
Thanks a lot James and Isai..!

Cheers!

Anand Rao

On Jul 29, 3:45 am, Isaí Azael Villarreal <azaelvillarr...@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages