Home > Microsoft .Net Development Tips > Application Testing and Security > Unit test facility in Visual Studio Team System
Win Development Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

APPLICATION TESTING AND SECURITY

Unit test facility in Visual Studio Team System


Ed Tittel, Contributor
04.28.2006
Rating: --- (out of 5)


.NET Essentials Channel
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


These days, Microsoft seems to offer an ever-growing number of SKUs for its software packages. Last I heard, in fact, the upcoming Windows Vista (desktop) release will include no less than six and perhaps even seven! The same phenomenon applies to Visual Studio, for which at five SKUs are presently available. Because I always wonder why developers might opt for one version over another, my curiosity about the penultimate version of Visual Studio 2005 -- namely, Visual Studio Team System -- was sated to some degree when I learned that this product version includes unit testing capabilities.
Unit-testing subscribes to the theory that if all methods run correctly by themselves, they'll work together more effectively and cooperate better to implement complete applications.

Unit test means testing the smallest executable code elements one at a time to inspect them for potential design or security policy deviations, and to check program logic and behavior to make sure it behaves as specified and is free of errors.

This has been a cornerstone of software testing methodology since the 1970s, but Visual Studio itself hasn't included this functionality as part and parcel of its capabilities until Visual Studio Team System came along. To put this apparent gaffe in context, it's also important to understand that many development environments -- including those based on Java -- also don't provide explicit unit test facilities. And even venerable value-added IDEs such as Delphi offer only limited unit test capabilities themselves in their latest and greatest versions. This has long been the exclusive province of third-party testing tool vendors.

Those interested in using an automated unit test capability are well-advised to keep this desire in mind when they design their software as well as the tests needed to warrant and inspect its capabilities. The terms "unit test" and "testing driven design" often occur near one another, for the very good reason that code designed with testing in mind is typically much easier to test (and to test both well and completely) than code designed with testing as an afterthought.

Unit test does not replace functional testing, system testing or integration testing. What it does do is prevent issues in individual classes and methods from cropping up when those other, more comprehensive testing stages are underway. Look at is this way: when software fails, it's invariably because a method fails. Unit-testing subscribes to the theory that if all methods run correctly by themselves, they'll work together more effectively and cooperate better to implement complete applications.

What Visual Studio Team System brings to this party is an ability to create tests by clicking inside a program class and selecting "Create Unit tests…" from the resulting pop-up menu. This provokes a Create Unit Tests dialog that allows authorized users (usually testers) to select object properties to interrogate and inspect during runtime. The result is a new test project that will exercise the specified elements when run.
More on Team System, application testing

Testing and Debugging Learning Guide

Visual Studio 2005 Team System Learning Guide

After that, it's a matter of applying the proper test methods, which include attributes such as TestClass, ClassInitialize, ClassCleanup, TestInitialize, and TestCleanup, all of which give you a good idea of what you're up to. A testContextInstance object exists to provide access to any and all information about tests underway, and provides a windowing service to perform code tracing, data-driven testing, and more. Likewise, there are explicit methods to check exceptions. Some rely on checking for expected exceptions, while others require traps to catch unexpected values and behaviors.

All this adds up to testing facilities that even work with data sets from a local database to help create data-driven test sequences. This functionality is indeed valuable, but individuals and organizations must decide if it's valuable enough to warrant the $5,000-plus MSRP that Microsoft put on its price tag, or the $3,500-plus "street price" you'll have to pay for this version of Visual Studio 2005. Those for whom such numbers give pause must weigh the costs and consequences of using other tools instead or handling unit test manually. Those who can afford this functionality can't help but find it extremely useful.

Ed Tittel is a writer and trainer whose interests include XML and development topics, along with IT Certification and information security. E-mail etittel@techtarget.com with comments, questions, or suggested topics or tools to review. Cool tools rule!

Rate this Tip
To rate tips, you must be a member of SearchWinDevelopment.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
.NET Architecture
Microsoft's Oslo modeling platform, the M language and .NET
Introduction to ASP.NET's Model View Controller (MVC) Design Pattern
Free book from Microsoft brings patterns and practices to .NET
A look at concurrency constructs and primitives in .NET
Designing Windows Communication Foundation service contracts
Book excerpt: Java EE and .NET security interoperability
Book excerpt: .NET Framework Design Guidelines
Book Excerpt: Executing activities in Windows Workflow Foundation
Aspect-oriented programming (AOP) and the .NET Framework
Book excerpt: Hands-on Windows Communication Foundation

Application Testing and Security
Test-driven development in .NET yields complete unit test coverage
How to write installers in Vista that work correctly under UAC
How to elevate programs' privileges correctly using Vista's UAC
Internet Explorer 8 beta's development tools add source visualizations
Microsoft previews new features in Visual Studio 2010
Advanced Windows Debugging Book Chapter and Podcast
Book excerpt: Advanced Windows Debugging
Book excerpt: Pragmatic unit testing in C# with NUnit
Security interoperability with .NET/WSE and WebLogic Workshop 8.1
How to avoid regression bugs while adding new features

.NET Framework security best practices
New features in Windows 7 bring new UI considerations for developers
Podcast: Windows CardSpace authors speak
Book excerpt: Java EE and .NET security interoperability
Book excerpt: Advanced Windows Debugging
Book excerpt: Pragmatic unit testing in C# with NUnit
Security interoperability with .NET/WSE and WebLogic Workshop 8.1
Windows Developments: Product news, December 2007
How to avoid regression bugs while adding new features
VB code: New additions, November 2007
VB code: Application security downloads

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
common test platform  (SearchWinDevelopment.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Database Programming Solutions - .NET XML, Visual Studio LINQ, ORM .NET
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2000 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts