Load Testing a WordPress site
Hi guys, in this blog I am going to cover how to load test a web application. In this case its a wordpress application residing on my local server. You can also set up wordpress locally by downloading it from http://wordpress.org.
So we must start our load test.
- Open visual studio and add a new Test project.

- Right click your test project to add a new webtest

- Adding a webtest will launch you a browser with a record panel. In this case I am simulating a login process to a wordpress site .
The record panel record all your browsing activites. Note that the recorder uses the url to record your action. If you have ajax or other script that doesnt changes the url then you need to manually code the test. Run your webtest once to check if it is getting pass. - Next step would be to add a new load test. Right click the test project to add a new load test.

- Go through the load test wizard and add your webtest to the load test.
- You can specify the number of virtual users in the load pattern tab. There are 2 ways to add virtual user. 1 is the constant load other is the step up load. Constant load can be used when you really want to smoke up your server and test how many concurrent user it can handle and for how long.In our case we would be using the step up load. This load pattern simulates a ‘n’ number of user initially and Ramp up the users according to the values provided. You can also specify the duration you want to run your test for.

- Run your load test and analyze the graphs. You can also save your load test report to the SQL server and then using SQL Server reporting services you can generate your own reports. To know how to save the load test reports to SQL Server view my other blog by clicking here
1 comment November 19, 2008
How to save Load Test reports in SQL Server
Hey Guys, recently I was working on Load Test automation using VS. By default VS stores all your Load Test report in SQLExpress but I wanted to have them stored on SQL Server. I digged hard and found out that following some simple steps it can be attained. I thought of sharing the same idea with you guys so that you dont have to dig in that hard.
So here we go..
Open the VS command prompt and type
cd n:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE.
dont forget to replace n: with the drive where your Visual Studio folder resides.
Once you are into that folder you need to type
SQLCMD /S localhost -i loadtestresultsrepository.sql
“loadtestresultsrepository.sql” contains all the sql scripts that create the “LoadTest” DB and another 24 tables in your sql server.
You also need to give credentials to connect to your DBserver( which in this case is localhost), you can give it using the following syntax
SQLCMD /S localhost -U <user name> -P <password> -i loadtestresultsrepository.sql
Once done with the above steps Click “Administer Test Controllers” under the “Test” Menu.
Click the browse button(…) to select the “LoadTest” DB.
You are now ready to run your Load Test and use your SQLServer Reporting Services to generate custom report.
Happy Testing
Danish Khan
Add comment October 27, 2008
Keyword search in SQL Server
Hello guys,
For those who ever felt the need to search for a keyword in the entire DataBase, I have this following script. Run this PROC on the DataBase you wish to make your search on.
It accepts a search string as input parameter, goes and searches all the user created tables (System tables are excluded).
CREATE PROC SearchDB
(
@SearchStr nvarchar(100)
)
AS
BEGIN
CREATE TABLE #Results (ColumnName nvarchar(370), ColumnValue nvarchar(3630))
SET NOCOUNT ON
DECLARE @TableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110)
SET @TableName = ”
SET @SearchStr2 = QUOTENAME(‘%’ + @SearchStr + ‘%’,””)
WHILE @TableName IS NOT NULL
BEGIN
SET @ColumnName = ”
SET @TableName =
(
SELECT MIN(QUOTENAME(TABLE_SCHEMA) + ‘.’ + QUOTENAME(TABLE_NAME))
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = ‘BASE TABLE’
AND QUOTENAME(TABLE_SCHEMA) + ‘.’ + QUOTENAME(TABLE_NAME) > @TableName
AND OBJECTPROPERTY(
OBJECT_ID(
QUOTENAME(TABLE_SCHEMA) + ‘.’ + QUOTENAME(TABLE_NAME)
), ‘IsMSShipped’
) = 0
)
WHILE (@TableName IS NOT NULL) AND (@ColumnName IS NOT NULL)
BEGIN
SET @ColumnName =
(
SELECT MIN(QUOTENAME(COLUMN_NAME))
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = PARSENAME(@TableName, 2)
AND TABLE_NAME = PARSENAME(@TableName, 1)
AND DATA_TYPE IN (‘char’, ‘varchar’, ‘nchar’, ‘nvarchar’)
AND QUOTENAME(COLUMN_NAME) > @ColumnName
)
IF @ColumnName IS NOT NULL
BEGIN
INSERT INTO #Results
EXEC
(
‘SELECT ”’ + @TableName + ‘.’ + @ColumnName +”’, LEFT(‘ + @ColumnName + ‘, 3630)
FROM ‘ + @TableName + ‘ (NOLOCK) ‘ +
‘ WHERE ‘ + @ColumnName + ‘ LIKE ‘ + @SearchStr2
)
END
END
END
SELECT ColumnName, ColumnValue FROM #Results
ENDUpon running this script you can execute it:
EXEC SearchDB ‘<keyword>’
The output of this stored procedure contains two columns:
- 1) The table name and column name in which the search string was found
- 2) The actual content/value of the column
Danish Khan
Add comment October 27, 2008
Microsoft to share .NET code
Microsoft has announced that it will release the source code for the .NET Framework with .NET version 3.5 later this year. This would essentially be in “read-only mode,” meaning that you can view the source code for reference and debugging, but you cannot modify or re-distribute the code. This is Microsoft’s most restrictive shared-code license and should not be confused with “open source” code such as Linux
Microsoft will begin by offering source code for the following .NET components:
- .NET Base Class Libraries (including System, System.IO, System.Collections, System.Configuration, System.Threading, System.Net, System.Security, System.Runtime, and System.Text)
- ADO.NET (System.Data)
- ASP.NET (System.Web)
- Windows Forms (System.Windows.Forms)
- Windows Presentation Foundation (System.Windows)
- XML (System.Xml)
Over time, Microsoft will share code for more .NET components, including Windows Communication Foundation (WCF), Windows Workflow, and Language Integrated Query (LINQ). The .NET code can be downloaded all at once or portions on demand.
Even though the .NET code won’t be open source, this is another important step forward for Microsoft as it continues to open up its proprietary empire under its Shared Source Initiative. This will benefit .NET developers by enabling them to debug their applications down into the framework and learn more about the inner workings of .NET. And the .NET Framework should hopefully benefit by having more developers review its code, find bugs and suggest solutions.
Danish Khan
Add comment June 2, 2008
Context Menu in Win Forms
Problem: How to add a context menu to a control and then add an event handler to it?
Solution:
ContextMenu refreshPopUp = new ContextMenu();
refreshPopUp.MenuItems.Add(“[context menu text]“, new EventHandler([method name]));
refreshPopUp.Show([control], new System.Drawing.Point(X, Y));
// Write the code for the event handler
private void methodName(object sender, EventArgs e)
{
do something;
}
Danish Khan
Add comment May 12, 2008