Before generating code for UnitTest, you must have NUnit 2.2.3 or higher installed (available at http://www.nunit.org).
Select Tools > Check Model to verify if there are errors or warnings in the model. If there are errors, fix them before continuing with code generation.
Select Tools > General Options, and click the Variables node.
Add a variable NUNIT_HOME and, in the value field, enter the NUnit home directory path. For example, D:\NUnit2.2.3\bin. Add a variable LOG4NET_HOME in the same way if log4net is going to be used for logging.
Select Language > Generate C# 2 Code or Generate Visual Basic 2005 Code or Generate Visual Basic 2005 Code to open the Generation dialog box.
Specify the root directory where you want to generate the code, and then click the Options tab:
Select a UnitTest framework in "Unit test framework". You can choose between Nunit or Visual Studio Team Test.
Click on OK to generate code immediately or Apply, and then Cancel to save your changes for later.