MSDN Magazine - February 2008 - (Page 12) Write Tests against Your Web Apps with Watin name textbox, a password in the password textbox, and then click the login button. The code for your test is displayed in the box at the bottom of the application. You can then copy this code out or save it directly from the recorder. After copying or saving the test, you will then need to add assertions. Using the previous example, you would write an assertion that logged in successfully. The assertion could either test that the browser redirected to the correct page or look for a certain section of text on that page. Watin can be a great replacement for manually testing your Web application over and over again and helps you quickPrice: Free; source code available. watin.sourceforge.net watintestrecord.sourceforge.net Watin interfaces with the Internet Explorer® object to launch and interact with the browser in the same way that your user would. Watin can enter text checkboxes and buttons, and read values from your forms and pages. You can even sit and watch Watin do its work on your screen, which, with the help of a cleverly hidden book, can make it appear that you are working really hard. Watin tests are written using your favorite unit-testing framework in conjunction with the Watin library. The Watin library provides the methods and objects needed in order to interface with the Internet Explorer object while your testing framework provides the tests and assertions. Watin tests can be somewhat frustrating to write by hand. To identify textboxes and buttons, you have to use the client the source of your page or using one of the various popular browser toolbars. An even better way to write Watin tests, though, is by using another open source project called the Watin Test Recorder. The Watin Test Recorder is a Windows Forms application that lets you create and record Watin tests by walking through the test using the browser. To create a simple test, you would only need to navigate to the page, name your test, and then perform the actions that are needed to replicate your test. For example, you might navigate to your home page and enter a user name in the user A New Testing Framework The Microsoft® .NET Framework has a number of established unit-testing frameworks including nUnit, csUnit, and new framework was launched called xUnit.net. A couple of things make this framework stand out from the existing framebuilt by James Newkirk and Brad Wilson. Newkirk, who helped build nUnit, is a product manager at Microsoft responsible for CodePlex, and he has written a number of books about unit testing. terns and practices team, and a fellow Microsoft employee. The goal with this new framework was to take the best practices learned over the past half-decade about unit testing and build a new framework that embodies and encourages those practices. There are quite a few changes in this 12 msdnmagazine Toolbox http://watin.sourceforge.net http://watintestrecord.sourceforge.net http://www.cete.com http://www.cete.com
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.