Add Tests Early
Here's another easy pro tip: Add Tests Early!
Why Add Tests Early?
It's easy to think of tests as something you can add later, or something that isn't needed for a small project. But, I find that a good and fast unit test suite dramatically improves my iteration speed. A good test suite directly supports the principle of working in smaller steps. Here's why.
Even though you're working in very small steps, after a few steps you'll still have a fair amount of code. When your app is small, you can easily verify that everything still works by just manually testing everything. But, at some point your functionality will be complex enough that manually testing is slow. That leaves you with two options, and neither one is good.
You could just accept this slow feedback loop as part of your process. Each time you add something new, or refactor something, you can spend more time loading your app and manually testing different scenarios to give you confidence that everything still works. That gets tedious pretty quickly, it's a waste of your time, and it conflicts with the idea of iterating quickly.
Or, you could just skip regression testing for some iterations. Test the new stuff, and don't worry about the old stuff. That often works fine. Until it doesn't. Eventually you'll break something, and you may not notice right away.
Unit tests help you avoid these scenarios. They're easy to write, fast to run, and they help you write more modular, testable code. Even if your code is not necessarily 'good code' or 'clean code', code that can be tested in isolation with a unit test is much more maintainable in the long run than code that is not easily testable.
Tests Are Good For Your Career
Not every company uses unit tests. Not every team or manager cares about tests. But, writing unit tests is one of those skills that you'll likely need at some point in your career. And, it's a habit that helps you and your team to be more effective. Why not practice it in your personal projects as well?
Adding Tests to Jernel
To that end, I've added some simple tests to my Jernel project! Here's the latest release. Immediately after that I also added a github action to run the tests automatically.