Unit Tests moving to NUnit

Developer
Oct 3, 2010 at 7:46 PM

After some deliberation, we have decided to adopt the recommendation from David Valentine and others that we proceed with unit tests designed for NUnit instead of the visual studio testing tools.  The reason is that the NUnit tests can be run by developers that do not have the nearly $1000 VS Professional version.  Instead, they can be run using the typical NUnit user interface.  If you have the professional version, however, and still want to be able to debug from inside a test, resharper provides an excellent set of test running user interface options that are built directly into the IDE and provide very nearly the same interactive experience that you would have experienced with the VisualStudio tests.  This is a big improvement over my previous experience with NUnit which required the user to run the tests through a separate application and I don't think it even provided the ability to step in and debug from a unit test.  In any case, I don't feel that we lose anything by switching to NUnit and we gain giving access to tests to developers that want to use the various free Visual Studio or SharpDevelop or whatever.

Also, there are about 200 unit tests that are currently being ignored.  Almost all of them are the Nad27 projections.  I think our Nad27 projections are working fine, however, the unit test relies on proj4.  The proj4 library has optional nad tables in use, and the program discovers the location of these nad tables by assigning an "Environment Variable".  "PROJ_LIB" apparently is the environment variable, and it should be set to the system path where the nad tables are found.  However, I am working on a 64 bit windows 7 machine, and for the life of me I can't seem to get proj4 to discover the nad tables anymore.  I also noticed that the instructions for setting the environment variable from the command prompt returned with no evidence of failure, but upon inspecting the various environment variables by following these steps:

  • Right click on the computer icon
  • Properties
  • Advanced system settings
  • Advanced tab
  • Environment Variables

There was no evidence of the PROJ_LIB variable, and adding it through either method seems to have no impact on proj4.  This may be unrelated to why the unit tests are failing for nad grids, but I have given up trying, and at this point feel that we simply may not be able to use proj4 on 64 machines to test this feature.  I also don't want formal unit tests that require an ESRI reference.  Even though I think it is ok for people to develop tests that compare the projection to ESRI, I don't think that it should be something that gets downloaded and run as part of an autobuild process.  I have also had to switch the build mode of the projection library to x86 so that the unit tests can load both the projection library and proj4 on my 64 machine.  I did this to all the libraries for now.  With x86 we can use proj4 for unit tests and GDAL.  Building to anyCPU would cause more problems than it is worth, so I have disabled this feature.  If folks want to abandon GDAL and don't care about unit tests, they can simply change the build configuration to 64 themselves.

Ted

 

 

 

Developer
Oct 3, 2010 at 8:13 PM

Hmm.  The 3.5 Autobuild version of the UnitTests project fails because it doesn't correctly reference NUnit.  Should we be building NUnit from source or is there a better way?

Developer
Oct 3, 2010 at 8:49 PM

Ok, this turned out not to be a framework version issue but was simply because my initial reference relied on the GAC and the new reference relies on a copy that I added to support files.  This seems to have fixed it.   Otherwise the library isn't necessarily registered on everyone's machine.

Developer
Oct 4, 2010 at 2:51 AM

TeamCity 5.1 uses nunit versions up to 2.5.5

Install Nunit 2.5.5

I updated the repository, so PULL and update.

As for tools, Nunit runner works well. as well as resharper

I ponder if we should not split out the tests

 

Also, look at MOQ for Mock object testing.