Software QA FYI - SQAFYI

More NUnit and Nant Tricks, Tips and Examples

By: Stewart Baird.

Article Description Nant (the .NET version of the Ant build tool) handles a wide range of build, deployment, and test tasks. Stewart Baird digs a little deeper into the .NET development tools Nant and NUnit, with tips and examples to help you with your next project.

Debugging Your NUnit Tests I've been busy since my last article on Nant—improving my music library! Readers of my earlier Nant article will recall how I demonstrated the use of Nant in software build automation. The software in question was a simple C# Windows Forms application that listed tracks from my CD library. Nant (the .NET version of the Ant build tool) handles a wide range of build, deployment, and test tasks. By the end of the article, you saw Nant build and run the C# sample. (Unfortunately, it also exposed the dated nature of my CD library.)

This time around, I'll take a few minutes to show you how to debug NUnit tests and also describe some of Nant's more interesting features.

Extending the Sample

I took my MusicLib sample and added a business layer between WinForms and SQL Server. As an extra twist, I implemented the business layer in VB.NET. (The MusicBiz library is actually little more than a data façade—its purpose here is to demonstrate how more complex builds can be handled.) Download the sample code and you'll see I have a VS.NET solution with the following:

MusicTest—NUnit tests written in VB.NET

MusicBiz—Business rules layer written in VB.NET

MusicLib—Win Forms client written in C#

Moo—SQL Server 2000 database

I'm only using my NUnit test library to test the business layer back to the database. Figure 1 illustrates the components of the solution.

Debugging Your NUnit Tests

Setting up VS.NET to debug your unit tests is very simple; just follow these steps:

Right-click on the NUnit test project (MusicTest, in my case) and select Properties.

Select Debugging under the Configuration Properties group

Enter nunit-gui.exe in the Start external program.

NOTE

Download Nant from http://nant.sourceforge.net/.

Full article...


Other Resource

... to read more articles, visit http://sqa.fyicenter.com/art/

More NUnit and Nant Tricks, Tips and Examples