How to organize tests coverage in the project?
In a long-standing project written in symfony 3, test coverage is zero. Now this obviously leads to a lot of mistakes and ruins life.
How can you quickly cover a large project with tests and what would you do in such a situation?
Perhaps someone had cases of taking a project out of such a deplorable state into a project state from which one does not want to quit.
briley last edited by
Well, if you do not have a fairy godmother, then it is obvious that to cover the project quickly enough with tests - you need either more people or more time if the number of people is constant.
It is necessary to convey to each developer the importance of tests, because as practice shows, not everyone understands that it is vital.
It's just as important to start here. You can start simple - check at least all controllers for 500 errors. It is done very simply and quickly - iterate over the array of routes and see the code returned by the client.
For version 3, we can apply, for example, another option for checking the operation of services, by analogy with controllers. You take vital services from the container, pull public methods and expect not 5 **. (well, for 4 and 5, it is of course also applicable, but with caveats if we want to use mocks)
It is also important, in my opinion, to work out the principles of testing with colleagues so that no one starts doing nonsense. At one time I was engaged in complete nonsense, testing private methods in services through Reflection, being sure that this is directly vital, but not realizing that if such a need arises, then this is a problem in the architecture.
Of course, it makes no sense to talk about maintaining a balance between fanaticism and real testing, because it all depends on the experience and the project.
However, my whole message is that in order to start, you have to start. If we are talking about the community, everyone needs to understand the importance of this event, the main thing, of course, is that the team lead, if there is any hierarchy. You also need to immediately write tests for new code. The main thing is to do it. Culture will come a little later, but it will definitely come.