Web Testing                                                                                        
•        Web testing is the process of testing one or more HTTP applications by making one or more web
requests and analyzing the results.
-        In order to explore testing, a simple example web test will be added to the project.
•        When you add a Web Test to the current web project, it assumes that you would like to record a web
session.
-        Notice the window that pops up, the Web Test Recorder, ready to record our interaction with a web
application or web service:



•        By recording a web session in this way, it’s easier to create an accurate web test, which simulates a real
web session.
-        This tool captures each of the web requests, hidden form fields and query string parameters.
-        You can choose to pause or stop the web session at any point.
-        You can also add a comment for a given request or manually remove an accidental request.
-        For finer control, you can work directly with the Web Test itself (as you’ll see in a moment).
•        With a simple request to http://localhost:1070/TeamTestWeb/DataSetCode.aspx,
the web request is recorded.



•        Here, you can see how our web request to DataSetCode.aspx was added to the web test.


•        Modifications can be made to the web test by merely right-clicking on the items within the test.


-        The toolbar buttons (shown just above the context menu) do the same thing as well.
-        You can add additional web requests or web service requests, as well as additional web session
recordings.
•        You can also generate source code (via Reflection) that can be used to run the web test (again, see
context menu in diagram above). Nice!
'----------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'     Runtime Version:2.0.50727.42
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated.
' </auto-generated>
'----------------------------------------------------------------------------

Option Strict Off
Option Explicit On

Imports Microsoft.VisualStudio.TestTools.WebTesting
Imports System
Imports System.Collections.Generic
Imports System.Text

Namespace TeamTestWebTestProject

Public Class WebTest1Coded
Inherits ThreadedWebTest

Public Sub New()
   MyBase.New()
   Me.PreAuthenticate = True
End Sub

Public Overrides Sub Run()
   Dim request1 As WebTestRequest = _
New WebTestRequest("http://localhost:1070/TeamTestWeb/DataSetCode.aspx")
   MyBase.Send(request1)
End Sub
End Class
End Namespace

•        This generated file is automatically added to the test project.


•        This generated code should look familiar to you – stating that it was generated by a tool.
-        This is much like the code generated when you add a Web Reference to a .NET project.
-        You can continue to use the code as is or modify it to your liking.
•        Web Tests, as well as most other types of tests in Team Test, can be configured to the “nth” degree.
-        Tests can be programmatically modified with the use of custom plug-ins.
-        Plug-ins are custom-developed assemblies referenced from your test project (see context menu in
diagram above).
•        There are several namespaces available in the testing framework that offer extended testing capabilities
outside the scope of this class. Here are a few:
Microsoft.VisualStudio.TestTools
Microsoft.VisualStudio.TestTools.LoadTesting  
Microsoft.VisualStudio.TestTools.UnitTesting  
Microsoft.VisualStudio.TestTools.UnitTesting.Web  
Microsoft.VisualStudio.TestTools.WebTesting  
Microsoft.VisualStudio.TestTools.WebTesting.Rules

-        Just know that programmatically using these namespaces offer higher capabilities to your tests.
-        These capabilities include custom handling of tests, exception handling, validation rules and direct
parameter manipulation, to name a few.
-        These namespaces are only available with Team Test and Team Suite.
Web Testing
Table of Contents
Copyright (c) 2008.  Intertech, Inc. All Rights Reserved.  This information is to be used exclusively as an
online learning aid.  Any attempts to copy, reproduce, or use for training is strictly prohibited.
Courseware
Training Resources
Tutorials