Friday, March 20, 2009

Web Test Recorder pane not functioning when recording a web test

Hello,

I'm running into a problem trying to record a webtest:

- In VS2008, when I select "Test->New Test" and then "Web Test", the browser is displayed but the Web Test Recorder pane is not displayed in the browser. I select "View->Explorer Bar->Web Test Recorder 9.0" from the browser menu to display the Web Test Recorder pane, however no URLs are logged in the pane. When I try to click "Stop" in the Web Test Recorder pane, the following error is displayed:

"Unable to load DLL 'Microsoft.VisualStudio.QualityTools.RecorderBarBHO90.dll': The specified module could not be found"

I was able to record web tests for the first week or so after install VS2008, but the error above started occuring today.

I've tried uninstalling VS2008 and re-installing but I'm still having the same problem. Also, I have VS2008 installed on a 2nd machine that shares a network drive (for my projects) with the machine above and it is also having the same problem.

Any suggestions would be appreciated.

Thanks, Sean

-----------------------------------------------------------------------------------------

Can you check to see if Microsoft.VisualStudio.QualityTools.RecorderBarBHO90.dll is in the GAC? Please also search the registry to find refrences to this DLL, IE finds it through COM registration
---------------------------------------------------------------------------------------
Andy - I'm not sure what "GAC" is could you please explain? The DLL does exist in this directory:

C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE

I'll also check the registry to see if it's defined there.

Thanks.

-----------------------------------------------------------------------------------

Ok, I checked the registry and the DLL is defined in HKEY_CLASSES_ROOT->AppID->QualityTools.RecorderBarBHO90.dll
-------------------------------------------------------------------------------------
OK, hopefully we will not need to check the GAC anyway.

Can you do the following...

In IE (are you using IE7 or IE6?) go to Manage Add-Ons

Look for "Microsoft Web Test Recorder 9.0 Helper", make sure it is there and enabled, if it is disabled, enable it and try again.

If it is not there it is possible that some anti-spyware package has removed it.

If the entry is there, and enabled, you will need to use regedit.

Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects

Take a look, you should find this entry:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects\{E31CE47F-C268-41ba-897B-B415E613947D}

(if it is not there, perform the following procedure for each entry there, as it is possible that the BHO was registered under a different class id)

Now cross-check in

HKEY_CLASSES_ROOT\CLSID\{E31CE47F-C268-41ba-897B-B415E613947D}

You should find

HKEY_CLASSES_ROOT\CLSID\{E31CE47F-C268-41ba-897B-B415E613947D}\InprocServer32 with a default value of something like : C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.QualityTools.RecorderBarBHO90.dll

That is how IE finds the helper.

Now double check that the file is at the location above

If all that fails, try sending me the result of the following procedure...

The GAC is a place that .NET puts executables that need to be shared between applications. The file we are talking about here needs to be accessible to IE, and we normally put it in the GAC.

It is a special place, gacutil can list the content.

Go to the start menu, find Microsoft Visual Studio / Visual Studio Tools / Visual Studio Command Prompt

In that window type "gacutil /l", send me the results for all entries starting with Microsoft.VisualStudio

Reporting on web tests using new web test API's added in VS 2008 SP1

http://blogs.msdn.com/slumley/pages/reporting-on-web-tests-using-new-web-test-api-s.aspx


This blog will show you how to use some of the new API’s added in VS 2008 sp1 to collect additional request and transaction timing data. Here is a post with more info on the new API's: New API's In this example, I am going to collect additional data for web tests, pages and transactions, then store it in a set of database tables. Then I’ll show you how you can use excel to report on this data. This will help people who have asked the question, “Is there any other way to report on web test data that is displayed in the web test playback UI?”
The First step will be to create the database tables and views. It does not have to be the same database that you collect load test data in, but it can be. Start up your favorite query editor and execute the following CREATE TABLE and CREATE VIEW statements. Here are the table definitions:

WebTest:
CREATE TABLE [dbo].[WebTest](
[TestId] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NOT NULL,
[ExecutionTime] [datetime] NULL,
CONSTRAINT [PK_WebTest] PRIMARY KEY CLUSTERED
(
[TestId] ASC
)
) ON [PRIMARY]

