5
nntoan
7y

What is better?
1. Writting tests during development
2. Finish all code then start writting tests

Comments
  • 9
    There is a misunderstanding about production environment. Production environment is the environment for tests.
  • 5
    Try Test Driven Development.

    *You can also try testing during production. haha Just kidding.
  • 3
    Well it depends. In my experience, I learned that writing tests before the actual code made me write better code. Writing tests after code implementation is iffy for me, mainly it usually takes more time to test the implementation yourself rather than a machine doing it in a second or so. All it takes to me is to change production code, press run and it will tell me if my implementation was good or no, simple as that. Also writing a test beforehand can give you a better way of visualizing what your code should be doing and what not. Writing tests before and then adding implementation is called TDD and it's nothing but just a big win. Stability, clean code will be a garranty. There's also one thing I've experienced writing tests after is lack of motivation to do them, cause production is working, so the only way to fix that is write them before 😄
  • 1
    @amattdevelops I do appreciated it, really do :)
  • 1
    Serious answer: Test Driven Development (TDD) helps you in many different ways, first you cover many edge cases, second you write much flexible and modularized code, third debugging your code is easier because you have close code functions with a close input and a close expected output, if something is failing you know exactly in which part of your code is the problem.

    On the other hand, you can do Hope Driven Development (HDD) and then if you have plenty of time... Test in production! :'D
  • 1
    @ferpsanta HDD, as we need to trust other people we need to trust the code as well. We need more hope.
Add Comment