Resource icon

System Command Example In Loadrunner 2017-12-05

No permission to download
  • perf-test.com need your contributions to build up a strong repository of performance engineering resources.

Attached is the sample loadrunner file

Example Description

In this example we are doing following activities via a loadrunner script

1. Create a direcotry named speforums in your C drive.
2. Execute a ping command and save it as a file inside c://speforums directory.


Sample code


Code:
    char filename[1024], command[1024];
  
    //define directory name
    char new_dir[] = "C:\\speforums";
  
    // Create a directory under root called xyz and make it the current dir
    if (mkdir(new_dir))
        lr_output_message ("Create directory %s failed", new_dir);
    else
        lr_output_message ("Created new directory %s", new_dir);
  
    //Define a filename
    sprintf(filename, "%s\\%s", new_dir, "pingfile_speforums.txt");
  
  
    // Execute a ping command and direct it to a new file
    sprintf(command, "ping speforums.com >> %s", filename);
    system(command);
    lr_output_message ("Created new file %s", filename);
Attached is the working script file.

Final Output:

upload_2017-12-5_23-12-2.png


Contents of the file:

upload_2017-12-5_23-13-5.png
  • upload_2017-12-5_23-13-8.png
    upload_2017-12-5_23-13-8.png
    27.4 KB · Views: 422
Author
admin
Downloads
0
Views
66
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from admin