What Test-Driven Scoffolding (TDS) does...
TDS is a slightly relaxed version of Test-Driven Development (TDD) for C# projects, providing templates for drivers of function members, such as methods or indexers, and (optionally) generating test reports.
(See Notes below for current status.)
When you develop a new function member 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 -- which is what you're really interested in. The software provided on this site (as C# source code) is intended to help you quickly produce this exercising or calling code, giving you a template that you may copy and use for this purpose. It is intended to be easily modified to provide inputs to your code, to inspect the results, and to display a report of those results.
Basic instructions and examples are provided in the TDS.cs file. The downloadable TDS Users' Guide
contains instructions and detailed examples of TDS use, from initial generation of the function member through unit testing and deployment. 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 C# code provided in this site (file TDS.cs
) can be downloaded and used in a new or existing project, then removed (almost without a trace) when no longer needed. The code in TDS.cs is in the public domain and is intended to be modified in any way you might find useful, without restriction.
The TDS code may be used in any of the following ways:
- The TDS templates may be used as drivers for use in debugging function members that you develop, without involving any unit-testing activity.
- 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.
- NUnit may be used to generate reports of unit tests based on the TDS templates.
- If the NUnit references are deleted from TDS.cs, the Visual Studio test system (for example, Visual Studio 2012 Web Express Test) may be used to generate reports of unit tests based on the TDS templates.
Actually, I'm joking -- you don't really need to read the manual, as the TDS.cs file includes setup instructions and lots of comments. The manual (as well as TDS itself) is aimed at programmers who are somewhere between being C# newbies (and everyone, even the C# architects, has been a C# noob at some time) and being experienced C# programmers who already use automated test-generation and driver-generation tools and therefore don't need TDS. (If you are
still a C# noob, you might want to work some of the C# programming examples in the Visual Studio help materials, before using this TDS manual.)
The manual includes detailed examples, so some parts of it could become tedious if you read every line, but it does include navigation aids to help you skip the boring parts. It discusses why one might want to use TDS, for example comparing TDS to TDD. It also includes a bit of fun, such as notes on Golden Rectangles and Fibonacci bunnies. If your code ever uses XML-valued objects, the examples in section 5-4 may interest you.
If you notice any problems with code or documentation, please post a comment; I'll do my best to include corrections promptly.
Besides the downloadable TDS.cs
file from this site, required software includes
- Visual Studio 2010 C# Express (or higher)
- Windows XP SP3 or later (such as Windows 7) with .NET 4
- NUnit 2.6 (other versions may be used). This is not really required, but it's heavily used in the examples.
Please see the downloadable TDS Users' Guide
This code is distributed exclusively as C# source code, rather than as a Wizard or in some other more automated form, to allow developers the maximum possible flexibility in incorporating it into coding projects as they see fit.
Coming (maybe summer 2013)
The next version of these examples will utilize the Express version of Visual Studio 2012. They will thus no longer be runnable on Windows XP SP3, as the current examples are. (The old documentation, for Windows XP SP3, will remain available on this site.) However, although the examples are built via VS 2012, I expect that the TDS infrastructure can be used unchanged by anyone with access to a text editor and the command-line C# in Microsoft .NET 4. The next example to be added will probably be a Web page connected to an SQL Server data source and having no dependence on the Console.
In keeping with my desire to continue to make TDS accessible to developers on a limited budget, the examples are based on the free-of-charge Express versions of Visual Studio and SQL Server, and the new ones will run under Windows 7 (since the Windows 8 version of VS 2012 Express currently seems to be quite limited). Since SQL Server CE is the one used by default with VS 2012, I shall probably use that version in the examples, but SQL Server Express is also available free of charge and provides additional capabilities.
I shall continue to characterize this software as a "beta" version until I have sufficient feedback as to its utility on a development project that is not of my own design (you are invited to use the "Discussions" tab on this site to post such feedback).