In This Issue

Developer Perspectives

  • The Classics: Testing, Testing 1 2 3
  • eLibrary Short Takes

  • Need a Good Book to Read?
  • White Paper Describes How to Revolutionize the Way You Work with Data
  • SQL Server Magazine Is Searching for Innovators
  • Tech Talk

  • For 'um Developers
  • Letters to the Editor
  • Info to Go


    Sponsor: AVIcode

    Troubleshooting .NET Applications - Knowing Which Tools to Use and When 80% of all software released into production will fail due to quality issues, but proactively monitoring applications throughout the lifecycle will improve quality and reliability. Learn about the two fundamental categories of application errors and methods for quickly pinpointing the root cause of functional errors. Download the whitepaper today! http://www.sqlmag.com/go/whitepapers/avicode/nettroubleshooting/?code=DEVTop0818


    Developer Perspectives
    by Bill Sheldon, bills@interknowlogy.com

    The Classics: Testing, Testing 1 2 3

    Editor's Note: If you're an avid reader of Developer Update, you might feel a sense of deja vu when reading this column. Don't panic--it ran in July 2005. However, the message is an important one, so we're running this classic column again for all those people who didn't get a chance to read it the first time.

    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, 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.


    Sponsor: Neverfail

    SQL Server Guide to Clustering Alternatives
    Want the convenience of a server cluster without the expense? Learn about server cluster alternatives that provide high availability, preventative maintenance, and fallover capabilities at pricing that fits your budget.
    http://www.sqlmag.com/go//whitepaper/neverfail/sqlclustering/?code=DEVMid0818


    eLibrary Short Takes

    Need a Good Book to Read?
    If you're looking to read a good book this summer but you're not sure what book to read, SQL Server expert Brian Moran has a suggestion: the July update of SQL Server 2005 Books Online (BOL). He writes, "...do yourself a favor: Download this refresh to make sure you have the latest and greatest copy of what is arguably the single most valuable source of SQL Server information you can have." For more information about this release and the link to the download, go to the SQL Server Perspectives column "Summer Reading: The Latest Version of BOL" at http://www.sqlmag.com/Articles/Index.cfm?ArticleID=92934&DisplayTab=Article.

    White Paper Describes How to Revolutionize the Way You Work with Data
    Increase your SQL production server's performance by offloading Reporting Services to a secondary server. Gain additional insight into your important business data quickly and effectively. Download the whitepaper today!
    http://www.sqlmag.com/go/whitepapers/doubletake/reportingservices/?code=0816emailannc

    SQL Server Magazine Is Searching for Innovators
    If you've developed a resourceful solution that uses SQL Server technology to solve a business problem, you qualify to enter the 2006 SQL Server Magazine Innovators Contest. Grand-prize winners will receive airfare and a conference pass to SQL Server Magazine Connections in Las Vegas, November 6-9, 2006, plus more great prizes and a feature article about the winning solutions in the January 2007 issue of SQL Server Magazine. The contest runs through September 1, 2006, so enter today.
    http://www.sqlmag.com/awards/?type=innovator

    Tech Talk

    For 'um Developers

    Forum participant Desperado is hearing all kinds of horror stories in regard to Common Language Runtime (CLR) and SQL Server 2005. One is that all CLR code must be in only one assembly. To find out whether or not this horror story is true, go to
    http://sqlforums.windowsitpro.com/web/forum/messageview.aspx?catid=110&threadid=46288&enterthread=y

    Letters to the Editor
    What's on your mind? Let us know at kbemowski@windowsitpro.com.


    2006 Watch

    FREE SQL Server 2005 Training CD-ROM!
    Start learning SQL Server 2005 today with award-winning training from AppDev. Get a FREE training CD -- 3 hrs of training including labs and printable courseware -- a $115 value! Click here for your FREE SQL Server 2005 training!
    http://www.appdev.com/promo/RN00437


    Info to Go

    Learn how a database utility for SQL Server can help you lower operational costs, simplify management, and increase the availability of your SQL Server deployment. On-demand Web seminar:
    http://www.sqlmag.com/go/seminar/polyserve/availability/?partnerref=0816emailannc

    Incorporate Virtual Machines into Your Disaster Recovery Plan
    Join us for this free Web seminar to learn how incorporating VMs into your disaster recovery plan can reduce your TCO by 50% or more, reduce hardware cost, and simplify management. Attend the live Web seminar and get your questions answered by industry leaders from VMware and CA XOsoft. Live Event: Tuesday, September 19.
    http://www.windowsitpro.com/go/seminars/xosoft/virtualmachines/?partnerref=0816emailannc

    Is your continuity solution letting you down? If you're not getting 100% coverage against lost or missing messages, even for short, unplanned outages, you might be jeopardizing your messaging system's integrity and your company's productivity. Learn how to manage disruptions to your messaging environment without breaking the bank in the process. View the on-demand Web seminar today!
    http://www.windowsitpro.com/go/seminars/messageone/neverlose/?partnerref=0816emailannc

    Use policy-based deployment to easily configure and deploy throughout your organization desktop spyware protection that provides AD support, an easy Admin Console for centralized management, and one of the most robust spyware threat databases in the industry. View the demo today!
    http://www.windowsitpro.com/go/download/sunbelt/counterspydemo/?code=0816emailannc