WebPage:
CREATE TABLE [dbo].[WebPage](
[TestId] [int] NOT NULL,
[ItemId] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](255) NOT NULL,
[Outcome] [nvarchar](50) NOT NULL,
[Duration] [int] NOT NULL,
[Length] [int] NOT NULL,
CONSTRAINT [PK_WebPage] PRIMARY KEY CLUSTERED
(
[TestId] ASC,
[ItemId] ASC
)
) ON [PRIMARY]
WebTransaction:
CREATE TABLE [dbo].[WebTransaction](
[TestId] [int] NOT NULL,
[TransactionId] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](255) NOT NULL,
[Duration] [int] NOT NULL,
CONSTRAINT [PK_WebTransaction] PRIMARY KEY CLUSTERED
(
[TestId] ASC,
[TransactionId] ASC
)
) ON [PRIMARY]
Now let’s create the database views:
WebTestView:
CREATE VIEW [dbo].[WebTestView]
AS
select a.TestId,
a.Name as "Web Test Name",
b.Name as URL,
Outcome,
Duration as "Duration (ms)" ,
Length as "Content Length"
FROM WebTest a
JOIN WebPage b
ON a.TestId = b.TestId
WebTestPageView:
CREATE VIEW [dbo].[WebTestPageView]
AS
select a.TestId,
a.ExecutionTime as "Execution Time",
a.Name as "Web Test Name",
b.Name as URL,
Outcome,
Duration as "Duration (ms)" ,
Length as "Content Length"
FROM WebTest a
JOIN WebPage b
ON a.TestId = b.TestId
WebTestTransactionView:
CREATE VIEW [dbo].[WebTestTransactionView]
AS
select a.TestId,
a.ExecutionTime as "Execution Time",
a.Name as "Web Test Name",
b.Name as "Transaction Name",
Duration as "Duration (ms)"
FROM WebTest a
JOIN WebTransaction b
ON a.TestId = b.TestId

As you can see from these tables, we are going to collect test, page and transaction timing information.
Here is the next set of steps:

1) Create a test project
2) Record a simple webtest that you want to collect additional timing information on.
3) We need to add some references to the project. Right click on the References folder and select Add Reference… Then select the System.Data dll from the .net tab.
4) Now we need to create a class which will help us log data to the tables we have created. Add a class files to your test project and call it SqlHelper.cs.
5) Now copy the following. This is very simple class which will log data to those tables.
using System;
using System.Globalization;
using System.Data.SqlClient;

namespace ApiDemo
{
class SqlHelper
{
static string s_connectionString;

public static void SetConnectionString(string connectionString)
{
s_connectionString = connectionString;
}

public static int CreateRun(string name)
{
string sql = string.Format("INSERT INTO WebTest (Name,ExecutionTime) Values ('{0}','{1}')", name, ToDbDateString(DateTime.Now));


using (SqlConnection connection = new SqlConnection(s_connectionString))
{
connection.Open();
using (SqlCommand sqlCommand = new SqlCommand(sql, connection))
{
sqlCommand.ExecuteNonQuery();
}

//NOW GET THE ID
sql = "SELECT MAX(TestId) FROM WebTest";
using (SqlCommand sqlCommand = new SqlCommand(sql, connection))
{
using (SqlDataReader dataReader = sqlCommand.ExecuteReader())
{
if (dataReader.Read())
{
return dataReader.GetInt32(0);
}
}
}
}
throw new Exception("Unable to create WebTest entry");
}

public static void LogPage(int id, string url,string outcome,double duration,long content)
{
string sql = string.Format("INSERT INTO WebPage (TestId,Name,Outcome,Duration,Length) Values ({0},'{1}','{2}',{3},{4})", id,url,outcome,duration,content);


using (SqlConnection connection = new SqlConnection(s_connectionString))
{
connection.Open();
using (SqlCommand sqlCommand = new SqlCommand(sql, connection))
{
sqlCommand.ExecuteNonQuery();
}

}
}

public static void LogTransaction(int id, string name, double duration)
{
string sql = string.Format("INSERT INTO WebTransaction (TestId,Name,Duration) Values ({0},'{1}',{2})", id, name,duration);


using (SqlConnection connection = new SqlConnection(s_connectionString))
{
connection.Open();
using (SqlCommand sqlCommand = new SqlCommand(sql, connection))
{
sqlCommand.ExecuteNonQuery();
}

}
}

private static string ToDbDateString(DateTime dateTime)
{
string dateString = dateTime.ToString("u", DateTimeFormatInfo.InvariantInfo);

dateString = dateString.Replace("Z", ".");
dateString += dateTime.Millisecond.ToString("d3", NumberFormatInfo.InvariantInfo);
return dateString;
}
}
}

6) Now that we have this class setup, we need a plugin which hooks the correct events and then calls this class. Add a new class files to your test project. Copy the following code into this class:
using Microsoft.VisualStudio.TestTools.WebTesting;

namespace ApiDemo
{
public class PluginExample : WebTestPlugin
{

public override void PreWebTest(object sender, PreWebTestEventArgs e)
{
if (e.WebTest.Context.ContainsKey("ConnectionString"))
{
SqlHelper.SetConnectionString(e.WebTest.Context["ConnectionString"].ToString());
}
else
{
SqlHelper.SetConnectionString("Data Source=\".\\SQLEXPRESS\";Initial Catalog=LoadTest;Integrated Security=True");
}
int id = SqlHelper.CreateRun(e.WebTest.Name);

e.WebTest.Context.Add("WebTestId", id);
}

public override void PrePage(object sender, PrePageEventArgs e)
{
if (e.WebTest.Context.ContainsKey("CurrentPage"))
{
e.WebTest.Context["CurrentPage"] = e.Request.Url;
}
else
{
e.WebTest.Context.Add("CurrentPage", e.Request.Url);
}
}

public override void PostPage(object sender, PostPageEventArgs e)
{
//get the web test id
int webTestId = int.Parse(e.WebTest.Context["WebTestId"].ToString());

SqlHelper.LogPage(webTestId, e.WebTest.Context["CurrentPage"].ToString(),
e.PageOutcome.ToString(),
e.PageStatistics.PageTime.TotalMilliseconds,
e.PageStatistics.TotalContentLength);
}

public override void PostTransaction(object sender, PostTransactionEventArgs e)
{
//get the web test id
int webTestId = int.Parse(e.WebTest.Context["WebTestId"].ToString());

SqlHelper.LogTransaction(webTestId, e.TransactionName, e.Duration.TotalMilliseconds);
}

}
}

Let’s go through what the above plugin does. It hooks 4 events. The PreWebTest, PrePage, PostPage,and PostTransaction.
a) PreWebTest – This event handler will set the connection string for the database. It defaults to the local sqlexpress database but you can override with a context parameter. This event also creates a row in the WebTest table by calling SqlHelper.CreateRun().
b) PrePage –This is a new API. This event is setting the current processing page in the context.
c) Post Page – This is a new API. The difference between this and post request, is that this fires after dependent requests have been fetched for a page. This handler will log information to the WebPage table in the database.
d) PostTransaction – This is a new API. This handler will log information to the WebTransaction table in the database.
7) Now we can add this to a web test. Open the web test you created in step 2. Right click on the root node and select Add Web Test Plugin. Select the plugin that we created.
8) Play back the web test. After it plays back the first time, click the Edit Run Settings button on the playback UI. Change the test to execute 5 times. Play test again. Now we should have 6 executions of the test stored in the database.
Now we have the extra data stored, but how can you view the data. One way is to use Excel. I am going to show you how to use excel to create a List and pivot table.
First let’s create a list:
1) Launch Excel.
2) Click on the Data ribbon.
3) Click the dropdown button for “From Other Sources” button and select From SQL Server.
a. Fill out info for the database
b. Select the Load Test database
c. Select WebTestPageView
d. Click Next and then click finish
4) This will create a table which will look like the following:



