Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

automating loadrunner start

by grashoper (Monk)
on Apr 22, 2009 at 20:34 UTC ( [id://759399]=perlquestion: print w/replies, xml ) Need Help??

grashoper has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to automate starting a loadrunner script but its not working as I would expect it to. I get a failed to start loadrunner message, even though the application does launch my call to sendkeys however fails, and it never runs my script,I really need this as I am trying to get this to restart on its own to monitor webservers for our custom application.
use Win32::GuiTest qw(FindWindowLike SetForegroundWindow SendKeys); use strict; my @argv=("E:\\MIBOR_TimingTest\\MIBOR\\MIBOR.usr"); system(@argv)==0 or die "Failed to execute Loadrunner"; sleep (600); my @whnds=FindWindowLike( undef,"^Mercury Virtual User Generator"); if (!@whnds){ die "Cannot find window with title/caption Mercury"; } else{ printf("Window handle of Mercury is %x\n", $whnds[0]); } sleep (60); SetForegroundWindow($whnds[0]); SendKeys("{F5}");

Replies are listed 'Best First'.
Re: automating loadrunner start
by runrig (Abbot) on Apr 22, 2009 at 21:00 UTC
    system won't return until the app is finished executing. Try:
    system(1, @argv);
    "1" as the first arg to system in windows says to run the app in the background and return immediately. Also, do you really want to sleep for 10 minutes after launching the app?

    Update: Oops. Yes, one, not zero.

      That should be 1 (one), not 0 (zero).
Re: automating loadrunner start
by almut (Canon) on Apr 22, 2009 at 20:52 UTC

    Maybe you could start to debug this by printing out a bit more info, e.g.

    system(@argv)==0 or die "Failed to execute Loadrunner (ret=$?): $^E";

    (If I'm understanding you correctly, "I get a failed to start loadrunner message" is referring to this error message...(?))

      I get this error failed to start loadrunner the system cannot find the file specified in gui.pl line 4 ret=256. I changed as follows and now I get a -1 (doesnt that mean its already running?)
      use Win32::GuiTest qw(WaitWindow FindWindowLike SetForegroundWindow Se +ndKeys); use strict; my @argv=("E:\\MIBOR_TimingTest\\MIBOR\\MIBOR.usr"); system(my @argv)==0 or die "Failed to execute Loadrunner (ret=$?): $^E +"; #sleep 600; my @whnds=FindWindowLike( undef,"^Mercury Virtual User Generator"); if (!@whnds){ die "Cannot find window with title/caption Mercury"; } else{ printf("Window handle of Mercury is %x\n", $whnds[0]); } SetForegroundWindow($whnds[0]); SendKeys("{F5}");
        my @argv=("E:\\MIBOR_TimingTest\\MIBOR\\MIBOR.usr"); system(my @argv)==0 or die "Failed to execute Loadrunner (ret=$?): $^E +";
        No, you do not want that second "my".
        cannot find the file specified in gui.pl line 4 ret=256

        $? being 256 simply means the program exited with a return code of 1 (i.e. $? >> 8) — see system for the details.

        Whatever that means... hopefully you can find more about the circumstances under which this happens in the LoadRunner docs.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://759399]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-19 03:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found