ASSERT-KTH / ASSERT-KTH/flacoco

Lines before exception are not included in the coverage result

Open
#109 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
38
Forks
15
PR merge metrics
No merged PRs in 30d

Description

> Source code lines with exceptions show no coverage. Why?
>
> JaCoCo determines code execution with so called probes. Probes are inserted into the control flow at certain positions. Code is considered as executed when a subsequent probe has been executed. In case of exceptions such a sequence of instructions is aborted somewhere in the middle and the corresponding lines of source code are not marked as covered.

From: https://www.jacoco.org/jacoco/trunk/doc/faq.html

This means that there are some cases (such as the ones identified in https://github.com/SpoonLabs/nopol/pull/220#issuecomment-926641347) where lines just before an exception are not included in the coverage result from Jacoco, and consequently on the final Flacoco result.

To fix this, we would have to rewrite the probe insertion/analysis part of Jacoco to add a probe at the beginning of each line. This would be a fundamental change in the way Jacoco works.

Alternatively, we could consolidate and use https://github.com/JetBrains/intellij-coverage, which does work for these cases

We could also reverse engineer the bytecode control flow probe placement of JaCoCo and post-process class files when we do the stack-trace parsing.

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names no repository files, tests, or entry points. Start by studying JaCoCo probe insertion and analysis, then compare the listed alternatives with IntelliJ coverage behavior. Done would mean choosing and implementing an approach that includes lines immediately before exceptions in the final Flacoco coverage result.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.