Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
There is a misunderstanding about production environment. Production environment is the environment for tests.
-
bepoXY11477yTry Test Driven Development.
*You can also try testing during production. haha Just kidding. -
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 😄
-
ferpsanta197ySerious 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 -
@ferpsanta HDD, as we need to trust other people we need to trust the code as well. We need more hope.
Related Rants
What is better?
1. Writting tests during development
2. Finish all code then start writting tests
undefined
phpunit
unit tests