This project is read-only.

UKVSTS Web Test Plug In

This assembly allows you to create scriptable parameters in your web tests. This extends the control you can have in your test without having to write your own test or request plugins.
I have stolen the syntax that ASP/ASP.Net uses to mark up a script block. When the test client comes to make your request, the scripts will be evaluated at runtime and the result of the script will be passed as the parameter value.

You can also create scripted Context Parameters - useful if you want to evaluate something at the beginning of a test.

To use the ScriptableParameterPlugIn, follow these steps

1. Download and Run the MSI
2. In your web test project, add a reference to the UKVSTS.WebTestPlugins assembly. There are 2 versions of the plugin dll, one for VS 2005 and VS 2008 - Pick the dll for the version of Visual Studio you are running.
3. Click on the Set Web Test Plug In button on the test's toolbar
4. In the Set Web Test Plug-in dialog, select the ScriptableParameterPlugIn
5. Click Ok
6. Start adding scriptable params to your test.

When creating scriptable parameters, you have 2 options:
1. Single Statement parameters have the format <%= expression %> Where expression is any C# statement that would eveluate to return an object.
examples are:
  • <%= DateTime.Now %> - for the current date and time
  • <%= DateTime.Now.ToString ("dd-MM-yyyy") %> - for the current date and time in the specified format
  • <%= Guid.NewGuid() %> - for a new GUID
2. Multiple Statements are where you need a little bit more freedom than one statement. In this type of parameter you will need to provide your own return statement and semicolons.
examples are:
  • <% return DateTime.Now; %>
  • <% if (Context.IsNewUser) { return Guid.NewGuid (); } else { return Context [["UserName"]] } %> - Ok, so you could have done that in one statement with a ? :, but I got stuck for an example :-)


  • You get access to the current WebTest, WebTestRequest and WebTestContext using the Test, Request and Context properties respectively.
  • The results of all scripted parameters will automatically get added to the current test context so you can use them in any validation rules of subsequent requests.
  • You can have more than one script block per parameter. This is probably most useful if you are doing testing of web services.
  • You can script the file name property for any file upload parameters

Last edited May 16, 2008 at 6:35 PM by NeilKidd, version 21


rdodier Aug 14, 2012 at 9:05 PM 
The directions for this mention a plug-in dll for vs2005 & vs2008. Is there a plug-in for vs2010 or is this functionality already built into vs2010? I'm looking to assign and use a parameter that gets the result of something like DateTime.Now.Add(2), so if there is a newer/better way to do this without the download I'd be interested in that as well.

PS - I saw that I can use a Coded test but prefer just defining this within a regular web test as a context paramter if possible (i.e. Parameter = <%= DateTime.Now.Add(2) %>.

rupakg Dec 6, 2007 at 6:57 PM 
Nice work. I have mentioned it in my blog post at