perl code to test my C based CGI application

Ask a Question related to PERL Miscellaneous, Design and Development.

  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. Similar Questions and Discussions

    1. How to do test for a Flex Application?
      Hello all: I'm trying to test a Flex App (a dynamic web project). Other than manual test, could please give me some advice? First I'm supposed...
    2. Application Center Test with IIS
      Please, I would like to stress test my webservice and i thought about Application Center Test, but i got no idea how can i do this. There's a...
    3. Application Center Test
      Hi everybody, I dont know if this is the best place for this question, but could not find any newsgroups for Microsoft's Application Center...
    4. 64 bit Perl memory test...
      I have been asked to get a 64bit version of Perl compiled and working under HP-UX 11i. I have found some helpful hints on actually compiling this...
    5. change cursor code to set based code
      INSERT INTO TableA (Col1, Col2...) SELECT Col1,Col2... FROM TableB -- Andrew J. Kelly SQL Server MVP
  3. #2

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

    chris <od488gw02@sneakemail.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

  4. #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

  5. #4

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

    Purl Gurl <purlgurl@purlgurl.net> wrote in message news:<3EFB529C.3C9EFFC1@purlgurl.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

  6. #5

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

    [email]od488gw02@sneakemail.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

  7. #6

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

    Purl Gurl <purlgurl@purlgurl.net> wrote in message news:<3EFC6C08.A07C140B@purlgurl.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

Posting Permissions

  • You may not post new threads
  • You may 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