Resource icon
  • perf-test.com need your contributions to build up a strong repository of performance engineering resources.

Writing a file is an important operation in loadrunner and this can be put into a verity of uses. The file writing code is a must have in your artillery and is very simple to implement. The file writing can be used for
  • Data Validations
  • Capturing Valid Data from front-end
  • Logging something

Example 1: Writing a parameter data into file

Following code writes values of a parameter into a file, before trying this out please create a folder "trail" in c drive
Code:
int fp;      
//open a file
fp=fopen("c:\\trail\\example1.txt","a+"); 
//capture parameter and write into file
fputs(lr_eval_string("SPEForumsAdmins}"),fp);
//Add new line
fputs("\n",fp);
//close and flush
fclose(fp);

You can make above piece of code as a loadrunner function and call it using your test scripts easily from anywhere

Please refer to example 2 : http://www.speforums.com/resources/defining-and-calling-functions-in-loadrunner-vugen.46/
Author
anmoldubey
Views
73
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from anmoldubey