When that happens, it’s time to start again. Perhaps no one was using the tests because they weren’t getting benefit from them. Normally the benefit is immediate and obvious, but there is an upfront cost to get started (or restarted) that you just have to put up with. The other problem you may face comes later in the project’s life. The more tests you add, the more time it takes to run them after a compile. At some point, you may not be able to run all the tests every time. Which tests should you pick to run continuously? Choose those tests that best exercise the code that is being actively developed. When you notice that a test is broken in nightly or weekly builds, move it to the CI test suite so it can be run more frequently.
Tip 28: Continuously test changing code
Until you have a CI environment that builds your product after each code change, you won’t be testing your code often enough. Even a daily build is not sufficient.
I've found that some developers, myself included, don't use the same care when writing test code that they use when writing production code. This tends to make the tests brittle and people get pissed when the test code breaks due to some sort of interface change. It takes some effort but if you can avoid cranking out tests using cut-n-paste then your tests are easier to fix if something changes on you.
No comments:
Post a Comment