5) What is nice about having it in a list is that you can use the nicely built in filtering and sorting functions. For example, click on the URL drop down and select just one page. I am going to select just the default page. Now my screen looks like the following. This is a quick way to compare the timings for the same page across different executions of the webtest.



Now let’s create a Pivot table:
1) Launch Excel
2) Click on the Insert Ribbon
3) Click the pivot table button. This will launch a wizard
4) Select the Use an external data source radio button
5) Click Choose Connection
6) We are going to connect to the transaction view. If your test does not have transactions, then connect to the page or test view.
7) In the existing connections dialog that appears, click the Browse for more button
8) Click the new source button on the Select Data Source dialog
9) In the Data Connection Wizard, select “Microsoft SQL Server”, then click next.
10) Enter your sql server name and click next.
11) Change the database to loadtest
12) Select the WebTestTransactionView in the table list.
13) Click next and then finish.
14) You should be back in the Create Pivot table wizard now. Just click OK.
15) This will create your pivot table. Let’s add the correct columns to correct spots.
a. Add the duration column to the Values section
b. Add the TestId to the Row label
c. Add the Transaction Name to Column Label
Your pivot table field List should look like the following:



The pivot table will look like this:



16) The pivot table gives you a break down for each of the transactions in your web test. For my test I have 2 transactions: AddToCart and Browse. There are also many filtering options available. For example, you could add Web Test Name column to the Report Filter section and then have table only display certain tests.
17) Another nice thing about pivot tables is how easy it is to create a chart.
18) Click on the pivot table and then click on the Insert ribbon.
19) Click on the Line Button and select the first option.
20) This will create a chart that graphs the times for these 2 transactions from run to run. This gives a nice visual of how the timings for your tests, pages, transactions compare from run to run.



There are a few easy steps to get this demo setup. Hopefully you see how the new api’s plus excel make it really easy to do some additional reporting on web tests. One thing you should watch out for is that you probably want to disable the plugin when executing the test in a load test. The load test already collects this data.
Published Thursday, September 11, 2008 1:24 AM by slumley

Masking a 404 error in a dependent request

There are times when your web test may fail with a 404 error in a dependent request (like a css file or gif), but you may not actually care about this error. For example, it may be something that doesn't really impact the layout or content of the page. Or you might file a bug and temporarily want to suppress the error until it is fixed so they can find other errors.
If you get a 404 error in a dependent resource, here's how you can mask it.
Here's a failing web test, it is very simple. If I expand the top request I can see it is failing due to a failed dependent request.

To mask the request, right-click on the dependent and hit Copy.
Go to the test, right click on the corresponding request in the test and select "Add Dependent Request". Paste the url on the clipboard into the url property for the dependent request:

Now set the expected http status code on the dependent to 404.
Rerun the test to see it pass.

84,248 Ads per second!

http://blogs.msdn.com/edglas/archive/2008/03/17/84-248-ads-per-second.aspx


84,248 Ads per second!
The adCenter Display Ads Platform team recently ran a large test using VSTS. The goal of this testing was to validate the configuration and stability of 100+ servers under load.
The test used one Controller and 42 agents to produce the necessary load. The controller was also hosting a full install of SQL Server which acted as the result store.
Controller and Agent hardware information
Processor: 4 x AMD Opteron 280 (2405 MHz)
Memory: 4 GB RAM
Network: GigE NIC
High level test summary
Test Duration 12 hours
Total requests generated 3,639,518,000 (3.63 Billion requests)
Average requests/sec 84,248
Average Requests/Test 1
Failed Tests 0
Sampling rate 30 secs
Average agent Proc utilization 45%
To minimize the risk they started off with one controller and one agent, then increasing to 8 agents, then going to 42.
They estimate they could have produced at least 50% more requests with 42 agents but restricted the load to avoid any agent overloading.
A note from the customer: Overall it was a happy experience running a test of this large scale. Thanks to VSTS for making load testing a pleasure!
:)
Ed.
Published Monday, March 17, 2008 9:59 PM by edglas
Filed under: , , ,
Comments
# 84,248 Ads per second!
I think that the Load Testing capabilities within Team System Test Edition and the Load Test Agent are
Monday, March 24, 2008 1:30 PM by Jeff Beehler's Blog
# VSTS Links - 03/26/2008
Jeff Beehler on Internal usage stats for Team Foundation Server. Tsyang on How Team Foundation Server...

