Forum Discussion

tarleaa's avatar
tarleaa
Contributor
15 years ago

Warning in LoadTest

Hello, 


I've created a load test and a script based on the example from the Help files. Here is the script modified so that every Virtual User logs in with it's own credentials on a web page.


var VirtualUsers = new Array();



var Logins = Array([VirtualUsers]); // username

var Passwords = Array([VirtualUsers]); // password



function MMUS_HomePage_ModifiedTraffic()

{



var TestInstance, i, HTTPTask, request;



csv_to_aray();

// Creates a new load test

TestInstance = LoadTesting.CreateTestInstance("Test");

for(i = 0; i < 2; i++)

{

// Obtains the task

HTTPTask = LoadTesting.HTTPTask("MMUS_HomePage2");



// Creates a virtual user and specifies the task and test for it

VirtualUsers = LoadTesting.CreateVirtualUser("VirtualUser" + aqConvert.VarToStr(i + 1));

VirtualUsers.Task = HTTPTask;

VirtualUsers.TestInstance = TestInstance;



// Modifies the request variable

request = HTTPTask.Connection(2).Request(12);

request.BodyVariables.Item("txtUsername") = Logins;

request.BodyVariables.Item("txtPassword") = Passwords;

}



Log.Message( VirtualUsers[0].Task.Connection(2).Request(12).BodyVariables.Item("txtUsername") );

// Runs the task

TestInstance.Run("MMUS_HomePage2");

}



function csv_to_aray()

{

Logins[0] = "mmus1234";

Passwords[0] = "test01";



Logins[1] = "mmus12345";

Passwords[1] = "test01";



}


However, I'm facing with the following issue: when running the script with one Virtual User, it works, but when I run it with 2 Virtual Users, I receive a warning for the request corresponding to the page that does the login. As far as I could see, the difference between a a successful test and a failed one is the following:


The header for a successful test: (partial)



HTTP/1.1 302 Found

Date: Mon, 15 Feb 2010 15:28:17 GMT

Server: Microsoft-IIS/6.0

X-Powered-By: ASP.NET

X-AspNet-Version: 2.0.50727

Location: /home/MMUS/management/AdministratorHome.aspx





The header for a failed test: (partial)



HTTP/1.1 200 OK

Date: Mon, 15 Feb 2010 16:15:54 GMT

Server: Microsoft-IIS/6.0

X-Powered-By: ASP.NET

X-AspNet-Version: 2.0.50727



Any help would be appreciated.


Thank you, 


Andrei


1 Reply


  • Hello Andrei,





    The difference is that in the first response header the server redirects the client to the "AdministratorHome.aspx" page, while in the second case the server returns the requested page and does not redirect the client.

    So, the question is: Why does the server redirect the client when it asks for a page? How does it know when the client needs to be redirected?

    The answers to these questions are related to the logic of your server application's functioning. You need to find this out to understand why the server gives different answers to different virtual users.