I\’m not a unit-testing guru, but at some point, I had to start running automated tests on my game engine because it became more complex and I had less and less time to spend pressing \’STEP\’ buttons in emulators and debuggers.
I still struggle a bit to decide whether what I\’m doing is unit testing or not, but I encountered two qualities that \”allow\” you to claim you\’re doing unit-testing:
– the test is \”fast\” to run (shorter than recompiling the project, at least?)
– the test helps you localize problems.
It\’s a kind of time-investment compared to guru meditation.
Michael C. Feathers (Working Effectively with Legacy Code): if it takes more than 1/10th of a second to run, it is not a unit test. A test is not a unit test if (A) it touches the file system, (B) it talks to a database, (C) it communicates through the network, (D) or you have to do special things in your environment to run it (e.g. edit configuration files).
LikeLike