<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2titles.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemtitles.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
    <channel>
        <title>Stephen Walther on ASP.NET MVC</title>
        <link>http://stephenwalther.com/blog/Default.aspx</link>
        <description />
        <language>en-US</language>
        <copyright>Stephen Walther</copyright>
        <managingEditor>Stephen.Walther@Microsoft.com</managingEditor>
        <generator>Subtext Version 2.0.0.43</generator>
        <image>
            <title>Stephen Walther on ASP.NET MVC</title>
            <url>http://stephenwalther.com/blog/images/RSS2Image.gif</url>
            <link>http://stephenwalther.com/blog/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/StephenWalther" type="application/rss+xml" /><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2FStephenWalther" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FStephenWalther" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://feeds.feedburner.com/StephenWalther" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FStephenWalther" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2FStephenWalther" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FStephenWalther" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><feedburner:feedFlare href="http://www.plusmo.com/add?url=http%3A%2F%2Ffeeds.feedburner.com%2FStephenWalther" src="http://plusmo.com/res/graphics/fbplusmo.gif">Subscribe with Plusmo</feedburner:feedFlare><feedburner:feedFlare href="http://www.live.com/?add=http%3A%2F%2Ffeeds.feedburner.com%2FStephenWalther" src="http://tkfiles.storage.msn.com/x1piYkpqHC_35nIp1gLE68-wvzLZO8iXl_JMledmJQXP-XTBOLfmQv4zhj4MhcWEJh_GtoBIiAl1Mjh-ndp9k47If7hTaFno0mxW9_i3p_5qQw">Subscribe with Live.com</feedburner:feedFlare><feedburner:feedFlare href="http://www.addtoany.com/?linkname=Stephen%20Walther%20on%20ASP.NET%20MVC&amp;linkurl=http%3A%2F%2Ffeeds.feedburner.com%2FStephenWalther&amp;type=feed" src="http://www.addtoany.com/addfr-b.gif">Add to Any Feed Reader</feedburner:feedFlare><feedburner:browserFriendly>Get the latest news, tips, and articles on ASP.NET MVC by subscribing to Stephen Walther's blog.</feedburner:browserFriendly><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
            <title>Improving the AJAX Control Toolkit with the Lightweight Test Automation Framework (LTAF)</title>
            <category>AJAX</category>
            <category>ASP.NET</category>
            <category>JavaScript</category>
            <link>http://feedproxy.google.com/~r/StephenWalther/~3/5YXn7oty2VE/improving-the-ajax-control-toolkit-with-the-lightweight-test-automation.aspx</link>
            <description>&lt;p&gt;The AJAX Control Toolkit is an incredibly popular set of controls that enable you to easily add JavaScript functionality to an ASP.NET application. The AJAX Control Toolkit has consistently been one of the top three most popular downloads from CodePlex since the birth of CodePlex (see &lt;a href="http://www.CodePlex.com"&gt;http://www.CodePlex.com&lt;/a&gt;).&lt;/p&gt;  &lt;p&gt;Lately, we’ve been thinking hard about methods of improving the quality of the AJAX Control Toolkit controls. We want to improve the quality of the AJAX Control Toolkit controls so that they match the very high standards of quality of the official ASP.NET framework controls such as the GridView and TextBox controls. &lt;/p&gt;  &lt;p&gt;In discussions of quality, the issue of testing immediately comes up. Right now, the AJAX Control Toolkit solution includes a test project named ToolkitTests. (You can see this project if you download the Source version of the AJAX Control Toolkit from CodePlex). This project contains a set of automated functional tests for each control in the AJAX Control Toolkit (see Figure 1). For example, there is a file named Calendar.aspx which contains a set of tests for the Calendar control.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Figure 1 – Tests in the ToolkitTests project&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/ImprovingtheAJAXControlToolkitwiththeLig_111EF/clip_image002_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/ImprovingtheAJAXControlToolkitwiththeLig_111EF/clip_image002_thumb.jpg" width="225" height="576" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;You can run all of these tests by requesting the Default.aspx page from the ToolkitTests project. The Default.aspx page contains a test runner. If you click the &lt;b&gt;Select All&lt;/b&gt; link, and then click the &lt;b&gt;Run Tests&lt;/b&gt; button, then all of the tests are run (see Figure 2). &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Figure 2 – Running tests&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/ImprovingtheAJAXControlToolkitwiththeLig_111EF/clip_image004_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image004" border="0" alt="clip_image004" src="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/ImprovingtheAJAXControlToolkitwiththeLig_111EF/clip_image004_thumb.jpg" width="522" height="319" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Having a set of tests like this that can be run automatically is invaluable. It means that we can modify existing AJAX Control Toolkit controls and know whether we have broken existing functionality. We run these tests in a standard set of browsers to ensure that the AJAX Control Toolkit controls are cross-browser compatible.&lt;/p&gt;  &lt;p&gt;In order to improve the quality of the AJAX Control Toolkit, we plan to significantly improve the quality of the tests that accompany the Toolkit. However, the AJAX Control Toolkit currently uses a proprietary functional test framework. The test framework was invented for the AJAX Control Toolkit and it is used nowhere else.&lt;/p&gt;  &lt;p&gt;For this reason, we decided to investigate using alternative functional test frameworks. We had several specific criteria for selecting a functional test framework:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;1) The functional test framework needs to be an open-source project.&lt;/p&gt;    &lt;p&gt;2) The functional test framework needs to work with all major browsers including Internet Explorer, FireFox, Safari, Opera, and Chrome. &lt;/p&gt;    &lt;p&gt;3) The functional test framework needs to support simulating complex browser interactions.&lt;/p&gt;    &lt;p&gt;4) The functional test framework needs to be easy for the Quality Assurance team at Microsoft to use.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;In order to meet all of these requirements, we decided to use the Lightweight Test Automation Framework as the testing framework for the AJAX Control Toolkit moving forward. &lt;/p&gt;  &lt;h4&gt;The Lightweight Test Automation Framework&lt;/h4&gt;  &lt;p&gt;The Lightweight Test Automation Framework (LTAF) is an open source functional test framework available from CodePlex at:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://aspnet.codeplex.com/Wiki/View.aspx?title=ASP.NET%20QA"&gt;http://aspnet.codeplex.com/Wiki/View.aspx?title=ASP.NET%20QA&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;LTAF is a lightweight version of the very same testing framework that the ASP.NET Quality Assurance team uses to test the standard ASP.NET controls. The framework is compatible with all major web browsers and the framework enables you to simulate complex JavaScript behaviors.&lt;/p&gt;  &lt;p&gt;An important consideration for the ASP.NET AJAX team is that the Microsoft QA team is already very familiar with this framework. Therefore, any member of the Microsoft QA team can easily test the AJAX Control Toolkit using this framework.&lt;/p&gt;  &lt;p&gt;Our plan is to include all of the LTAF tests used by the QA team with the download of the AJAX Control Toolkit. That way, if you modify the Toolkit, then you can run the LTAF tests to check whether or not your modifications have broken existing controls.&lt;/p&gt;  &lt;p&gt;In the following sections, I provide you with a brief introduction to using LTAF.&lt;/p&gt;  &lt;h5&gt;Downloading and Installing LTAF&lt;/h5&gt;  &lt;p&gt;After downloading the Microsoft.Web.Testing.Lightweight.zip file from the CodePlex website, you need to remember to unblock the downloaded ZIP. Right-click the file and click the Unblock button (see Figure 3).&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Figure 3 – Unblocking the download file&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/ImprovingtheAJAXControlToolkitwiththeLig_111EF/clip_image006_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image006" border="0" alt="clip_image006" src="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/ImprovingtheAJAXControlToolkitwiththeLig_111EF/clip_image006_thumb.jpg" width="381" height="519" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Next, unzip the file into a new folder and double-click the Microsoft.Web.Testing.Lightweight.sln file to open up the LTAF solution. Build the project by selecting the menu option Build, Build Solution. &lt;/p&gt;  &lt;p&gt;The LTAF solution contains the following projects:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;· SampleWebSite – Contains sample LTAF tests &lt;/p&gt;    &lt;p&gt;· FunctionalTestsWebSite – Contains BVT tests written using LTAF&lt;/p&gt;    &lt;p&gt;· Microsoft.Web.Testing.Lightweight – Contains the source code for LTAF&lt;/p&gt;    &lt;p&gt;· Microsoft.Web.Testing.Lightweight.UnitTests – Contains unit tests for LTAF&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The fastest way to try out LTAF is to run the tests in the SampleWebSite project.    &lt;br /&gt;Right-click the Default.aspx page contained in the Test folder and select the menu option &lt;b&gt;View In Browser&lt;/b&gt;. The page in Figure 4 appears. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Figure 4 – The LTAF Test Runner&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/ImprovingtheAJAXControlToolkitwiththeLig_111EF/clip_image008_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image008" border="0" alt="clip_image008" src="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/ImprovingtheAJAXControlToolkitwiththeLig_111EF/clip_image008_thumb.jpg" width="540" height="406" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Click the link labeled &lt;b&gt;All Test Cases&lt;/b&gt; to select all of the tests and click the &lt;b&gt;Run Tests&lt;/b&gt; button to run the tests. All the tests that pass are highlighted with green and a checkmark (see Figure 5).&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Figure 5 – LTAF test results&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/ImprovingtheAJAXControlToolkitwiththeLig_111EF/clip_image010_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image010" border="0" alt="clip_image010" src="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/ImprovingtheAJAXControlToolkitwiththeLig_111EF/clip_image010_thumb.jpg" width="502" height="377" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;So you might be wondering where the functional tests executed by the test runner are defined. You can find the tests in the App_Code\Test folder. For example, the Test folder includes a class named UserManagementTests.cs that contains a set of tests for the Login.aspx page. An abridged version of this class is contained in Listing 1.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Listing 1 – UserManagementTests.cs [C#]&lt;/b&gt;&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:391e4400-df86-4348-bb18-7c6639041287" class="wlWriterEditableSmartContent"&gt;&lt;pre name="code" class="c#"&gt;using System;
using Microsoft.Web.Testing.Light;

[WebTestClass]
public class UserManagementTests
{
    [WebTestMethod]
    public void SignInAndSignOut()
    {
        // Navigate to the login page
        HtmlPage page = new HtmlPage("Login.aspx");

        // Fill Login control user/password and click login button
        page.Elements.Find("UserName").SetText("ValidUser");
        page.Elements.Find("Password").SetText("foo");
        page.Elements.Find("LoginButton").Click(WaitFor.Postback);

        // Verify content of the Home page
        Assert.AreEqual("Welcome back ValidUser!", page.Elements.Find("LoginName1").GetInnerText());

        // Click the logout tab
        page.Elements.Find("tab-signout").Click(WaitFor.Postback);

        // Verify login tab now exists.
        Assert.IsTrue(page.Elements.Exists("tab-login"));
    }

}
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The class in Listing 1 is decorated with the WebTestClass attribute and the functional test method is decorated with the WebTestMethod attribute. &lt;/p&gt;

&lt;p&gt;The SignInAndSignOut() method performs the following tests:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;1) It verifies that entering the user name ValidUser and password foo into the Login form on the Login.aspx page results in a page that displays the message “Welcome back ValidUser!”.&lt;/p&gt;

  &lt;p&gt;2) It verifies that clicking the Logout tab causes the Login tab to appear.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Notice how the HtmlPage class and HtmlElement class are used to interact with a web page. For example, the HtmlPage.Elements.Find() method is used to retrieve a particular DOM element. The HtmlElement.Click() method is used to simulate a button click.&lt;/p&gt;

