microsoft / microsoft/vscode-java-test

Branch code coverage not working properly

Open
#1,751 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ai-triaged bug test-reporting
Dominant language
TypeScript
Stars
340
Forks
173
Avg merge
1d 19h
Merged PRs (30d)
18

Description

I recently discovered the branch code coverage and I think it would be a very useful tool, however at the moment is buggy:

Image

In the case above it tells me the branch 6 has no coverage, which is the case when the first three statements are false.

Image

Here it tells me branch 2 is not covered, which is when the statement is false.

First of all maybe the fact that the statements are divided by lines shouldn't truncate the number of branches... If I put all statements in one line it would tell me that branch 8 is not covered (when all statements are false)

But most importantly as you can see branch 8 would be the one actually covered because the 'else' statement is all green. I could give you other examples where this is evident. Essentially what I am trying to say that if one of the branches is not covered at the moment the extension just says the last branch is not covered, when in fact in the case I gave you earlier I am pretty sure branch 7 (when now.equals(orarioFineEsec) equals true) is not covered, but I wouldn't know on the info that is given here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file, test, or entry point is named in the report. Begin by reproducing the branch-coverage display described in the screenshots and trace how covered and uncovered branches are assigned to statements. Done means the displayed branch numbers and coverage state identify the actually uncovered branch in both multiline and single-line cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, typescript
Domain
devtools, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.