February 28, 2021
Hot Topics:

Testing Visual Basic .NET with NUnit

  • By Paul Kimmel
  • Send Email »
  • More Articles »

Understanding the Test Cycle with NUnit

NUnit makes a copy of your class library containing the tests. It then loads the copy into its own application domain. The benefit here is that you can change your code and recompile and NUnit will automatically detect that the test assembly or dependent assemblies have changed, reloading them without necessitating an NUnit restart. This is a nice feature that permits you to seamlessly edit, compile, test, and modify code without stopping, starting, and reloading test assemblies.

In addition to loading the test assembly into its own AppDomain, NUnit looks for a file named testassembly.dll.config. This allows you to associate a configuration file with your test assemblies. For example, if you have special configuration information—a TraceSwitch, for example—you can copy that information into a .config file that will be read and used by NUnit too. Normally only Web.config and application .config files are read by .NET assemblies, but because NUnit supports a .config file you will not have to modify code that is dependent on a .config file for NUnit testing.


NUnit is an open source framework for testing applications written into .NET. Because the cost is zero there should be little or no objection to incorporating NUnit into your software development cycle. If used effectively you'll discover that NUnit greatly facilitates unit testing and automated regression testing. Once a test is created as a class library and test fixtures and tests are defined you'll never have to write that test again. Simply run the test and you will instantly know what works, what was broken, and what just isn't working yet.

About the Author

Paul Kimmel is a freelance writer for Developer.com and CodeGuru.com. Look for most recent book "Advanced C# Programming" from McGraw-Hill/Osborne on Amazon.com. You can also look for his upcoming book Visual Basic .NET Power Programming from Addison-Wesley. Paul Kimmel is available to help design and build your .NET solutions and can be contacted at pkimmel@softconcepts.com.

# # #

Page 3 of 3

This article was originally published on February 21, 2003

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date