&lt;h4&gt;Using LTAF in a New or Existing ASP.NET Website&lt;/h4&gt;

&lt;p&gt;If you want to use LTAF with a new or existing ASP.NET Website then you need to do two things:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;1) Add a reference to the Microsoft.Web.Testing.Lightweight.dll assembly&lt;/p&gt;

  &lt;p&gt;2) Add a folder named Test that contains the test runner (the Default.aspx and DriverPage.aspx files)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For example, imagine that you have created an ASP.NET website that contains the ASP.NET page in Listing 2. This page contains a single button. Whenever you click the button, the number displayed by the Label control is incremented by 1 (see Figure 6).&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Listing 2 – Counter.aspx&lt;/b&gt;&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:24770dc6-2239-4af7-ac14-1ca5f9a5dc6b" class="wlWriterEditableSmartContent"&gt;&lt;pre name="code" class="c#"&gt;&amp;lt;%@ Page Language="C#" %&amp;gt;
&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;

&amp;lt;script runat="server"&amp;gt;

    protected void btnAdd_Click(object sender, EventArgs e)
    {
        var newValue = int.Parse(lblCounter.Text) + 1;
        lblCounter.Text = newValue.ToString();
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Untitled Page&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
    
    &amp;lt;asp:Label
        id="lblCounter"
        Text="0"
        Runat="server" /&amp;gt;
    
    &amp;lt;asp:Button
        id="btnAdd"
        Text="Add 1"
        Runat="server" OnClick="btnAdd_Click" /&amp;gt;
    
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;b&gt;Figure 6 – The Counters.aspx page&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/ImprovingtheAJAXControlToolkitwiththeLig_111EF/clip_image012_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image012" border="0" alt="clip_image012" src="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/ImprovingtheAJAXControlToolkitwiththeLig_111EF/clip_image012_thumb.jpg" width="327" height="256" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to test this page using LTAF then you first need to add a reference to the Microsoft.Web.Testing.Lightweight.dll assembly. Select the menu option &lt;b&gt;Website, Add Reference&lt;/b&gt;. Click the Browse tab and browse to the folder where you downloaded LTAF (see Figure 7).&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Figure 7 – Adding a reference to LTAF&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/ImprovingtheAJAXControlToolkitwiththeLig_111EF/clip_image014_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image014" border="0" alt="clip_image014" src="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/ImprovingtheAJAXControlToolkitwiththeLig_111EF/clip_image014_thumb.jpg" width="327" height="277" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, we need to add the Test folder (that contains the Default.aspx and DriverPage.aspx files) into our new website. Using Windows Explorer, navigate to the directory where you downloaded LTAF. You can drag the Test folder from Window Explorer into the Solution Explorer window in your website project (or copy and paste the folder). After you add this folder, your Solution Explorer window should look like Figure 8.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Figure 8 – Solution Explorer with Test folder&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/ImprovingtheAJAXControlToolkitwiththeLig_111EF/clip_image016_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image016" border="0" alt="clip_image016" src="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/ImprovingtheAJAXControlToolkitwiththeLig_111EF/clip_image016_thumb.jpg" width="225" height="375" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, we are ready to write some tests. Add a new class to your website named CounterTests.cs (Visual Studio will prompt you to add the class to your App_Code folder). Enter the code in Listing 3.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Listing 3 – CounterTests.cs&lt;/b&gt;&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:587e1ba7-6d24-4872-9871-f29fb9f516f4" class="wlWriterEditableSmartContent"&gt;&lt;pre name="code" class="c#"&gt;using Microsoft.Web.Testing.Light;

[WebTestClass]
public class CounterTests
{
    [WebTestMethod]
    public void ButtonIncrementsByOne()
    {
        // Get the Counters.aspx page
        HtmlPage page = new HtmlPage("/Counter.aspx");

        // Click the btnAdd Button
        page.Elements.Find("btnAdd").Click(WaitFor.Postback);

        // Get the value of the Counters Label
        var labelValue = page.Elements.Find("lblCounter").GetInnerText();

        // Verify that the Label has the value 1
        Assert.AreEqual("1", labelValue);
    }
}
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The test class in Listing 3 contains one test method named ButtonIncrementsByOne(). This test verifies that clicking the button increments the value displayed in the Label by one.&lt;/p&gt;

&lt;p&gt;You can run the test by opening the Test/Default.aspx page. After you open this page, you can select the ButtonIncrementsByOne test, and click the &lt;b&gt;Run Tests&lt;/b&gt; button to execute the test. When the test runs successfully, you get the page in Figure 9.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Figure 9 – Results of running test&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/ImprovingtheAJAXControlToolkitwiththeLig_111EF/clip_image018_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image018" border="0" alt="clip_image018" src="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/ImprovingtheAJAXControlToolkitwiththeLig_111EF/clip_image018_thumb.jpg" width="466" height="413" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;Conclusion&lt;/h4&gt;

&lt;p&gt;The Lightweight Testing Automation Framework (LTAF) is a very powerful framework for building functional tests. It is (a lightweight version) of the testing framework used by the ASP.NET Quality Assurance team and it is the testing framework used to build tests for the ASP.NET framework. &lt;/p&gt;

&lt;p&gt;You can use this test framework to build functional tests for your ASP.NET applications. Simply download LTAF from CodePlex and start writing your functional tests in either C# or VB.NET.&lt;/p&gt;

&lt;p&gt;We plan to use LTAF for the AJAX Control Toolkit because (1) LTAF works with all modern browsers including Internet Explorer, Firefox, Safari, Opera, and Chrome (2) it is open-source and (3) because LTAF is based on the same testing framework used internally by the ASP.NET QA team, we expect the QA team to continue to invest in improving LTAF over time. &lt;/p&gt;&lt;img src="http://stephenwalther.com/blog/aggbug/125.aspx" width="1" height="1" /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/StephenWalther?a=5YXn7oty2VE:63kG-O2-3ns:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StephenWalther?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StephenWalther/~4/5YXn7oty2VE" height="1" width="1"/&gt;</description>
            <dc:creator>Stephen Walther</dc:creator>
            <guid isPermaLink="false">http://stephenwalther.com/blog/archive/2009/07/04/improving-the-ajax-control-toolkit-with-the-lightweight-test-automation.aspx</guid>
            <pubDate>Sun, 05 Jul 2009 02:35:09 GMT</pubDate>
            <wfw:comment>http://stephenwalther.com/blog/comments/125.aspx</wfw:comment>
            <comments>http://stephenwalther.com/blog/archive/2009/07/04/improving-the-ajax-control-toolkit-with-the-lightweight-test-automation.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://stephenwalther.com/blog/comments/commentRss/125.aspx</wfw:commentRss>
        <feedburner:origLink>http://stephenwalther.com/blog/archive/2009/07/04/improving-the-ajax-control-toolkit-with-the-lightweight-test-automation.aspx</feedburner:origLink></item>
        <item>
            <title>Joining the ASP.NET AJAX Feature Team</title>
            <category>AJAX</category>
            <link>http://feedproxy.google.com/~r/StephenWalther/~3/noOwV-T9x-A/joining-the-asp.net-ajax-feature-team.aspx</link>
            <description>&lt;p&gt;Hey, I am shifting teams at Microsoft! A little more than a year ago, I started working at Microsoft on the &lt;a href="http://www.ASP.net"&gt;www.ASP.net&lt;/a&gt; community team creating ASP.NET MVC content. Over the past year, I’ve been doing things like speaking at a lot of conferences (PDC, Tech-Ed Emea, Tech-Ed India, MIX, ASP.NET Connections), writing a lot of tutorials and recording a lot of videos, and finishing a book. It has been an intense experience.&lt;a href="http://signaturesterling.files.wordpress.com/2008/01/ajax.jpg"&gt;&lt;img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: 0px" title="clip_image001" border="0" alt="clip_image001" align="right" width="240" height="189" src="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/JoiningtheASP.NETAJAXFeatureTeam_129AE/clip_image001_f82aad0e-28c2-49f7-8cdf-f0c9bfb5fd51.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Next week, I am officially joining the ASP.NET team as a feature PM with a focus on ASP.NET AJAX. I’m going to be working on the Microsoft AJAX Framework and the AJAX Control Toolkit. I get to write specs! &lt;/p&gt;
&lt;p&gt;I’m really excited about Ajax. Anyone who has read my latest ASP.NET Unleashed book or who has heard me speak at any conference over the last 4 years knows that I am an Ajax fanatic. There is some really exciting stuff that we are working on for the next version of ASP.NET AJAX. And, I am really excited to work with the other members of the ASP.NET team – Boris Rivers-Moore, Simon Calvert, Scott Hunter, Stefan Schackow, Scott Galloway, Phil Haack.&lt;/p&gt;
&lt;p&gt;I do need to change the title of my blog.&lt;a href="http://signaturesterling.files.wordpress.com/2008/01/ajax.jpg"&gt;&lt;/a&gt;&lt;a href="http://signaturesterling.files.wordpress.com/2008/01/ajax.jpg"&gt;&lt;/a&gt; I’m still going to write on ASP.NET MVC, but I’m going to start writing much more about Ajax.&lt;/p&gt;&lt;img src="http://stephenwalther.com/blog/aggbug/124.aspx" width="1" height="1" /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/StephenWalther?a=noOwV-T9x-A:3ga9Xxxy2F0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StephenWalther?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StephenWalther/~4/noOwV-T9x-A" height="1" width="1"/&gt;</description>
            <dc:creator>Stephen Walther</dc:creator>
            <guid isPermaLink="false">http://stephenwalther.com/blog/archive/2009/06/15/joining-the-asp.net-ajax-feature-team.aspx</guid>
            <pubDate>Tue, 16 Jun 2009 04:10:07 GMT</pubDate>
            <wfw:comment>http://stephenwalther.com/blog/comments/124.aspx</wfw:comment>
            <comments>http://stephenwalther.com/blog/archive/2009/06/15/joining-the-asp.net-ajax-feature-team.aspx#feedback</comments>
            <slash:comments>52</slash:comments>
            <wfw:commentRss>http://stephenwalther.com/blog/comments/commentRss/124.aspx</wfw:commentRss>
        <feedburner:origLink>http://stephenwalther.com/blog/archive/2009/06/15/joining-the-asp.net-ajax-feature-team.aspx</feedburner:origLink></item>
        <item>
            <title>Back from Tech-ed India</title>
            <category>AJAX</category>
            <category>ASP.NET</category>
            <category>ASP.NET MVC</category>
            <category>Talks</category>
            <link>http://feedproxy.google.com/~r/StephenWalther/~3/aquUpH9oSuM/back-from-tech-ed-india.aspx</link>
            <description>&lt;p&gt;Thank you to everyone who came to my talks at Tech-ed India! It was great meeting so many developers in India (I finally got to meet many people who I have been reading their blogs for years).&lt;/p&gt;  &lt;p&gt;I’ve had several people request the slides and sample files from the talk so I am posting them here.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="/Downloads/Talks/TechEdIndia2009/ASPNET4.zip"&gt;ASP.NET 4 Talk&lt;/a&gt; – The slides and sample files.&lt;/li&gt;    &lt;li&gt;&lt;a href="/Downloads/Talks/TechEdIndia2009/MVC.zip"&gt;MVC Talk&lt;/a&gt; – The slides. The Contact Manager sample application is located at &lt;a href="http://www.ASP.net/mvc/learn"&gt;http://www.ASP.net/mvc/learn&lt;/a&gt;.&lt;/li&gt;    &lt;li&gt;&lt;a href="/Downloads/Talks/TechedIndia2009/Ajax4.zip"&gt;AJAX 4.0 Talk&lt;/a&gt; – The slides and sample files.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://images.google.com/imgres?imgurl=http://www.theodora.com/wfb/photos/india/charminar_hyderabad_india_photo.jpg&amp;amp;imgrefurl=http://www.theodora.com/wfb/photos/india/india_photos_35.html&amp;amp;usg=__0uzsH_KB9dp8aAz0pQowQFvuHso=&amp;amp;h=420&amp;amp;w=519&amp;amp;sz=90&amp;amp;hl=en&amp;amp;start=2&amp;amp;tbnid=A7r03wpmkBtsGM:&amp;amp;tbnh=106&amp;amp;tbnw=131&amp;amp;prev=/images%3Fq%3Dhyderabad%26gbv%3D2%26hl%3Den"&gt;&lt;img src="http://tbn0.google.com/images?q=tbn:A7r03wpmkBtsGM:http://www.theodora.com/wfb/photos/india/charminar_hyderabad_india_photo.jpg" width="131" height="106" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://stephenwalther.com/blog/aggbug/123.aspx" width="1" height="1" /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/StephenWalther?a=aquUpH9oSuM:qSaxbFdf3A4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StephenWalther?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StephenWalther/~4/aquUpH9oSuM" height="1" width="1"/&gt;</description>
            <dc:creator>Stephen Walther</dc:creator>
            <guid isPermaLink="false">http://stephenwalther.com/blog/archive/2009/05/27/back-from-tech-ed-india.aspx</guid>
            <pubDate>Wed, 27 May 2009 16:35:15 GMT</pubDate>
            <wfw:comment>http://stephenwalther.com/blog/comments/123.aspx</wfw:comment>
            <comments>http://stephenwalther.com/blog/archive/2009/05/27/back-from-tech-ed-india.aspx#feedback</comments>
            <slash:comments>19</slash:comments>
            <wfw:commentRss>http://stephenwalther.com/blog/comments/commentRss/123.aspx</wfw:commentRss>
        <feedburner:origLink>http://stephenwalther.com/blog/archive/2009/05/27/back-from-tech-ed-india.aspx</feedburner:origLink></item>
        <item>
            <title>Unit Testing JavaScript with FireUnit</title>
            <category>ASP.NET</category>
            <category>JavaScript</category>
            <category>TDD</category>
            <link>http://feedproxy.google.com/~r/StephenWalther/~3/paNSCQrdB1o/unit-testing-javascript-with-fireunit.aspx</link>
            <description>&lt;p&gt;I’ve been investigating different unit testing frameworks for JavaScript lately and I stumbled onto FireUnit. FireUnit is a unit testing framework created by John Resig (of well-deserved jQuery fame) and Jan Odvarko. In this blog entry, I provide a brief overview of the FireUnit testing framework. In particular, I explain how you can use FireUnit to unit test JavaScript code.&lt;/p&gt;  &lt;h4&gt;Installing FireUnit&lt;/h4&gt;  &lt;p&gt;FireUnit is implemented as a FireFox extension. This is both bad and good. First, the bad news. You cannot use FireUnit with Internet Explorer, Safari, Chrome, or any other browser than Mozilla Firefox.&lt;/p&gt;  &lt;p&gt;Here’s the good news. FireUnit extends Firefox with a new Test tab. This Test tab appears as an extra Firebug tab. Therefore, seeing test results is very convenient.&lt;/p&gt;  &lt;p&gt;Before you can use FireUnit, you need to first install the Firebug extension for Firefox. If you haven’t already installed Firebug then you should be ashamed of yourself. Every JavaScript developer is required, by law, to have Firebug installed. You can learn about Firebug by visiting &lt;a href="http://Firebug.org"&gt;http://Firebug.org&lt;/a&gt;. the easiest way to install Firebug is to select the menu option &lt;b&gt;Tools, Add-ons&lt;/b&gt; within Firefox, select the &lt;b&gt;Get Add-ons&lt;/b&gt; tab and enter &lt;i&gt;Firebug&lt;/i&gt; in the search box (see Figure 1).&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Figure 1 – Adding Firebug&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/UnitTestingJavaScriptwithFireUnit_875D/clip_image002_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/UnitTestingJavaScriptwithFireUnit_875D/clip_image002_thumb.jpg" width="327" height="240" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;After you install Firebug, you can install FireUnit. Navigate to the following website within Firefox:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://FireUnit.org"&gt;http://FireUnit.org&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;After you install FireUnit, a new Test tab appears when you open Firebug (see Figure 2). Your FireUnit test results appear in this tab. Figure 2 depicts what happens when two tests pass and one test fails.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Figure 2 – Viewing test results&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/UnitTestingJavaScriptwithFireUnit_875D/clip_image004_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image004" border="0" alt="clip_image004" src="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/UnitTestingJavaScriptwithFireUnit_875D/clip_image004_thumb.jpg" width="604" height="191" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h4&gt;Making Assertions in FireUnit&lt;/h4&gt;  &lt;p&gt;Documentation on FireUnit is very limited. To learn what methods are available, I downloaded the source for FireUnit and looked at the functions defined in the fireunit.js file (this file includes some helpful comments). I also used the Firebug DOM inspector and inspected the fireunit class.&lt;/p&gt;  &lt;p&gt;Here is a list of the test assertion methods that you can call:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;· ok(pass, msg, expected, actual) – Pass specifies a condition that when true causes the test to pass.&lt;/p&gt;    &lt;p&gt;· compare(expected, actual, msg) – Compares two strings.&lt;/p&gt;    &lt;p&gt;· reCompare(expected, result, msg) – Compares a string to a regular expression pattern. The expected parameter represents the regular expression pattern.&lt;/p&gt;    &lt;p&gt;· testDone() – Call this method to display a summary of all of the test results.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The methods listed above are methods of the fireunit class. Notice that these are non-standard method names for a unit testing framework. You use fireunit.ok() instead of assert.AreEqual().&lt;/p&gt;  &lt;p&gt;Listing 1 contains a MathUtility class created in JavaScript.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Listing 1 – MathUtility.js&lt;/b&gt;&lt;/p&gt;  &lt;pre class="js" name="code"&gt;function MathUtility() {

    this.add = function(val1, val2) {
        return val1 + val2;
    };
}&lt;/pre&gt;

