Unit Testing

Nov 13, 2010 at 7:08 AM

I've been thinking about adding Unit Testing to this project as I know we already have plans to add additional parsers and what not.

The few questions I have are mainly related to what Unit Testing setup we should use.

The benefits of something like Microsoft's mTest, for instance, is that most people will have it. nUnit is more widely used. (These are the only two I've ever used.)

Mocking is another item to consider. There are several to choose from. I tend to use Moq and RhinoMocks.

What does everyone else thing about these? Pros, cons?

Nov 13, 2010 at 8:27 AM
Edited Nov 13, 2010 at 8:30 AM

It's quite hard to figure out exactly what to unit test in this project.  The infrastructure is quite limited in variable operation, it essentially does the same thing over and over, so I guess you could introduce tests that prove that it is compiling templates correctly and incorrectly but a lot of it is dependent on the source template itself.  Now, should be testing the data people are parsing, or the functionality of the compiler itself?

Mocking is another example; we have few situations where we are consuming our interface contracts, but it might be a bit too complex to start mocking say an ILanguageProvider.  Don't get me wrong, I think it's important that we create proving tests to show that it works and changes we make don't break it, it's just a little deciding what to test.

I think my vote would be for NUnit with Moq.