Developer .NET UPDATE--Testing 1 2 3--July 15, 2005
Although it’s not that fun, testing is an important task when developing .NET applications. Fortunately, Microsoft's Team Edition for Developers (TED) product suite includes automated tools for testing.
July 14, 2005
This Issue Sponsored By
This email newsletter comes to you free and is supported by the following advertisers, who offer products and services that might interest you. Please take a moment to visit these advertisers' Web sites and show your support for Developer .NET UPDATE.
SQL Server Magazine Monthly Pass
http://www.sqlmag.com/rd.cfm?code=mteu2157mp
Free SQL Anywhere Developer Edition
http://crm.sybase.com/sybase/www/iAS/download_outside_sqlservmag.jsp
FREE preview CD for ASP.NET 2.0 Using VS 2005!
http://www.appdev.com/promo/RN00205
1. Developer .NET Perspectives
Testing, Testing 1 2 3
2. Events and Resources
New Cities Added--SQL Server 2005 Roadshow in a City Near You
Celebrate the Launch of SQL Server 2005 Nov 7-10, 2005 at Mandalay Bay in Las Vegas
You Could Win An iPod Mini!
Learn to Sort Through Sarbanes-Oxley, HIPPA, and More Legislation Quicker and Easier!
3. Featured White Paper
Is Your Company Legally Required to Have an Email Compliance and Retention Policy?
4. Announcements
July Special--Get SQL Server Magazine at 44% Off!
The 2005 Innovator Awards Are Coming!
5. New and Improved
Save Time with Code Generator for Visual Studio .NET
Virtual Technology Network for Developers
Sponsor: SQL Server Magazine Monthly Pass
SQL Server Magazine Monthly Pass = Quick Answers!
Sign up today for your SQL Server Magazine Monthly Pass and get 24/7 online access to every article on the SQL Server Magazine Web site, including exclusive subscriber-only content. That's a database of over 2,300 SQL Server articles to help you get all the answers you need, when you need them - loads SQL Server 2005 articles included! Sign up now:
http://www.sqlmag.com/rd.cfm?code=mteu2157mp
1. Developer .NET Perspectives
by Bill Sheldon, [email protected]
Testing, Testing 1 2 3
Concentrating on testing is one of the most challenging tasks for developers. I've lost count of the number of times a developer has raced into my office to tell me that a piece of software is done, only to race back out of my office when I ask, "Have you tested it?" However, that isn't as bad as the response, "Well I'm not sure this code can be tested before we send it to integration, because ...." The fact is most developers are lousy testers.
Don't get me wrong. I understand that testing isn't exactly the most exciting activity, especially since in the past, most developers accompanied each DLL or back-end component with a custom Windows Form that could act as a test harness. What occurs then is the creation of custom code to call the methods, set up the conditions, and ensure the code works correctly. Unfortunately, even this type of testing is only as good as the person writing the tests, so the axiom that most developers are lousy testers bears repeating.
I also understand that it takes a long time to develop tests and that most organizations fail to treat even automated test frames with the same level of source control as the code. Thus, unit testing is often something that is cut in each project. Most of the testing effort is instead focused on integration testing after the software is "complete." However, this all-too common approach results in applications spending too long in the first round of integration testing because bugs unrelated to integration must be resolved. And if the bugs aren't caught during integration testing, they might surface during maintenance--and a fix at that time might actually break an existing application.
Fortunately, software developers are beginning to implement better testing approaches. For starters, some developers now follow a test-based development model. Just as there are developers who start the development process with Use cases or Joint Application Design (JAD) sessions (which involve end users), these developers start by defining a set of tests, then use that test set to develop software. This description is an oversimplification of the process. If you want to learn more about this model, go to http://www.testdriven.com.
I subscribe to a different model in which software design includes, in most cases, test planning. I still find that most companies are surprised when I ask to have members of the testing team participate in late-stage design discussions. The idea is that testers in the room will be less interested in what a feature should do than how they'll determine whether it's broken. Thus, testers tend to ask a lot of "What if?" questions. When captured, these questions result in requirements and design specifications that are much more detailed. The testers aren't focusing on what features they want but rather what the exceptions will need to be.
Talking about testing is good, but using tools to help automate the process is even better. Some organizations have begun to develop automated test tools. A good example is Nunit (http://www.nunit.org). NUnit is freeware designed to automate the testing of .NET applications.
Microsoft has also developed automated test tools for testing its own applications before they're shipped. Most of these automated test tools are custom in-house applications that Microsoft has maintained over the years.
Because Microsoft performs unit testing on its own products, it isn't surprising that Microsoft's Team Edition for Developers (TED) product suite includes tools for unit testing. What might be a bit surprising is that TED's unit-testing tools are somewhat similar to those you'll find in NUnit. In fact, there's even a converter (http://www.gotdotnet.com/workspaces/workspace.aspx?id=91936c5e-461f-4027-bdba-8a46f52fefdb) to take your NUnit tests and convert them into the Visual Studio Team System Test format.
To unit test an application in Visual Studio 2005 beta 2, you need to find a new menu called Test. On the Test menu is an option to create a new test. When you select this option, you receive a dialog box that looks amazingly similar to the New Project dialog box. It's similar because, under Team System, tests are collected in Test Projects.
I recommend that you start by using the Unit Test Wizard to automate the generation of most of your initial tests. The wizard is a great way for you as a developer to jumpstart your knowledge about automated testing. After answering a few questions, Visual Studio 2005 will create your new test project and populate it with a collection of test classes. These classes contain the code that fully exercises (i.e., tests) your project. Using this generated code as a starting point, you can then add custom test examples. Let me be clear--as with any generated code, the generated test code is generic. For your tests to have meaning and value, you need to customize them. A good place to learn more about the customization of tests is from the Microsoft Developer Network (MSDN) at http://msdn2.microsoft.com/library/ms182409(en-us,vs.80).aspx.
Testing goes beyond just developing tests; it includes running tests and analyzing test results. With Visual Studio 2005's new test projects, you have windows that let you review a project's "code coverage" and review test results. "Code coverage" refers to the percentage of code that has actually been tested. In other words, it lets you know which code in your application has been exercised and which methods haven't been exercised. This metric is important because new features can be added to existing code and tests might not have been updated to account for the new methods. The fact is that with the Team System testing tools, you can get a lot of information about your application's readiness. A good resource for learning to leverage these test tools is the VSTS Quality Tools blog at http://blogs.msdn.com/vstsqualitytools.
As I mentioned previously, most developers are lousy testers--and the best developers are avid testers. In this column, I've talked about unit testing, but that's not the only type of testing you'll need to perform on your application. In Visual Studio 2005 beta 2, you have access to all the Team System test tools, including tools for load testing. Of course, this will change after the beta period, when TED users will have access to only the unit test tool. I covered the load test tool, Application Center Test (ACT), in the column "ACT Up" (http://www.windowsitpro.com/articles/articleid/25461/25461.html). The new version in the Team System has several new features that definitely deserve coverage. I'll cover those features in future column.
2. Events and Resources
(brought to you by SQL Server Magazine)
New Cities Added--SQL Server 2005 Roadshow in a City Near You
Get the facts about migrating to SQL Server 2005. SQL Server experts will present real-world information about administration, development, and business intelligence to help you implement a best-practices migration to SQL Server 2005 and improve your database computing environment. Attend and receive a 1-year membership to PASS and 1-year subscription to SQL Server Magazine. Register now!
http://www.windowsitpro.com/roadshows/sqlserverusa/index.cfm?code=0713emailannc
Celebrate the Launch of SQL Server 2005 Nov 7-10, 2005 at Mandalay Bay in Las Vegas
Microsoft will give every attendee a copy of SQL Server 2005 and Visual Studio 2005. SQL Server Magazine Connections is co-located with Microsoft ASP.NET Connections and Visual Studio Connections.
http://www.devconnections.com
You Could Win An iPod Mini!
Your expert opinion makes a difference--tell us what you think about industry conferences and events. Your feedback is very valuable to us. Take this short survey today!
http://www.pentonsurveys.com/survey.asp?s=01033250254096156108
Learn to Sort Through Sarbanes-Oxley, HIPPA, and More Legislation Quicker and Easier!
In this free Web seminar, get the tips you've been looking for to save time and money in achieving IT security and regulatory compliance. Find out how you can simplify these manually intensive, compliance-related tasks that reduce IT efficiency. Turn these mandates into automated and cost-effective solutions. Register now!
http://www.windowsitpro.com/seminars/regulatorycompliance/index.cfm?code=0713emailannc
3. Featured White Paper
Is Your Company Legally Required to Have an Email Compliance and Retention Policy?
Gain an understanding of general retention and compliance issues and Microsoft Exchange Server's built-in archiving and compliance features and get guidance on the first steps to take when starting an archiving regime. Plus--discover how to analyze trends and usage across your messaging store.
http://www.windowsitpro.com/whitepapers/sherpa/exchangecompliance/index.cfm?code=0713emailannc
2005 Watch: Free SQL Anywhere Developer Edition
Chances are, your customers run your application on off-the-shelf hardware without on-site systems administrator support, but your applications may require enterprise-level data management capabilities. With over 9 million deployments, SQL Anywhere(R) is the ideal DBMS for applications running outside traditional data centers.
http://crm.sybase.com/sybase/www/iAS/download_outside_sqlservmag.jsp
4. Announcements
(brought to you by SQL Server Magazine)
July Special--Get SQL Server Magazine at 44% Off!
Get SQL Server Magazine and get answers! Act now to get an entire year for just $39.95--that's 44% off the cover price! You'll also gain exclusive access to the entire SQL Server Magazine article database (over 2300 articles). Bonus: The Top SQL Tips handbook (over 60 helpful tips). This is a limited-time, risk-free offer, so click here now:
http://www.sqlmag.com/rd.cfm?code=sfeu2157du
The 2005 Innovator Awards Are Coming!
This year's competition is calling for a cutting-edge SQL Server solution that solves a real world problem and/or improves performance. One grand-prize winner will win a free trip to the 2005 SQL Server Magazine Connections conference in Las Vegas. Fill out an entry form today and get the recognition you deserve! Click here for more information:
http://www.sqlmag.com/awards
Hot Spot: FREE preview CD for ASP.NET 2.0 Using VS 2005!
Get introduced to ASP.NET 2.0 with this FREE CD from AppDev. It provides an overview of the exciting and powerful new features so you can be productive as soon as possible. Click the link below for your free ASP.NET 2.0 CD.
http://www.appdev.com/promo/RN00205
5. New and Improved
(by Karen Bemowski, [email protected])
Save Time with Code Generator for Visual Studio .NET
Tangible Engineering released Tangible Architect 2.0, a model-driven code generator for Visual Studio .NET. With numerous new features and enhanced usability, version 2.0 offers software developers and IT departments an easy-to-use solution to accelerate the development of database solutions. Software developers define their business objects using a Unified Modeling Language (UML) model, Tangible Architect class view wizards, or C# interfaces. Tangible Architect then generates the business objects, including data access code, from within Visual Studio .NET. The developer can then extend the business objects and bind them to the presentation layer using data binding. In doing so, handcrafted code size is reduced by up to 70 percent. Pricing starts at $250; a free trial version is available. For more information, contact Tangible Engineering at (49) (0) 700-82644253, (49) (0) 7021-4810192, or [email protected].
http://www.tangible.de
Virtual Technology Network for Developers
VMware introduced the VMware Technology Network (VMTN), an online virtual infrastructure resource center for software developers and IT professionals. VMTN includes free resources, such as prebuilt application environments for VMware virtual machines, VMware product documentation, discussion forums, and insights from virtualization experts. The center also includes VMTN Subscription, a suite of VMware products, support, and upgrades for developers and testers. VMTN Subscription costs $299 per user annually. For more information, contact VMware at 650-475-5000, 877-486-9273, or [email protected].
http://www.vmtn.net
Contact Us
About Developer .NET Perspectives -- [email protected]
About technical questions -- http://www.sqlmag.com/forums
About product news -- [email protected]
About your subscription -- [email protected]
About sponsoring an UPDATE -- contact Richard Resnick, [email protected], or Lisa Kling, [email protected]
Developer .NET UPDATE is brought to you by SQL Server Magazine, the only magazine devoted to helping developers and DBAs master new and emerging SQL Server technologies and issues. Subscribe today.
http://www.sqlmag.com/rd.cfm?code=00ep214xeb
View the SQL Server Magazine Privacy Policy
http://www.winnetmag.com/aboutus/index.cfm?action=privacy
SQL Server Magazine is a division of Penton Media, Inc. 221 East 29th Street, Loveland, CO 80538, Attention: Customer Service Department
Copyright 2005, Penton Media, Inc. All Rights Reserved.
Read more about:
ITPro TodayAbout the Author
You May Also Like