&lt;p&gt;Listing 2 contains a MathUtilityTests class that contains a set of tests for the MathUtility class.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Listing 2 – MathUtilityTests.js&lt;/b&gt;&lt;/p&gt;

&lt;pre class="js" name="code"&gt;/// &amp;lt;reference path="MathUtility.js"/&amp;gt;

function MathUtilityTests()
{
    this.testAddPositiveNumbers = function()
    {
        // Arrange
        var mathUtility = new MathUtility();
        
        // Act
        var result = mathUtility.add(1,3);

        // Assert
        fireunit.ok(result === 4, "Test add positive numbers");        
    }

    this.testAddNegativeNumbers = function()
    {
        // Arrange
        var mathUtility = new MathUtility();

        // Act
        var result = mathUtility.add(-1,-3);

        // Assert
        fireunit.ok(result === 4, "Test add negative numbers");        
    }


    this.testAddNegativeAndPositiveNumbers = function()
    {
        // Arrange
        var mathUtility = new MathUtility();

        // Act
        var result = mathUtility.add(-1,3);

        // Assert
        fireunit.ok(result === 2, "Test add negative and positive numbers");        
    }
}&lt;/pre&gt;

&lt;p&gt;Notice that Listing 2 consists of a set of tests. The fireunit.ok() method is used to perform assertions about a particular condition (we are doing state verification here). The &amp;lt;reference&amp;gt; comment at the top of the file is used to enable Intellisense for the MathUtility class for Visual Studio/Visual Web Developer (Visual Studio JavaScript Intellisense is an amazing and useful feature). &lt;/p&gt;

