Performance Testing, LoadRunner Tips&Tricks

This site is moving to a bigger space @ LoadRunner TnT

Scripts: Duplicating Files on the Fly

There is another method of duplicating on the fly in the Vugen script. Below is the extracted script of the Action block.

Action()
{
char command[100];

sprintf(command, "copy C:\\source_dir\\srcFile.txt C:\\source_dir\\srcFile-%s.txt", lr_eval_string ("{iteration_number}"));

system(command);

/*all other codes ... */

sprintf(command, "del C:\\source_dir\\srcFile-%s.txt", lr_eval_string ("{iteration_number}"));

system(command);

return 0;
}


An explanation of the codes:

The script will be running on the system API on LoadRunner. For more information of the system API, you can refer to the Function Reference available in Vugen.



What the code does is as followed:


1. Declare a string to store the command for execution.

2. Define the parameter "iteration_number" in the Parameters setting. (refer to Fig 1 below).



Fig 1




3. Build the command string create the duplicate file before all other APIs are called.

4. Execute the command string to create duplicate file.

5. Proceed with the other APIs (either recorded or manually script) as per user requirement.

6. Build the command string to delete the duplicated file.

7. Execute the command string to delete the duplicated file.


Set the iterations as per norm to the number of files for the user requirements.


In this approach, it is more neater to than as my preivous post on Tools: Duplicating Files prior Load Test.



Labels: , , , , , , , , , , , , ,


Bookmark this article now! AddThis Social Bookmark Button



technorati del.icio.us reddit digg

0 Responses to “Scripts: Duplicating Files on the Fly”

Post a Comment


Powered by Google

Enter your email address:

Delivered by FeedBurner


Add to Technorati Favorites


XML

Powered by Blogger

make money online blogger templates

Powered by FeedBurner

Blog Directory

Top Blogs

Software Blogs -  Blog Catalog Blog Directory





© 2007 Performance Testing, LoadRunner Tips&Tricks | Blogger Templates by GeckoandFly.
No part of the content or the blog may be reproduced without prior written permission.
Learn how to make money online | First Aid and Health Information at Medical Health