How to go about backend testing coverage for micro-services?

So at my company we are looking to introduce coverage mapping for all services. These are individual repos and we want to make a single dashboard where all data for the test coverage can be fetched. What tools would you guys recommend here? I have heard of Sonarqube etc.
If anyone has faced the same problem in their projects it will be very helpful if you can share details.
Thank you!

1 Like

So, you donโ€™t have any problems with a test coverage of your microservices and integrations separately, the only issue is that you donโ€™t know how to show (visualize) in 1 dashboard the coverage of the whole system not the separate microservices, am I right?

1 Like

The dashboard problem is there + we also need to create a central system that can help us calculate meaningful coverage data in these individual repos too. I havenโ€™t spent much time learning about different ways to calculate coverage and which coverage metrics can be actually meaningful to developers. The central dashboard should be easy to create once we are able to calculate this data in the repos.

It seems that the main problem is to calculate coverage for each service separately not the dashboard which combines all coverages in one statistic for the whole system. Probably, if you use Python and pytest you can use Coverage.py, as far as I know, it can be easily integrated into any Python project (if you use another tech stack I believe there are similar tools in most programming languages). Just in case, the simplest formula (probably you know this): test coverage % == divide the number of lines of code executed by the total number of lines of code in the project (executable code) * by 100 to get a percentage

Maybe provide more details so other professionals will be able to give you more specific advice

Sure! We are using Javascript for all of our services. For unit and integration testing we use mocha. For contract testing some of the teams have monitors setup in Postman. But we are not calculating any coverage data on these and now developers have an ask for it. So we wanted to create a common solution for all through which we could calculate meaningful coverage with every PR which is raised. I wanted to know about what all tools do we use, and what are the best practices that I can keep in mind like should we restrict only to unit and integration coverage? or are there other type of tests that we can add as well. Sorry if my questions are a bit naive, I am a beginner and recently joined this community, please do let me know if I should add more details! Thank you.