&lt;p&gt;Listing 3 consists of an HTML page that includes both the MathUtility and MathUtilityTests JavaScript files. Each of the test methods in the MathUtilityTests class is called by iterating through all of the class methods that start with the keyword &lt;i&gt;test&lt;/i&gt;. Finally, the fireunit.testDone() method is called to display the summary of test results. &lt;/p&gt;

&lt;p&gt;When you open the HTML page in Listing 3 in Firefox, you see the test results in Figure 2.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Listing 3 – Test1.html&lt;/b&gt;&lt;/p&gt;

&lt;pre class="xml" name="code"&gt;&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;html xmlns="http://www.w3.org/1999/xhtml" &amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;
    
    &amp;lt;script src="MathUtility.js" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="MathUtilityTests.js" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;script type="text/javascript"&amp;gt;

        var mathUtilityTests = new MathUtilityTests();

        // Run all tests in MathUtilityTests
        var method;
        for (method in mathUtilityTests) {
            if (method.substring(0, 4) == 'test')
                mathUtilityTests[method]();
        }

        // Display result summary
        fireunit.testDone();
    
    &amp;lt;/script&amp;gt;

&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;

&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/pre&gt;

&lt;p&gt;&lt;b&gt;Figure 2 – Results of opening the Test1.html page&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/UnitTestingJavaScriptwithFireUnit_875D/clip_image006_2.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image006" border="0" alt="clip_image006" src="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/UnitTestingJavaScriptwithFireUnit_875D/clip_image006_thumb.jpg" width="604" height="191" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;Running a Suite of Tests&lt;/h4&gt;

