If you write the unit tests after you write your code, then it will take longer. It will also be harder as you may run into issues with the testability of your code, or your application structure generally that you might have avoided by writing them before.
But that doesn't mean it's easy to write them before. Until you've been doing it for a while, it's not. It's very difficult and yes it will slow you down.
But it's an investment. As you gain experience the overhead goes down and you find you get the benefits of better decoupled applications and less code needing to be written. So you can certainly get to the point where you can write tests and code faster than you can write code and then test it (and re-test it each time you make a change). But it doesn't happen overnight, or even quickly.
But even before you reach this point, you start to get the benefit of much more maintainable code and the ability to handle client-requested changes without the need to go into a corner and have a little cry first.
petercoles said:
But even before you reach this point, you start to get the benefit of much more maintainable code and the ability to handle client-requested changes without the need to go into a corner and have a little cry first.
This cracked me up. I'm also looking in to learning more about tests and the different kinds.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community