Delete All Your Tests!
Sorry for not writing yesterday. My schedule did not allow it. I refrained from posting anything since it wouldn’t have been of sufficient quality for you.
On Monday I tried something new. I recorded the content of the newsletter as a video and posted it to YouTube and LinkedIn. While it didn’t exactly blow up, I am happy and excited about these changes. I want to try to stick with this. Today I switched things up. I first recorded the video, of which I’ve embedded a link to below, and then wrote the newsletter.
The subject says it already: Delete all your tests!
Don’t worry, I still believe in test-driven design (or development, but for me, it’s more design… perhaps a topic for a future video/email?).
There is a point in every application’s lifecycle where you reached a stable point for a majority of features. You used tests to keep your quality high. You passed acceptance tests from your clients and their users. The thing runs. Now your test suite is hundreds or thousands of tests long. It runs for minutes or even hours. For every commit, the whole suite is run. Future development could be faster, but CI takes ages.
Here’s what you should do:
- Find the stable parts of the application and extract them. Turn them into a library. Librify them, as I say in the video. This isn’t a word. I looked it up. The suggestion is to call it packaging or archiving. But I like librifying better. Please excuse me, but I will continue calling it that way. You’ve been warned. 🚨
- Delete all tests that concern your library from your application.
- Go on developing things.
If you reach a point, where you need to extend the library, just recover your tests concerning that specific part from your version control system.
Why should you do this?
Every application is a legacy application.
The less code and tests you have to care for or keep in mind how they work, the less stressed you are. It reduces your mental load and frees your mind.
Your application does not need to have corners of code, that no one touches because no one knows how they work anymore. Extract them and choose a proper name for your library. It will keep your code lean, and your future tests will run quickly.