-1

I'm trying to log certain system commands while a script is running. For example:

Action() {
    // .....
    system("ipconfig > test_output.txt");
    // .....
} 

When Vugen runs the script, it places the output within the script folder.

However, the output seems to be missing when the Controller runs the script within a scenario. It's neither in the results folder nor in the script folder.

Where does the Controller place the output of system commands?

Pacerier
  • 86,231
  • 106
  • 366
  • 634
  • 1
    Be careful. Depending upon the number of users running and the configuration of your load generator you stand a chance at turning your local filesystem into a bottleneck for your test as you have tens/dozens/hundreds of users contending for rights to the read/write heads of your drive – James Pulley Jan 08 '15 at 21:11
  • @JamesPulley, Good point. (In the meanwhile just needed it to do some "hacky" tests.) – Pacerier Jan 09 '15 at 03:37

2 Answers2

2

There are two options:

1) The script is located on the same machine as the LG (for example if LG is localhost) - in this case the file is created in the directory of the script as it would be in VuGen.

2) The script is not on the same machine as the LG - in this case the script is in [LG temp directory]/netdir/[path similar to the path of the script on origin machine]

For example if the script is in c:\scripts\myScript it will be in something like: C:\Users\monkeyman\AppData\Local\Temp\brr_mJf.262\netdir\c\scripts\myScript

You can find out what is the temp directory of the LG by going to the LG properties in the controller.

Buzzy
  • 2,905
  • 3
  • 22
  • 31
  • I have many of these `brr` folders, e.g. `brr_Wqp.301`, `brr_Uxf.642`, `brr_n0O.946`, `brr_lA5.324`. Is it **safe** to delete them after a scenario run or would the Controller expect them to be kept for as long as the `Scenario.lrs` file is kept? – Pacerier Jan 08 '15 at 09:51
  • Since they are in the Temp folder I believe they are copied there each time the test runs (unless same machine). – Buzzy Jan 08 '15 at 11:58
  • Hi Buzzy, do you mind helping with http://sqa.stackexchange.com/questions/13299/how-to-show-transaction-response-time-graph-in-loadrunner-controller – Pacerier Jun 16 '15 at 09:39
  • @Pacerier, sorry but I left the LoadRunner team and now someone else answers SO questions. At the top of my head I don't know the answer and I no longer have access to any LR resources. – Buzzy Jun 16 '15 at 13:59
  • Thanks anyway. Btw, when you say "now someone else answers SO question", do you mean that HP actually assign people to answer LR questions on stackoverflow and http://sqa.stackexchange.com? – Pacerier Jun 18 '15 at 15:37
  • @Pacerier I can't say about all of HP but in the LoadRunner team we care about our customers and want to help them in the media they chose. We are not "assigned" to do it, we want to do it. To avoid duplication, we usually had someone get all the notifications from a specific media and then distribute the question to the appropriate team member. As I mentioned, I left the LoadRunner team so now someone else gets the notifications for all the new questions. – Buzzy Jun 19 '15 at 16:40
  • Interesting. By "specific media" are you referring to Stackoverflow and HP-LR forums? What about the other major sqa sites like [sqa.SE](http://sqa.stackexchange.com/) and [sqaforums.com](http://www.sqaforums.com/forums/forum.php)? – Pacerier Jul 02 '15 at 12:42
1

You can get the output of a command executed, to a variable or even to replay log. In Loadrunner "System" command just executes the command mentioned but does not wait for the command to complete. Try "popen" command which returns the output of the command.

For Eg: system("ipconfig > test_output.txt"); this may not work, instead try this:

char buf[256];
long ls = popen("ipconfig", "r");
while (fgets(buf, sizeof(buf), ls) != 0) 
{   
  // You can save this to a variable using strcat
  lr_message("%s",buf);   // will print the output of the command in the replay log
}
    pclose(ls);

Note: You can also try using popen("ipconfig > test_output.txt", "r");

Karthick PKa
  • 114
  • 6