Search The Blog
About this site

@RoyOsherove

Subscribe!

This site aims to connect all the dots of my online activities - from tools, books blogs and twitter accounts, to upcoming conferences, engagements and user group talks.

from 5whys.com
Twitter: @RoyOsherove
My Book: The Art of Unit Testing
Latest Posts
« Setting the record straight on MVP newsgroups | Main | Lessons learned from IVBUG »
Friday
Feb062004

Doing Test Driven Development with no DLLs

Doing test driven development often(well, practically always) entails testing against a class library in your tests. It's just the easiest way to test functionality of objects (you need to reference those objects somehow, right?) so, most of the time you would create a test project and a tested library project before you ever create a GUI or a console application that uses that library.
But what happens when you have a very small project? say, a very simple console application with a very small set of functionality? Well, in the TDD manner you would have the console app built along with a library project that contains the classes that do the functionality. But it may seem a bit like overkill to have 3 separate projects for a such a simple task. Or maybe the customer will not want to distribute the console app along with a dll for something so simple as say... renaming files in the directory based on some simple business logic. Maybet he requirement is that the user should only have to copy one exe file into the directory and run it with no hassles.
 
So.After all this text, what do you do when you can't use a library project for a very simple functionality?
 
You don't create a library project. Instead you create the necessary class(es) in your console app.
Then you link to those class files from your test project:
 
“MyTestProject->Add existing files->select the class file-> open the small menu on the “open” button and choose “link”.
 
Now you have a physical reference to the classes but you actually have only one instance of the class files for you to work with. This is as good as it gets for very small projects with a harsh requirement of “no DLLs please”. Use it wisely, grasshopper.

PrintView Printer Friendly Version

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>