84,248 Ads per second!

http://blogs.msdn.com/edglas/archive/2008/03/17/84-248-ads-per-second.aspx


84,248 Ads per second!
The adCenter Display Ads Platform team recently ran a large test using VSTS. The goal of this testing was to validate the configuration and stability of 100+ servers under load.
The test used one Controller and 42 agents to produce the necessary load. The controller was also hosting a full install of SQL Server which acted as the result store.
Controller and Agent hardware information
Processor: 4 x AMD Opteron 280 (2405 MHz)
Memory: 4 GB RAM
Network: GigE NIC
High level test summary
Test Duration 12 hours
Total requests generated 3,639,518,000 (3.63 Billion requests)
Average requests/sec 84,248
Average Requests/Test 1
Failed Tests 0
Sampling rate 30 secs
Average agent Proc utilization 45%
To minimize the risk they started off with one controller and one agent, then increasing to 8 agents, then going to 42.
They estimate they could have produced at least 50% more requests with 42 agents but restricted the load to avoid any agent overloading.
A note from the customer: Overall it was a happy experience running a test of this large scale. Thanks to VSTS for making load testing a pleasure!
:)
Ed.
Published Monday, March 17, 2008 9:59 PM by edglas
Filed under: , , ,
Comments
# 84,248 Ads per second!
I think that the Load Testing capabilities within Team System Test Edition and the Load Test Agent are
Monday, March 24, 2008 1:30 PM by Jeff Beehler's Blog
# VSTS Links - 03/26/2008
Jeff Beehler on Internal usage stats for Team Foundation Server. Tsyang on How Team Foundation Server...

How to Enable VSTS Logging?

Normally, when a test fails to execute or is aborted, a brief error message will be displayed in the Test Result Window. For a Web test that completes with error(s), detailed information can be found in the Web Test Playback window. For a load test completes with error(s), the errors are written to the Errors table, Tests table, and sometimes also the Requests table. Under certain (rare) conditions, it is difficult to find out why VSTS or the system does not behave as expected based on the given error messages and you may turn on VSTS tracing.
If you are running test locally, enable logging for the VSTestHost process.
1. Open \Microsoft Visual Studio 9.0\Common7\IDE\VsTestHost.exe.config file.
2. Add the following system.diagnostics section.

For the system.diagnostic section contact with the blogger at kjaeed@gmail.com




















3. Specify the path to the log file and the trace level.
If you are running test on Rig, enable logging for the Agent and/or Controller processes.

1. Under \Microsoft Visual Studio 9.0 Team Test Load Agent\LoadTest\, find QTAgent.exe.config for Agent process and QTController.exe.config for Controller process.
2. In the config file, under appSettings section, locate line , and change the value from “no” to “yes”.
3. After you modify the config files, you need to restart the Controller and Agent.
The log files, vsttagentprocess.log and vsttcontroller.log, will be created in the same directory as the configure files.

Does VSTS web test allow me to save the file in the folder?

Hi,
If I click the button, the small popup has 3 options : Open, Save , Cancel. If I click save , I can save it to C drive.


If I want to record saving a file in C drive, I think it is out of the control of VSTS web test. Is there any way to do it?


--------------------------------------------------------------------------------
Ray

I use fiddler to record the webtest of saving a file in my C Drive. The file is not saved. VSTS web test still regards the file as the binary data as opening the file directly.
--------------------------------------------------------------------------------
Ray


Answer:
Is the Popup page recorded? If the Save is handled by client-side Java script, it will not be executed when you run it from VS.

Unix/Linux Commands

  Flow control Syntax break Exit a loop. continue Exit the current iteration of the loop and proceed with the next iteration. Ctrl+C Key com...