More commentary than anything else today. On the topic of bloated test suites and when is it safe to delete some of them. There are a lot of trite and overly clever answers to this on the internet. I'm going to try to avoid both of those kinds of answers and be practical.
Pretty much you should never be deleting tests that are still valid. That is, if the system functionality was intended to be something, you should never remove the things that ensure that it is that way. Sorry, not enough pronouns. If your test suite is complete and confirms that all features are present and functioning correctly, then those test should remain in perpetuity.
That might leave you with a nasty problem though. What if you test suite is huge and slow and clumsy and awful. Deleting some of the tests, especially the low level stuff, or the things that just seem redundant, might sound like a great idea. I caution you not to. Rather, fix the clumsy stuff. Remove, carefully, the redundancy, but don't directly delete tests.
I'm trying to make a distinction here. Deleting tests because they are annoying is not the right call. Deleting tests because they are redundant is an iffy proposition depending on how things are organized. Deleting tests should really only happen because the feature or functionality they are tied to is going away. Now all that said, deleting tests because you replaced them with something better, thats OK. Its sometimes hard to do, but its OK if you feel confident that your replacement test is better than the previously existing one.
In an upcoming post I'll talk more about redundancy and how we need to be careful about that.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.