Creating Quick Tests in C#

Update on 5/2/07:  This post has nothing to do with Unit Testing (it was written before I was aware of unit testing) but has to do with write little bits of code to try new stuff out.  It is also only for VS03.  For the current version (VS05), see this post: CoadNet VS Project Templates, Quick Code + Console App for C# in VS05

CoadTools Quick Test C# Project Template (setup .msi) for Visual Studio .NET 2003

Introduction
Very often I need to test a tidbit of code, do some research on a class, etc. In fact, I was creating several times as many quick code test projects as any other project need. I used to start a Console application, change it to a Windows Application, but still needed to add namespaces, etc. So I created a custom “New Project” template for Visual Studio .NET 2003. To use, just install, load VS.NET, choose “New Project”/”Visaul C# Projects”/”Quick Test”, and you’re good to go.

The Goal
The main goal was to minimize the time to test code. Just start VS.NET, choose the “Quick Test” project, and type code. I wanted to send output to the Trace (VS.NET Ouput Window) and have the most common namespaces already included. You can easily modify the template after it is installed to suite your own needs.

Compare and Contrast
A popular tool is Snippet Compiler, which is a stand-alone mini-IDE for testing code. This is a great tool, especially if you do not own VS.NET 2003. When testing, I find that I want the full VS.NET environment, which I’m most familiar with and productive in, and to perform quick MSDN help lookup and take advantage of the full debugging interface. Just a simple custom “New Project” template like this provides all these objectives in a simple manor.

Saving Code
When creating a new quick test project, I usually just store the project in “C:\Temp\Test”. This way I keep my tests for future reference and they are out of the way.

Leave Feedback
This is completely free. All I ask is that you leave a feedback comment. :)

VS.NET 2003 “New Project” Dialog w/ Quick Test Project


Code Template in VS.NET, Fully Customizable

Screen captures have been brought to you by SnagIt. This is my first use of SnagIt, a powerful screen capture utility, and it is fantastic! Extremely easy to use (a big plus for me) and it includes additional editing tools.

5 thoughts on “Creating Quick Tests in C#”

  1. I tried it yesterday with no problems. I forgot that you added a bunch of "usings" and I was surprised that the IDE didn’t complain about my cut and pasted regex code. ReSharper doesn’t like all of the unused "usings", though. It also took me a few mintues to figure out why I wasn’t getting any console output – RTFM…

  2. When I run the installer it says "Visual Studio .NET 2003 is required".

    From within MSStudio->Help->About it says "MS Developement Environment 2003" and "MS .NET Framework 1.1".

    Any ideas?

  3. The installer requires that VS be installed in its default location (on drive C). This is due to a limitation of constraints in the VS setup creator. If someone would like to hook me up with InstallShield, I would gladly create a more dynamic setup procedure.

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>