While what tchize says about writing unit tests make sense, I'm also a little skeptical that it will actually get done in the way described and/or have other bad effects.
For example, if there is the requirement that a unit test be written to test/confirm bug fixes, I could see it leading some people say they don't really want to spend the time to write such a test when the fix itself is trivial. And then they don't fix the bug. Likewise, while writing unit tests before any large changes are done, I know from my experience finding time to actually code the change and do basic testing is difficult. If it now takes 50% longer because unit tests also have to be written, that has various implications. In my ideal world, I'd love for there to be unit tests for everything. I'm just not sure what level we can really achieve. If we create/enforce draconian policies, I think the more likely scenario is people just stop writing new code, and not that they write unit tests (and/or they fork the code to a version such that they don't have to write unit tests). I'm certainly not saying unit tests are a bad thing. But I think we have to keep in mind the people who are likely to write the tests. All that said, quick thoughts: 1) Basic function/API tests should be easy to write in most cases (if I call xyz(a,b) does it do the right thing). Those shouldn't be much an issue. 2) A lot of the code operates on extensive external state (map data, archetypes, etc). So to test the function, you need to have a map set up in the right way (right objects on the map, etc). In this case, you want something that makes such a test easy. What may be easiest is in fact just a large set of test maps, and the unit test could effectively hard code those, with known coordinates (test object being only object at 0,0 and I know I want to insert that at 5,5) My thinking here is that if I can write the basic test to reproduce the bug in <10 minutes, I'll probably write the test. IF the framework is such that it will take me an hour, then I probably wouldn't. 3) If the number of tests grow, it is probably desirable to be able to run some specific subset of tests, eg, I don't want to have to wait 15 minutes for the server to run all the tests when I'm trying to fix some specific bug - I just want it to run my test. After all is done, then perhaps running all tests before commit makes sense. _______________________________________________ crossfire mailing list [email protected] http://mailman.metalforge.org/mailman/listinfo/crossfire