&lt;p&gt;According to the documentation, you should be able to run a suite of tests by using the fireunit.runTests() method like this:&lt;/p&gt;

&lt;pre class="js:nogutter:nocontrols" name="code"&gt;if (fireunit.forceHttp()) {
    // Run all tests in AddTests.htm and SubtractTests.htm         
    fireunit.runTests("AddTests.htm", "SubtractTests.htm");
 
    // Display result summary
    fireunit.testDone();
}&lt;/pre&gt;

&lt;p&gt;In this case, the tests in the AddTests.htm and SubtractTests.htm should be run. Unfortunately, I could not get this code to work. The fireunit.forceHttp() method always returns false.&lt;/p&gt;

&lt;h4&gt;Simulating Browser Events&lt;/h4&gt;

&lt;p&gt;FireUnit overlaps, a little bit, in functionality with an acceptance testing tool such as Selenium. FireUnit includes a small set of methods for simulating browser events:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;· click(node) – Simulates a click event on an HTML DOM node. &lt;/p&gt;

  &lt;p&gt;· focus(node) – Simulates a focus event on an HTML DOM node.&lt;/p&gt;

  &lt;p&gt;· id(id) – Shortcut for document.getElementById().&lt;/p&gt;

  &lt;p&gt;· key(node, letter) – Simulates a keypress event on an HTML DOM node with the specified letter.&lt;/p&gt;

  &lt;p&gt;· mouseDown(node) – Simulates a mousedown event on an HTML DOM node.&lt;/p&gt;

  &lt;p&gt;· value(node, text) – Assigns the text to the value property of an HTML DOM node.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For example, the HTML page in Listing 4 verifies that clicking a button changes the text in a &amp;lt;span&amp;gt; tag to the value &lt;i&gt;Hello World!&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Listing 4 – TestClick.htm&lt;/b&gt;&lt;/p&gt;

