In my company, there is a KPI about code coverage. We measure results by code coverage percentage.
So we combine code coverage result of unit test and end-to-end test together.
Does it make sense to do this?
In my company, there is a KPI about code coverage. We measure results by code coverage percentage.
So we combine code coverage result of unit test and end-to-end test together.
Does it make sense to do this?
I think it does but with a few caveats:
Obviously you need to combine the metrics properly, not just add the coverage percentages. Usually there are tools to do this e.g. https://www.eclemma.org/jacoco/trunk/doc/merge-mojo.html
As with any metric you need to be careful how it is used. You probably don't want to look at just the merged value, the separate unit coverage and integration coverage is also potentially useful.
Unless you are required to meet a safety standard then aiming for 100% is probably pointless, the absolute number of the coverage may also be pointless but it may be useful to e.g. look at relative changes between builds.
No, because you would get a result more than 100% which would be non nonsensical.
The correct way to combine them would be to check the percentage of code covered by Both e2e and unit tests. But again, this isn't a very useful number compared to a break down. eg: