re: Me: "I tested and it works, why do I have to write tests?" VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Mr. Briwa can i ask you something ? Before you write a code do you consider all the testing that you need to make?
 

Sure. Ideally, yes, you can start with the tests, maybe unit tests for example, then write the code. This would define what your code can do, so that the scope is clear from the start. In fact, this is what TDD is trying to achieve; start with specifying the requirements through the test, write the code so that the test passes, refactor if needed while keeping the tests passing, and repeat.

Also, if it has something to do with side effects or dealing with end users (e.g. browsers, devices), I would add end-to-end testing at the end, to make sure all components integrate properly and to test as close as how the users are using the app. This is only when my unit tests have covered everything modularly.

 
code of conduct - report abuse