&lt;pre class="xml:nogutter:nocontrols" name="code"&gt;&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;html xmlns="http://www.w3.org/1999/xhtml" &amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Test Click&amp;lt;/title&amp;gt;
    
    &amp;lt;script type="text/javascript"&amp;gt;

        function showHello() {
            document.getElementById('message').innerHTML = "Hello World!";
        }
    
    &amp;lt;/script&amp;gt;
    
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;

&amp;lt;button id="btn" onclick="showHello()"&amp;gt;Click Here&amp;lt;/button&amp;gt;
&amp;lt;span id="message"&amp;gt;&amp;lt;/span&amp;gt;


&amp;lt;script type="text/javascript"&amp;gt;
    // Act
    fireunit.click("btn");
    var result = document.getElementById('message').innerHTML;
    
    // Assert
    fireunit.compare("Hello World!", result, "Click displays Hello World!");
    fireunit.testDone();
&amp;lt;/script&amp;gt;


&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/pre&gt;

&lt;p&gt;The fireunit.click() method simulates clicking the button in the page (see Figure 3). The test in Listing 4 uses the fireunit.compare() method to verify that the contents of the message &amp;lt;span&amp;gt; tag match the text &lt;i&gt;Hello World!&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Figure 3 – The fireunit.click() method causes the message to appear&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/UnitTestingJavaScriptwithFireUnit_875D/clip_image008_2.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image008" border="0" alt="clip_image008" src="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/UnitTestingJavaScriptwithFireUnit_875D/clip_image008_thumb.jpg" width="614" height="322" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;Summary&lt;/h4&gt;

