If you write tests as you go, you will build on top of a working foundation. Don’t waste time calling a broken function.
Tests will allow you to Make it work, then make it better. You will be able to refactor that crap code into something better knowing the functionality still the same.
This is a deep topic, and learning ways to automate testing your shit is a skill that all engineers should master.
You can use techniques like Behavior Driven Development or Test Driven Development. Or, you can write tests after you implement something. It doesn’t matter the technique, what matters is that your code is working, and that you are validating that your code is working.
AI is awesome to write tests for you. AI coding warning
And don’t forget that, even with 100% test coverage, you should Manually test your contributions.
Part of Tips for Software Engineers