Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request additional parameters for test coverage metrics #82

Open
kldaji opened this issue Mar 22, 2024 · 1 comment
Open

Request additional parameters for test coverage metrics #82

kldaji opened this issue Mar 22, 2024 · 1 comment
Labels
feature request New feature or request incubation Features that are under discussion
Milestone

Comments

@kldaji
Copy link

kldaji commented Mar 22, 2024

There are various criteria for measuring test coverage, e.g. Instruction, Branch, Line, etc.

I think it only provides instruction at the moment, but it would be good to receive various criteria such as Line and Branch as parameters and use them customarily!

@instrap
Copy link
Member

instrap commented Sep 20, 2024

JaCoCo XML report offers extensive details for INSTRUCTION and BRANCH, straight away.

For instance,

<sourcefile name="MainActivity.kt">
    <line cb="0" ci="0" mb="0" mi="3" nr="10" />
    <line cb="0" ci="0" mb="0" mi="3" nr="13" />
    <line cb="0" ci="0" mb="0" mi="3" nr="14" />
    <line cb="0" ci="0" mb="0" mi="2" nr="17" />
    <line cb="0" ci="0" mb="0" mi="10" nr="18" />
    <line cb="0" ci="0" mb="0" mi="14" nr="19" />
    <line cb="0" ci="0" mb="0" mi="14" nr="20" />
    <line cb="0" ci="0" mb="0" mi="4" nr="23" />
    <line cb="0" ci="0" mb="0" mi="14" nr="24" />
    <line cb="0" ci="0" mb="0" mi="14" nr="25" />
    <line cb="0" ci="0" mb="0" mi="4" nr="28" />
    <line cb="0" ci="0" mb="0" mi="14" nr="29" />
    <line cb="0" ci="0" mb="0" mi="1" nr="30" />
    <counter covered="0" missed="100" type="INSTRUCTION" />
    <counter covered="0" missed="13" type="LINE" />
    <counter covered="0" missed="3" type="COMPLEXITY" />
    <counter covered="0" missed="3" type="METHOD" />
    <counter covered="0" missed="1" type="CLASS" />
</sourcefile>

Here for every line we get the missed/covered INSTRUCTION & BRANCH. For the other metrics like LINE, COMPLEXITY, METHOD, CLASS we don't have this extensive detail per line, but instead we just get these per file. We could get extensive details for these metrics from <method> like

<method name="&lt;init&gt;" desc="()V" line="3">
    <counter covered="0" missed="3" type="INSTRUCTION" />
    <counter covered="0" missed="1" type="LINE" />
    <counter covered="0" missed="1" type="COMPLEXITY" />
    <counter covered="0" missed="1" type="METHOD" />
</method>

So this is doable, but not anytime soon. We will first focus only adding BRANCH coverage since that's straight forward, and then revisit this one.

@instrap instrap added this to the 1.8 milestone Sep 20, 2024
@instrap instrap added feature request New feature or request incubation Features that are under discussion labels Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request incubation Features that are under discussion
Projects
None yet
Development

No branches or pull requests

2 participants