2

I would like to run load test of one of POST action in my web application. The problem is that the action can be completed only if it receives unique email address in POST data. I generated wcat script with few thousands requests each with unique email, like:

 transaction                        
  {                                  
    id = "1";     
    weight = 1;
    request 
    { 
        verb = POST; postdata = "Email=test546546546546%40loadtest.com&..."; 
        setheader { name="Content-Length"; value="..."; 
    } 
    // more requests like that
  }

My UBR settings file is like:

settings
{
    counters
    {
        interval = 10;
        counter = "Processor(_Total)\\% Processor Time";
        counter = "Processor(_Total)\\% Privileged Time";
        counter = "Processor(_Total)\\% User Time";
        counter = "Processor(_Total)\\Interrupts/sec";
    }
    clientfile     = "<above-wcat-script>";
    server         = "<host name>";
    clients        = 3;
    virtualclients = 100;
}

When I run the test 3x100 = 300 clients starts sending requests, but they are doing it in the same order so the first request from the first client is processed, and then the next 299 requests from other clients are not unique anymore. Then the second request from some client is processed, and 299 identical requests from other clients are not unique. I need a way to randomize the requests or run them in different order or set up separate scenario scripts for each virtual client so that each request carry unique email address. Is it possible to do that with WCAT?

Or maybe there is some other tool that can do such a test?

PanJanek
  • 6,593
  • 2
  • 34
  • 41

1 Answers1

3

Have you considered using the rand(x,y) WCAT internal function to add randomized integer to the email address? By doing so you could conceivably have a single transaction with single request that uses a randomized email address. So instead of manually creating (say) 1000 requests with unique email addresses, you can use the single randomized transaction 1000 times.

Your new randomized transaction might look something like this:

transaction                        
  {                                  
    id = "1";     
    weight = 1;
    request 
    { 
        verb = POST;
        postdata = "Email=" + rand("100000", "1000000") + "@loadtest.com&...";
        setheader { name="Content-Length"; value="...";
    } 
  } 

If using rand(x,y) doesn't make it random enough then you could experiment with using additional functions to make the data more random. Perhaps something like this:

postdata = "Email=" + rand("100000", "1000000") + "@loadtest" + clientindex() + vclientindex() + ".com&...";

You can find the WCAT 6.3 documentation here, including a list of the internal functions that are available. If the built in functions don't suffice, you can even build your own.

Vince Horst
  • 4,134
  • 1
  • 20
  • 33
  • 1
    Using rand(), clientindex() and vclientindex also did the trick for, with one small change; the numbers in rand() should be strings like this 'rand("100000", "1000000")'. For some reason it took me an hour to figure that out. – DJ van Wyk Mar 27 '14 at 14:00
  • @DJvanWyk, thanks for noticing the missing quotes in the rand() function. I've corrected the mistake in my answer. – Vince Horst Mar 27 '14 at 17:22