At Tomorrows .NET Usergroup meeting i want to demo a couple of the new features of Visual Studio Team System Test Edition.  Namely the ability for the Web Test Recorder to Record AJAX requests and JavaScript pop-ups. To do this i needed to find an Ajax enabled site and an easy way to find a way of showing off recording Ajax calls.  The easiest way i found was to create my own Ajax enabled page and compare the calls in the web recorder with the same page that isn't Ajax enabled.   Starting  with the non Ajax enabled page:

 

1.  Create a New ASP.NET Web Site.   File>New Web Site>ASP.NET Web Site.  I left my website with the defaults for my machine: Location = File System and Language Visual Basic.

2.  Add a Button and a Textbox to the default.aspx

3. In the click event handler of the button (just double click on the button) add the code Button1.Text = TextBox1.Text.

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

Button1.Text = TextBox1.Text

End Sub

4. Run the Website to determine the URL for the page.  For the mine it was: http://localhost:53814/WebSite2/Default.aspx

5. Create a web test and record clicking the button on the page.  Test Menu>New Test>Web Test.

6. Looking at the Recorder - you can clearly see the HTML being recorded (See image below)

 

 

Converting this page to Ajax is as easy as easy as adding two controls - the ASP.NET Script Manager and the Update panel.

7. Open the page Default.aspx and from the toolbox  and add a script manager above the button and an Update Panel

8. Move the Button and the Textbox into the UpdatePanel

9. Run a new Test Recording on the modified page. Menu>New Test>Web Test recording. Test Menu>New Test>Web Test.

10.  You can see the exact same functionality is now being executed through Java Script -and being recorded whereas in 2005 the recorder would not have recorded those calls.