Professional Web Applications Themes

perl code to test my C based CGI application - PERL Miscellaneous

Already tried cgi newsgroup to no avail. I'm a Perl begginner, and it's starting to look like Perl is the best way to do this. I have a C based CGI executable that receives a single arguement via HTTP POST method as follows: <form method="POST" action="http://mypc-01/scripts/MyCGI.exe" name="postToCGI"> I'd like to load test it by creating a Perl script that simply calls it with same argument over and over and over. How can I do this? thanks. chris...

  1. #1

    Default perl code to test my C based CGI application

    Already tried cgi newsgroup to no avail.

    I'm a Perl begginner, and it's starting to look like Perl is the best
    way to do this. I have a C based CGI executable that receives a single
    arguement via HTTP POST method as follows:

    <form method="POST" action="http://mypc-01/scripts/MyCGI.exe"
    name="postToCGI">

    I'd like to load test it by creating a Perl script that simply calls
    it with same argument over and over and over. How can I do this?

    thanks.

    chris
    chris Guest

  2. #2

    Default Re: perl code to test my C based CGI application

    chris <od488gw02sneakemail.com> wrote:

    [a CGI program written in C]
    > I'd like to load test it by creating a Perl script that simply
    > calls it with same argument over and over and over. How can I do
    > this?
    See

    perldoc lwpcook

    It has examples that should get you started.
    David K. Wall Guest

  3. #3

    Default Re: perl code to test my C based CGI application

    chris wrote:
    > I'm a Perl begginner, and it's starting to look like Perl is the best
    > way to do this. I have a C based CGI executable that receives a single
    > arguement via HTTP POST method as follows:
    Are you a beg-ginner or a beginner?

    "argument"

    > <form method="POST" action="http://mypc-01/scripts/MyCGI.exe" name="postToCGI">
    > I'd like to load test it by creating a Perl script that simply calls
    > it with same argument over and over and over. How can I do this?
    [url]http://stein.cshl.org/~lstein/torture/torture.html[/url]


    Purl Gurl
    --
    "This is Usenet, not a classroom. Get over it....little boy."
    - Elaine Ashton
    Purl Gurl Guest

  4. #4

    Default Re: perl code to test my C based CGI application

    Purl Gurl <purlgurlpurlgurl.net> wrote in message news:<3EFB529C.3C9EFFC1purlgurl.net>...
    > chris wrote:
    >
    > > I'm a Perl begginner, and it's starting to look like Perl is the best
    > > way to do this. I have a C based CGI executable that receives a single
    > > arguement via HTTP POST method as follows:
    >
    > Are you a beg-ginner or a beginner?
    >
    > "argument"
    >
    >
    > > <form method="POST" action="http://mypc-01/scripts/MyCGI.exe" name="postToCGI">
    >
    > > I'd like to load test it by creating a Perl script that simply calls
    > > it with same argument over and over and over. How can I do this?
    >
    > [url]http://stein.cshl.org/~lstein/torture/torture.html[/url]
    >
    >
    > Purl Gurl
    Spell correcting in a newsgroup? yikes.

    Thanks everyone. I found a nice example by Jason Mathews and modified a bit:

    #!/bin/perl
    # based on sample script by Jason Mathews 28-March-1996

    for ($count=1; $count < 11; $count++)
    {
    $ENV{'GATEWAY_INTERFACE'} = "CGI/1.1";
    $ENV{'SCRIPT_NAME'} = "C:/Inetpub/Scripts/MyCGIUtility.exe";
    $ENV{'SERVER_PROTOCOL'} = "HTTP/1.0";

    #
    # Set all environment variables that are referenced in your
    # CGI program. For example, only REQUEST_METHOD, QUERY_STRING,
    # and CONTENT_LENGTH are referenced in the dump.cgi program.
    ################################################## #####################

    $| = 1;

    # CGI form input

    $cgi_input = 'acctid=501020000246';

    #
    # POST method
    #

    print "----------------------------------------------------\n";
    print "simulating a POST method:\n";

    # Setup environment

    $ENV{'REQUEST_METHOD'} = "POST";
    $ENV{'CONTENT_LENGTH'} = length($cgi_input);
    $ENV{'CONTENT_TYPE'} = "application/x-www-form-urlencoded";

    open(PIPE, "| MyCGIUtility.exe");
    print PIPE $cgi_input;
    close(PIPE);

    } # end for

    chris
    chris Guest

  5. #5

    Default Re: perl code to test my C based CGI application

    [email]od488gw02sneakemail.com[/email] (chris) writes:
    > Thanks everyone. I found a nice example by Jason Mathews and modified a bit:
    <snip>

    I guess it depends on what you're testing. What you did will test the
    program, but outside its normal execution environment
    (Webserver+CGI). You're essentially simulating a CGI environment, and
    then testing. This isn't a big problem, but you need to also test it
    in a real CGI environment, as you always have the risk that your
    simulation isn't necessarily good enough.

    -=Eric
    --
    Come to think of it, there are already a million monkeys on a million
    typewriters, and Usenet is NOTHING like Shakespeare.
    -- Blair Houghton.
    Eric Schwartz Guest

  6. #6

    Default Re: perl code to test my C based CGI application

    Purl Gurl <purlgurlpurlgurl.net> wrote in message news:<3EFC6C08.A07C140Bpurlgurl.net>...
    > chris wrote:
    >
    > > Purl Gurl wrote:
    > > > chris wrote:
    >
    > > > > I'm a Perl begginner, and it's starting to look like Perl is the best
    > > > > way to do this. I have a C based CGI executable that receives a single
    > > > > arguement via HTTP POST method as follows:
    >
    > > > Are you a beg-ginner or a beginner?
    >
    > > > "argument"
    >
    > > Spell correcting in a newsgroup? yikes.
    >
    > My presumption is you do not care to improve your spelling skills,
    > which is often a reason for poor spelling skills.
    >
    >
    > > > > I'd like to load test it by creating a Perl script that simply calls
    > > > > it with same argument over and over and over. How can I do this?
    >
    > > > [url]http://stein.cshl.org/~lstein/torture/torture.html[/url]
    >
    >
    > > I found a nice example by Jason Mathews and modified a bit:
    >
    > Yours is a nice example, although inefficient. It does not load
    > test your software, however.
    >
    > A single iteration of your example code is no different than eleven
    > iterations. Either your program works right or it doesn't. Your
    > efficiency would be greatly improved by moving your environment
    > variables outside your looping mechanism; no need to set those
    > variables eleven times. Same is true for your $| flushing. This
    > only needs to be set once. A simple system() call would be quicker
    > than opening a filehandle.
    >
    > Nice example which could be improved significantly, keeping in
    > mind your example does not load test.
    >
    >
    > Purl Gurl
    Thanks. I moved all my env vars and flushing outside the loop now.

    I plan to run this script from 10 different client boxes at the same
    time, that will all be hitting the CGI server, so I think it will give
    me somehwhat of a load test. I suppose it's more of a performance
    test.

    chris
    chris Guest

Similar Threads

  1. How to do test for a Flex Application?
    By yeo_31 in forum Macromedia Flex General Discussion
    Replies: 3
    Last Post: May 11th, 01:29 PM
  2. Application Center Test with IIS
    By Fabiano in forum ASP.NET Web Services
    Replies: 1
    Last Post: June 7th, 07:39 PM
  3. Application Center Test
    By Maximus in forum ASP.NET Web Services
    Replies: 0
    Last Post: December 10th, 07:12 PM
  4. Test & Training Application
    By A.M in forum ASP Components
    Replies: 5
    Last Post: July 28th, 07:55 PM
  5. change cursor code to set based code
    By Andrew J. Kelly in forum Microsoft SQL / MS SQL Server
    Replies: 1
    Last Post: July 8th, 02:15 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139