Share via


mitchell.toolbox.brwsrshts.gif

Figure mitchell.toolbox.brwsrshtsDESCRIPTION_GOES_HERE(Click the image for a larger view)

mitchell.toolbox.chen.gif

Figure mitchell.toolbox.chenDESCRIPTION_GOES_HERE(Click the image for a larger view)

mitchell.toolbox.cover.gif

Figure mitchell.toolbox.coverDESCRIPTION_GOES_HERE(Click the image for a larger view)

mitchell.toolbox.typemock.gif

Figure mitchell.toolbox.typemockDESCRIPTION_GOES_HERE(Click the image for a larger view)

msdn magazine

Contents

Better Browser Compatibility Testing
Blogs of Note
Unit Testing with Mocks
The Bookshelf
Send your questions and comments for Scott to toolsmm@microsoft.com.
All prices confirmed at press time and are subject to change. The opinions expressed in this column are solely those of the author and do not necessarily reflect the opinions of Microsoft.

Better Browser Compatibility Testing

When Web developers sleep at night they dream that all Web browsers follow HTML standards to the letter. They imagine a world where every Web surfer has the same monitor resolution, color depth, and font size. Unfortunately, reality could not be more different. During waking hours, Web developers must design their Web applications to function properly in a seemingly infinite number of configurations.

Creating a thorough Web testing environment can be tedious and time consuming, requiring installation of several different browsers, versions, and operating systems. Remote Web-based testing environments take this burden off the developer.

One such service is Browsershots. After specifying a URL, Browsershots takes and displays screenshots using the selected browser, version, and operating system combinations. There are 53 different combinations available, plus you can specify client settings such as screen size, color depth, and JavaScript support. The Browsershots service is free, but there can be wait times ranging from less than a minute to half an hour or more, depending on the number of requests being processed. For $15 per month, you can sign up for priority processing, which shuttles your requests to the front of the queue.

While screenshots are useful for seeing how a Web site looks in a specific browser, it does not reveal how the site behaves as the user interacts with it. To perform this type of testing, use BrowserCam. BrowserCam offers screenshots like Browsershots, but also includes remote access to a variety of operating systems and browsers. This allows you to log into a machine, configure its settings, and interact with your Web site.

Price: Browsershots (free); BrowserCam ($89.95/month for Premium).

browsershots.org

browsercam.com

Blogs of Note

Have you ever wondered why it is that you have to click the Start button to shut down your computer? Or how about why the Windows® operating system debugger is called "Dr. Watson?" Do you know what computer game's inoperability issues threatened to delay the Windows XP SP2 beta release? And does anybody know why the registry is called a "hive?" Raymond Chen knows.

Raymond joined Microsoft in 1992 as a software engineer for Windows 95, and he's a virtual repository of historical Windows information. In his blog, The Old New Thing, he answers these questions and tackles lots of other Windows legacies. Raymond was there when many of the Windows design decisions were made, so he has first-hand knowledge of the thinking behind them. His insider knowledge and dry wit make Raymond's blog an entertaining and educational read.

Oh, and by the way: the Windows registry is called a "hive" because one of the Windows NT® developers hated bees, and the joke was on him. But the really important decisions, however, were made with one goal in mind: to ensure backward compatibility. Raymond does a great job of highlighting the intense effort that has gone into backward compatibility to ensure that your old 16-bit Visual Basic® application or your favorite MS-DOS® game still works as expected in the more modern versions of Windows.

In addition to his blog entries on the history of Windows, Raymond writes the popular Windows Confidential column for TechNet Magazine (.com) and he regularly posts an assortment of tips and tricks for Windows programmers.

go.microsoft.com/fwlink/?LinkId=115142

Unit Testing with Mocks

Good unit tests are terse, execute quickly, and are independent of one another. When testing any functionality that has external dependencies, such as databases, Web services, or configuration files, extra steps must be taken to achieve these goals. One option is to record the state of the external dependency prior to executing each unit test, then restore that state after each test completes. Such excessive setup and teardown tasks can dramatically slow the execution of unit tests and shift the focus from writing unit tests to managing the state of external dependencies.

An alternative option is to simulate calls to the external dependencies using mock objects. During a unit test, the mock object replaces the actual logic used to access the external dependency. Because the code being tested works with the mock object instead of the actual external dependency, there's no need for complicated setup and teardown logic. What's more, mocked objects allow the interactions between your code and the external dependency to be tested explicitly.

There are several open-source and commercial mocking frameworks with varying syntax requirements for mocking objects. Some frameworks use hardcoded strings for specifying the objects to be mocked and the functionality to be simulated. Others use strongly typed objects, which help identify errors at compile time rather than run time.

Typemock Isolator (version 4.2) is a mocking framework that offers you both approaches. Regardless of which approach you decide to choose, the semantics of using mock objects in your unit tests are the same: you begin by defining the mock object, then specify how the tested code will interact with it, execute the code, and then verify that the results are in line with your expectations.

Typemock distinguishes itself from many other mocking frameworks with its tools and integration support. It can be difficult to debug unit tests that use mocked objects because it's not always clear when the mocked object is being used in place of the actual external dependency.

The Trace Utility helps to resolve that difficulty by identifying how the mocked objects are being used. It records and displays the mocked types and all of the calls made to them during the execution of the unit tests. When it's debugging unit tests, Typemock reveals what's being mocked by outlining the mocked members in the IDE. Additionally, Typemock also integrates into the Visual Studio® shell and help systems and includes support for automating your unit tests with NAnt and MSBuild.

Typemock supports the Microsoft® .NET Framework versions 1.1 and later, and it offers a free Community Edition, along with the more feature-rich Professional and Enterprise editions.

Price: Free Community Edition;

$449 for Enterprise Edition.

typemock.com

The Bookshelf

Since the .NET Framework 2.0, subsequent versions have added new features while keeping the core functionality in place. This poses a dilemma for authors writing books on post-2.0 versions of the .NET Framework: do you focus on just the new features or do you create a book that covers the new features plus the stuff that's been around since version 2.0?

At nearly 1,500 pages, it's eminently clear that Matthew MacDonald and Mario Szpuszta, coauthors of Pro ASP.NET 3.5 in C# 2008 (Apress, 2007), chose the latter. The book's 33 chapters cover it all, from creating the simplest Web Forms to using cutting- edge features like AJAX and Silverlight™.

The book begins with an overview of ASP.NET fundamentals such as Web Forms, Web controls, and state management, then moves on to ADO.NE T, LINQ, ASP.NET AJAX, Silverlight, and more. The authors discuss virtually all the features in ASP.NET, but focuses on those most commonly used.

If you are an intermediate to advanced developer with past Web development experience and are interested in learning ASP.NET 3.5, pick up a copy of Pro ASP.NET 3.5 in C# 2008.

Price: $59.99.

SIDEBAR HEADER GOES HERE

Cross Browser Testing, Mock Objects,

And Raymond Chen

Scott Mitchell

Microsoft.com in Browsershots

Typemock Trace Utility

Scott Mitchell, author of numerous books and founder of 4GuysFromRolla.com, is an MVP who has been working with Microsoft Web technologies since 1998. Scott is an independent consultant, trainer, and writer. Reach him at Mitchell@4guysfromrolla.com or via his blog at ScottOnWriting.NET.

SIDEBAR HEADER GOES HERE

Send your questions and comments for Scott to toolsmm@microsoft.com.

All prices confirmed at press time and are subject to change. The opinions expressed in this column are solely those of the author and do not necessarily reflect the opinions of Microsoft.

Raymond Chen's Blog: The Old New Thing