NUnit Test Runner
Thursday, March 22, 2007, 09:40 AM - .NET, NUnit, C#
One of my co-workers pointed out a great free Visual Studio 2k5 addin to run NUnit and CSUnit tests. Give it a try!

[ add comment ]   |  [ 0 trackbacks ]   |  permalink  |   ( 3.1 / 335 )
NUnit Reading from App.Config file...
Monday, April 11, 2005, 08:45 AM - NUnit
Finially figured it out. If the test is going to be ran on its own, the app.config file needs to be named the same as the assembly plus .config (i.e. testbo.dll = testbo.dll.config) and copied to the execution directory. The easiest way to do this is with a post-build event
copy "$(SolutionDir\DummyNUnitApp\App.config" 

"$(TargetPath).config"


However, when you run the tests from a .nunit file, you need to name the config file the same as the nunit file plus .config (i.e. NUnitTests.nunit = NUnitTests.config) and place it in the solution dir. Again, the post-build event would be
copy "$(SolutionDir\DummyNUnitApp\App.config" 

"$(SolutionDir)NUnitTests.config"


By doing both of these steps, the tests can be ran by either the gui alone, or the console with a .nunit file, and still able to read from the same configuration file (App.Config) with a simple:
ConfigurationSettings.AppSettings["ConnectionString"]


It's that simple.

[ add comment ]   |  [ 0 trackbacks ]   |  permalink  |   ( 3 / 224 )
NUnit Debugging
Monday, April 11, 2005, 07:32 AM - NUnit
I found a great page on debugging with NUnit today, and a simple way to spawn the NUnit GUI and automagically load your tests. The gist is this:

1. Create a dummy console app in your project
2. Create a simple XML file that contains the path to your tests, name is NUnitTests.nunit, and put it in your solution directory. The file looks something like this:

<NUnitProject>

<Settings activeconfig="Debug" />
<Config name="Debug">
<assembly path="LibraryA\bin\Debug\LibraryA.dll" />
<assembly path="LibraryB\bin\Debug\LibraryB.dll" />
</Config>
<Config name="Release"></Config>
</NUnitProject>

3. Set the startup parameters of the dummy console app to spawn the NUnit-GUI.exe and pass in the above file as a parameter. In the Property Pages in the dummy console app, click on Configuration Properties and set the Debug Mode to "Program". Click the Apply button, and the previously unavailable "Start Application" line will now be available. Fill it with:

C:\Program Files\NUnit 2.2\bin\nunit-gui.exe

and set the Command Line Arguments to:

..\..\..\NUnitTests.nunit

Viola. That's is. The IDE will now start NUnit-GUI and you can set breakpoints on the tests you are running, etc.

SUH-WEET!!!

The original article is here, in case you are interested:

http://www.thecodeproject.com/csharp/TomazNunitTests.asp

[ add comment ]   |  [ 0 trackbacks ]   |  permalink  |   ( 3 / 222 )
New Category
Monday, April 11, 2005, 07:26 AM - NUnit
I have added a new category under the .Net stuff for NUnit, because I am so taken with this approach to writing code. It's simple. You write your method, write the tests to test that method (that by the way, you are writing anyway in your harness or however you are testing them now) and then attach the NUnit GUI to the debugger and VIOLA, you can step through, change values, and oh yeah, regression test changes you make WITHOUT re-writing a bunch of tests. Brilliant.

[ add comment ]   |  [ 0 trackbacks ]   |  permalink  |   ( 3 / 225 )