Re: [GD-General] Unit tests
Brought to you by:
vexxed72
From: Noel L. <nl...@co...> - 2004-10-15 14:19:13
|
On Friday 15 October 2004 04:44 am, Chris Raine wrote: > I found unit-testing cumbersome as soon as you come to debugging your > unit-test code. I don't understand how unit tests can be cumbersome to debug. A unit test should be extremely simple and be just a few lines long. You will hardly ever have to debug (as in, step in the debugger) a unit test itself. The problem should always be obvious it if fails because a unit test tests one and only one thing. > As soon as you come to terms with more abstract and highlevel design > aspects of your engine, the time and effort spent in unit-testing (for > us at least) did not outweigh the benefits. It sounds like you didn't have a good architecture. It's easier to start testing low-level features, but to test the high-level code, you really need a modular architecture with a minimum of dependencies. The best way to arrive at this architecture is to use test-driven development (TDD). I can't recommend it highly enough. If you develop things that way, it will become immediately obvious how to structure your AI code so it's easily testable. You'll find you can create just about any object on the stack and manipulate it in isolation from other objects/libraries. > For high level, abstact functionality we abandoned the unit test > approach and implemented a nightly build script Automated builds and unit tests are completely different things. You really should have both, not one or the other. Same thing with functional tests, which test whole game behaviors instead of small units of functionality. Ideally you would do all three. --Noel Games from Within http://www.gamesfromwithin.com |