This question already has an answer here:
- How to explain the value of unit testing 6 answers
I am working in a team that mainly write small PHP sites. Currently we don't have a habit of writing unit test. Testing are done by using the site as a user by our PM, who don't know how to code, and UAT by the customer. However, as the projects we take are getting bigger, it starts to have more bugs created due to change of code and may not be discovered as the test has been done on that part already.
For example, after doing part A&B, bug is found in part C. After debugging part C, it causes bug in part A, but it is not noticed as testing has been done on that part. As the project gets bigger, it may not be possible to test the whole site after every change. So I think it is time to introduce unit test.
The problem is that the schedule is tight and I don't have much time to do this extra work, so writing test case on every case is not possible, not to mention test-driven development approach. Also, I need to show that writing test case is not a waste of time so that my teammates will start writing test case, and most importantly, my boss will allow us more time to do that. I am planning to start writing unit test on major function and if it starts to catch bug that is previously unnoticed, but have no idea which function to choose. Most guide out there just tell us to write test case for every case which is not possible for our situation. Is there any advice on what to unit test to start with?