&lt;p&gt;I like the FireUnit user interface. In other words, I like the fact that your test results appear in a Firebug tab automatically. Because the interface forces you to see your test results every time you open a page, this interface enables you to make testing a natural part of developing JavaScript code. &lt;/p&gt;

&lt;p&gt;FireUnit is still in its infancy. The framework has a very limited set of features. In particular, it is frustrating that you cannot use FireUnit with browsers other than Firefox. &lt;/p&gt;&lt;img src="http://stephenwalther.com/blog/aggbug/122.aspx" width="1" height="1" /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/StephenWalther?a=paNSCQrdB1o:75z-yVxNEuk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StephenWalther?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StephenWalther/~4/paNSCQrdB1o" height="1" width="1"/&gt;</description>
            <dc:creator>Stephen Walther</dc:creator>
            <guid isPermaLink="false">http://stephenwalther.com/blog/archive/2009/05/18/unit-testing-javascript-with-fireunit.aspx</guid>
            <pubDate>Mon, 18 May 2009 16:45:25 GMT</pubDate>
            <wfw:comment>http://stephenwalther.com/blog/comments/122.aspx</wfw:comment>
            <comments>http://stephenwalther.com/blog/archive/2009/05/18/unit-testing-javascript-with-fireunit.aspx#feedback</comments>
            <slash:comments>16</slash:comments>
            <wfw:commentRss>http://stephenwalther.com/blog/comments/commentRss/122.aspx</wfw:commentRss>
        <feedburner:origLink>http://stephenwalther.com/blog/archive/2009/05/18/unit-testing-javascript-with-fireunit.aspx</feedburner:origLink></item>
        <item>
            <title>My HP Mini Runs Visual Studio 2010</title>
            <category>ASP.NET</category>
            <link>http://feedproxy.google.com/~r/StephenWalther/~3/L625JQd3wzM/my-hp-mini-runs-visual-studio-2010.aspx</link>
            <description>&lt;p&gt;Before my trip to India, I bought an &lt;a href="http://reviews.cnet.com/laptops/hp-mini-2140/4505-3121_7-33485023.html?tag=mncol;lst" target="_blank"&gt;HP Mini 2140 netbook&lt;/a&gt;. It is a beautiful machine. It weighs only  4 pounds. It has a 1024x576 resolution screen (normal width but short height). It has almost a full sized keyboard. My favorite feature is that, theoretically, it has a 6 cell battery that can last 8 hours – a mind-boggling long amount of time.&lt;/p&gt;  &lt;p&gt;The mini came with Windows XP pre-installed. That wouldn’t do. So, I immediately downloaded the &lt;a href="http://www.microsoft.com/windows/windows-7/" target="_blank"&gt;release candidate of Windows 7&lt;/a&gt; and installed it on the netbook. The mini does not have a DVD or CD drive. I copied the Windows 7 download to a USB drive and mounted the drive using Daemon Tools. I was able to &lt;a href="http://www.bwana.org/2009/01/11/how-to-install-windows-7-beta-from-a-usb-drive-to-an-hp-mini-1000-without-vista/" target="_blank"&gt;install Windows 7 from the USB drive&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Next, I installed &lt;a href="http://foldershare.com/" target="_blank"&gt;Windows Live Sync&lt;/a&gt; (what used to be called foldershare). Windows Live Sync keeps the files in the My Documents\Everywhere folder synchronized between my normal laptop, my desktop, and my netbook. I can modify a document in my netbook while riding the Microsoft bus into work in the morning, and have the document changes automatically synchronized with my desktop computer in my office.&lt;/p&gt;  &lt;p&gt;Finally, I installed Visual Studio 2010 on the netbook. I grabbed the latest build right off the assembly line. Most likely, I am violating every recommendation for the minimum configuration of a computer to run Visual Studio 2010, but so far it has run just fine. &lt;/p&gt;  &lt;p&gt;I wasn’t sure if Visual Studio would work on the netbook – the HP Mini’s Atom processor doesn’t exactly make the machine a speed demon. And, you definitely don’t want to run multiple applications while running Visual Studio. However, the experience is good enough to do light coding on an airplane or a bus (I might even try using the netbook to demo Visual Studio 2010 for a talk).&lt;/p&gt;  &lt;p&gt;I did experience a moment during the installation process during which I was sure that installation would fail. Visual Studio complained that I did not meet the minimum screen resolution requirements (my netbook was short by a measly 3 pixels). However, I ignored the warning and everything installed without a hitch.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/MyHPMiniRunsVisualStudio2010_8DC9/image_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://stephenwalther.com/blog/images/stephenwalther_com/blog/WindowsLiveWriter/MyHPMiniRunsVisualStudio2010_8DC9/image_thumb.png" width="184" height="244" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://stephenwalther.com/blog/aggbug/121.aspx" width="1" height="1" /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/StephenWalther?a=L625JQd3wzM:vrswLEH_tvw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StephenWalther?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StephenWalther/~4/L625JQd3wzM" height="1" width="1"/&gt;</description>
            <dc:creator>Stephen Walther</dc:creator>
            <guid isPermaLink="false">http://stephenwalther.com/blog/archive/2009/05/14/my-hp-mini-runs-visual-studio-2010.aspx</guid>
            <pubDate>Thu, 14 May 2009 17:05:38 GMT</pubDate>
            <wfw:comment>http://stephenwalther.com/blog/comments/121.aspx</wfw:comment>
            <comments>http://stephenwalther.com/blog/archive/2009/05/14/my-hp-mini-runs-visual-studio-2010.aspx#feedback</comments>
            <slash:comments>23</slash:comments>
            <wfw:commentRss>http://stephenwalther.com/blog/comments/commentRss/121.aspx</wfw:commentRss>
        <feedburner:origLink>http://stephenwalther.com/blog/archive/2009/05/14/my-hp-mini-runs-visual-studio-2010.aspx</feedburner:origLink></item>
    </channel>
</rss>
