Where do you put your unit tests?
Unit Test Projects or Not? – Fear and Loathing
I was thinking about this too. If I ever get to write code in a language released in the 21st century, where would I put the unit tests?
My first thought was to put them in the same code file, with the tests right next to the code they are testing. Then you can test internal/private stuff without having to use any attributes or special settings. But that might decrease the readability of the code. You could wrap them up and hide the tests in regions, but the tests still get include in the assembly unless you wrap them with a bunch of #ifs. So that’s not quite ideal.
Maybe there needs to be a change to the languages? Maybe a pre-processor automagically strips out your tests when you compile in a non-debug configuration?
-
Duncan Smart
-
http://computeristsolutions.com josh


