I have also not seen unit tests written on a regular basis. The reason for this was that the code was changed too much at the beginning of the project, so everyone refused to write unit tests until everything was stable. After that, everyone was happy and did not need unit tests. Thus, we have several tests that remain there as a story, but they are not used and are probably not compatible with the current code.
I personally believe that writing unit tests for large projects is not possible, although I admit that I have not tried or talked with people who did this. There are so many rules in business logic that if you change something a little, you have no way of knowing which tests to update outside of those that will be broken. Who knows, old tests now may not cover all the possibilities, and it takes time to remember what was written five years ago.
Another reason is lack of time. When you have a task that says "Completion time: O, 5 people / days", you only have time for its implementation and a shallow check, so as not to think about all possible cases and relationships with other parts of the project and write all the necessary tests . It may take 0.5 days to implement something, and a couple of weeks to write tests. If you were not specifically ordered to create tests, no one will understand this huge loss of time, which will lead to screams / bad reviews. And no, for our sophisticated enterprise application, I can't come up with a good test coverage for a task in five minutes. This will take time and, possibly, a very deep knowledge of most application modules.
Thus, the reasons why I see them is the loss of time, which does not provide any useful functions and a nightmare for maintaining / updating old tests to reflect new business rules. Even if someone wanted to, only experienced colleagues could write these tests - at least a one-year participation in the project, but really need two or three. Therefore, new colleagues do not cope with the proper tests. And it makes no sense to create bad tests.
User Jul 02 '09 at 21:13 2009-07-02 21:13
source share