What Test-Driven Scaffolding (TDS) does...

TDS is a slightly relaxed version of Test-Driven Development (TDD) for C# projects. It includes a Visual Studio snippet to create drivers of function members of C# types, such as methods or indexers, and (optionally) generating test reports.

Version 1.8.2 is available (including examples)

New TDS code is available on the Downloads tab.

For examples using Text Template (*.T4) files and Entity Data Model (*.edmx) files, see release version 1.8.

(See the FAQ below for FAQ-style questions..)

When you develop a new function member for a C# type or modify an existing one, you must often also write some additional calling code that exists only to exercise the code that you are developing – the code you're really interested in.

The software provided on this site (as public-domain C# source code) is intended to help you quickly produce this exercising or calling code. It includes example test methods that you may copy, and a Visual Studio snippet to generate similar test methods, which you may use and modify instead of writing custom code each time. You might use these methods simply to provide inputs to your code to facilitate tracing, or you might adapt them to inspect the results and produce a report. Both of these uses are illustrated in the tutorial examples. Example command-line scripts are also included that may be used to run the finished tests automatically.

Basic instructions and examples are provided in the downloadable C# source-code file. The TDS code can support building a new function member (such as a method), then, after the new code is functional, the TDS code can easily be removed without affecting the new function member, in a manner similar to removing the scaffolding on a completed building.


The TDS code may be used in any of the following ways:

  • Test methods based on the TDS templates may be used as drivers for use in tracing through or debugging the function members that you develop, without involving any unit-testing activity. For example, XSLT files or RegEx patterns can be tricky to develop, and TDS can help you exercise them by feeding them example inputs and observing the results.
  •   The TDS built-in test facility may be used, instead of NUnit or Visual Studio Test, in conjunction with test methods based on the TDS templates, to generate unit-test reports on the Console. These reports can be saved for later comparison to verify that no significant change in behavior has occurred as a result of what was intended to be a refactoring free of unwanted side-effects.
  •   NUnit or Visual Studio Testing may be used to generate reports of unit tests based on the TDS templates. (TDS test methods can run unchanged with either NUnit or Visual Studio Test.)

If you notice any problems with the code or documentation, please post a comment so that corrections can be posted.

System requirements

The current release has been tested with Microsoft Visual Studio Community 2013. It may work with other versions but has not been tested with them. (Some versions of VS do not support Microsoft Visual Studio Test.) It has also been tested with NUnit 2.6.3 and appears to work correctly with it, generating results similar to those produced by the stand-alone version of TDS. (See the instructions for examples.)

Design goals included making TDS usable in a minimal development environment, such as with the free-of-charge Express versions of Visual Studio. Once developed, a TDS application may be called from a command prompt to test other code, but the instructions assume that the TDS test methods are developed with the assistance of Visual Studio.


[Actually, these are not real “frequently asked” questions, since so far nobody has asked any questions at all, but rather are my guess as to likely ones.  Please post any questions, comments, or requests in either "DISCUSSIONS" or "ISSUES" on this site.]

How is TDS different from NUnit or VS Test?

TDS test reports, if all TDS filters are disabled, are designed to be almost identical to (a subset of) NUnit or VS Test reports. However, TDS uses a different filtering mechanism to facilitate debugging and tracing. With TDS filters enabled (via suitable edits to the TDS source code), you may, for example, run a single test case of a single TDS test method, to precisely target some rarely encountered part of your code, without cluttering the report with irrelevant information. This makes it easy to trace into a location of interest in some function member that is being developed. AFAIAA, it is more difficult to set up VS Test or NUnit to generate similar stimuli to exercise callable code.

Why is this not a Wizard?

This code is distributed exclusively as C# source code, rather than as a Wizard or in some other more automated form, to allow you as much flexibility as possible in incorporating it into your projects.

Also, since you have access to all of the source code in this one file, you can easily examine the code to determine that it is safe to use.

Is it difficult to install and use TDS?

As I hope the instructions make clear, your first use of TDS will likely involve a modest amount of work, such as familiarizing yourself with its contents and navigation features, trimming out unneeded parts, and customizing the code to fit your project. I estimate a couple of hours for the initial setup. After that, maybe five minutes should suffice to add a simple, working test method to call a function member that is under development. Visual Studio navigation aids to facilitate this process are addressed in the tutorial.

Will a new version be published soon?

Yes, if evidence of some flaw in the code appears. A while back, I did add some example code illustrating the use of TDS in a project that seemed somewhat different from those described in the tutorial – see the “Documentation” tab – but TDS.cs was not substantially changed for that purpose. If the new Visual Studio 2015 Update 1 presents challenges (difficulties in using some part of TDS) or opportunities (new features that I think TDS simply must take advantage of), then I may publish an updated version that addresses those.

This new version differs from earlier ones primarily in putting some of the Assert statements into a catch{} block.

Last edited Jun 17, 2015 at 3:49 PM by vjohns, version 60