Test Lint: A Unit Testing Helper for VS 2010

DZone 's Guide to

Test Lint: A Unit Testing Helper for VS 2010

· Agile Zone ·
Free Resource
In an increasingly test-driven software industry, Typemock has successfully filled a growing niche market for unit testing productivity tools.  Typemock offers enterprise tool suites along with a free set of tools.  Recently, Typemock added a new free tool (now in public beta) to their offerings called Test Lint.  The company says its the first and only "coding advisor" for unit tests in Visual Studio 2010.  The free extension helps find common issues in unit test code like  missing asserts, too many asserts, tests calling other tests and more.  Soon you'll even be able to write your own rules for the program.  

Although writing a unit test is easy, it's much harder to write reliable, readable, and maintainable unit tests without much experience.  To aid the less experienced developers and even the more experienced ones, Roy Osherove the chief architect at Typemock and author of "The Art of Unit Testing" wrote down many of the common problems he's seen in his lengthy experience with unit testing.  All of that knowledge was then compiled into a VS 2010 extension called Test Lint.  The program is especially helpful for unit testing newbies. It's a lot like having Roy Osherove as your own personal coach helping you in real time.

Test Lint gets its name from a type code-flagging program for C.  Lint-like tools are generally ones that perform static source code analysis.  Test Lint parses your code as you type it and you are notified about a possible issue with a visible queue in the right margin every time the program sees a problem.  As the beta progresses, more rules will be added and users will be able to write their own rules within Test Lint's parsing infrastructure once the documentation is complete.

Test Lint currently searches for these problems:

  • Missing asserts
  • Multiple asserts or verifications on different objects within the same test
  • Tests invoking other test methods
  • Logic mistakes such as loops, Ifs, Switches, etc.

Test Lint supports these testing frameworks:

  • Microsoft Test Framework
  • XUnit.NET
  • NUnit
  • CsUnit
  • MbUnit
  • .NET BDD releated frameworks such as SpecUnit

To install and use Test Lint you simply unzip the package and install it on VS 2010 while the program is not running.  After that, you just start coding a new test or open up existing test code and Test Lint will begin parsing and coaching you.  You will be asked to update after 30 days so that you aren't running the least stable version.

Other Typemock tools:

  • Typemock Racer - Makes it easier to locate, reproduce, and debug deadlocks.
  • Typemock Tracker - Measures the ROI of unit testing and collects implementation productivity statistics for graphical analysis.
  • Typemock Isolator 2010 - Works as a guide with intelligent code completion and discoverable APIs.  It isolates code without any restriction and without setting up any complex configuration. It also helps set the behavior for entire hierarchies in a single line with test-writing help for complex scenarios.

You can see Test Lint in action by viewing this video.  The Typemock developers are considering a GA release of Test Lint around the VS 2010 release.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}