FrendsPlatform / FrendsTasks

0 stars 0 forks source link

Coverage results should be taken from package coverage, not overall coverage #56

Open jefim opened 1 year ago

jefim commented 1 year ago

Currently we take unit take coverate figure from top-level coverage element in cobertura XML. However to get better results we need to target the actual coverage for the package. See example below:

<coverage line-rate="0.5" branch-rate="0.5" version="1.9" timestamp="1683293601" lines-covered="152" lines-valid="348" branches-covered="16" branches-valid="52">
  <sources>
    <source>...</source>
  </sources>
  <packages>
    <package name="Frends......" line-rate="0.9" branch-rate="0.75" complexity="10">
    </package>
    <package name="Frends......" line-rate="0.1" branch-rate="0.1" complexity="10">
    </package>
  </packages>
</coverage>

In the example above you can see that overall coverage can sometimes be diluted by neighbouring packages, which makes results inaccurate. So onstead of using /covarage attribute line-rate we should use /coverage/packages/package[@name='PackageName'].