26
6160
7y

a little confession: i've rarely used test suites in my projects (due to laziness and lack of time).

i've started a new project and now i HAD to write tests in order to make my PM happy.

Then i had to refactor a lot of code.

IT WAS SO EASY WITH TESTS.
I WAS A FOOL.
STUPID PAST ME, STUPID!

Comments
  • 2
    That sounds interesting ive yet t9 use unit tests or tests in general in my programm since im still a beginner. Would u mind givinf an example of how much easier it was and what ? :)
  • 5
    Did I write this rant?
  • 1
    @Kubernatural basically i've implemented tests to cover all the use cases for a particular module, in order to ensure that my code works as expected.

    then i've started refactoring that module (rewriting functions, splitting functionalities in different files, etc) and just by running the test i was sure that every change i've made wasn't breaking anything in my new module.

    it's much faster, you don't need to check every time that your data is processed the right way or check what the code was doing before the refactor in order to ensure that the two modules (old and new) are doing the same thing.
  • 0
    I do TDD at work, so I'd challenge you when you refactor to change the tests first, watch them fail, and you get led right to the code changes :)
  • 1
    @unmarked I'll definitely try it! It looks like a fun challenge :D
Add Comment