|
How To Build and Test NHibernateThis page describes how to build and test NHibernate either from the packaged distribution or from CVS using NAnt and NUnit or Visual Studio .NET and TestDriven.NET.
Using NAnt and NUnitWhat external programs do I need to build NHibernate?NHibernate relies on the .NET Framework Version 1.1 (it can work with .NET 1.0 with some minors changes, but it is not recommended), NAnt 0.85-rc3 for building, and NUnit 2.2 for testing (included in the distribution). You don't have to be too familiar with these tools to build NHibernate - just willing to edit XML files and open the Command Prompt.
For convenience, you will probably want to add NAnt (and optionally NUnit GUI) to your PATH. It is not needed but makes for less typing at the command prompt. Let's build NHibernate now!Now that we have all of the prerequisites out of the way, on to the fun stuff:
NAnt -D:project.config=debug clean build >output-debug-build.log For the release build type the command: NAnt -D:project.config=release clean build >output-release-build.log This will create a build folder under the nhibernate folder. That is all you have to do to build NHibernate from source. Of course, we want to test what was just built. Let's run the tests for NHibernateNow we have NHibernate.dll, NHibernate.DomainModel.dll, and NHibernate.Test.dll all built. The NHibernate.DomainModel.dll and NHibernate.Test.dll are only needed for testing. Your projects require no reference to them and should not reference them. Tests require access to a database. Any supported database server can be used. It's best to create a separate user and database for NHibernate tests. You also have to ensure that NHibernate can load ADO.NET drivers for your database, so copy the driver assembly to the same directory that contains the built NHibernate files or put it in the GAC (MS SQL Server 2000 driver is already put in the GAC during .NET Framework installation, so no special steps need to be taken if you are going to use this database). Part of the NAnt build is to copy the App.config file from NHibernate.Test into the bin as NHibernate.Test.dll.config while overwriting connection settings in the file by those specified on the command line. To run the test type a command such as this (all on a single line):
NAnt
-D:project.config=release
-D:nhibernate.dialect="NHibernate.Dialect.MsSql2000Dialect"
-D:nhibernate.connection.driver_class="NHibernate.Driver.SqlClientDriver"
-D:nhibernate.connection.connection_string="Server=localhost;initial catalog=nhibernate;User ID=blah;Password=blah;Min Pool Size=2"
test
>output-release-test.log
The command above was split into multiple lines for readability, but it should be typed in as a single long line. You should set the properties to whatever you use to connect to your database. If you want to use the NUnit GUI to run the test, the file src\NHibernate.Test\NHibernate.Test.nunit stores all of the settings. The NAnt test target and the NUnit GUI will output the results of the text to the file NHibernate.Test.dll-results.xml. If the NAnt test target is run it will output the results in the bin folder. If the NUnit GUI is used to run the test the results will be output to the NHibernate.Test folder. Using Visual Studio .NET and TestDriven.NET
Now you can build the solution and run the tests using TestDriven.NET. Building the HtmlHelp2 help collections (optional)To build the help files for Visual Studio .NET, you will need the Microsoft Visual Studio Help Integration Kit (VSHIK) installed on your PC. This requires Visual Studio .NET (although there is a workaround - see http://helpware.net/mshelp2/h2faq.htm#novsnet). You will also need to have NDoc installed, and copy the following files from NDoc into your NAnt lib folder (see http://nant.sourceforge.net/release/latest/help/tasks/ndoc.html):
Finally, include the NAnt command-line argument -D:vshik.installed=true when building help files to generate VS.NET output. If VSHIK is not installed in the default location of C:\Program Files\Microsoft Help 2.0 SDK, you will also need to specify the correct install path using -D:vshik.path=<path>.
|
||||||||||||||||||||||||||||||||||||||||||||||