Despite how people act and how they write on their LinkedIn, Not all of the developers are gods! It is pretty normal for me, You and anyone else to skip the tests sometimes. Ok I know! Shame on me. I have skipped those tests. Now what to do?
Suppose that you are in the middle of development of a personal project. All those ideas may rush into your mind and you are trying to implement them as fast as possible. Well, whether that method is right or not, I have no judgment. Any way, Here we are. We have written thousands lines of codes and implemented features without test. The whole software may work but there is always a high level of uncertainty which may hurts you. Like or not, those tests will improve your self confidence about your developed code.
Soooo. I have a source code, probably written in good way, I have followed all the OOP patterns and practices I know of and I believe the architecture and everything is ok. I just have not tests! Isn’t there any way to help me fix this problem? Well every one may has his unique way of fixing this problem. Some people may start opening the files from the solution explorer one by one and add a test file for them. Some may use other methods (let me know in comments). I myself have found a way that works for me in those times of misery! I use test coverage reports and try to increase the coverage as much as possible. Please note that I am a .Net developer so my solution is applicable in .Net projects. But with some minor changes you should be able to Implement it using any other language and environment.
Lets start :
1. First you will need to install coverlet.collector NuGet package on your test project (if you have no test project, Add one). you can use this command in package manager console too :
dotnet add package coverlet.collector
It will install the converlet.collector NuGet package on your test project. What this package do is to analyze and create a report of test coverage each time that you run the tests of your project. (I assume you have other testing requirements installed on your project. Packages like nunit/xunit and other stuff)
This package will generate the report in form of XML and it is not that much human readable. So after installing, Let’s go to next step:
2. We need a tool to show the generated xml file in a human readable form. For that, you need to install a report generator. to achieve it use this command :
dotnet tool install --global dotnet-reportgenerator-globaltool
and this :
reportgenerator -reports:"**/coverage.cobertura.xml" -targetdir:"coveragereport" -reporttypes:Html
3. There is only one step left. just run the tests using this command :
dotnet test --collect:"XPlat Code Coverage"
This way it will run the tests and creates the test coverage report for you. The generated report looks like this :

As you see, each file is processed and you will know what files are not tested. Of course it is only a measurement for quantity not the quality but works very well to let you know which files are lacking tests or enough tests.