rillig / gobco

Measure branch coverage of golang tests
62 stars 12 forks source link

Record statistics on which test covers which condition #7

Closed rillig closed 11 months ago

rillig commented 4 years ago

Assuming that gobco would output which test covers which condition, it would be possible to answer questions like the following:

Implementation ideas:

visu-suganya commented 1 year ago

Hi @rillig

Current implementation outputs the condition details of which are covered and not covered.

Please help me to find whether edge cases are covered or not?

rillig commented 1 year ago

Hi @visu-suganya, as you already guessed, gobco does not really provide branch coverage but instead condition coverage, despite its name. Up to now, I didn't need branch coverage, as I could tell from the missing conditions what parts of the code are still uncovered. Do you actually need the branch coverage, or is it merely a feeling of "the program is named gobco, so it should report branch coverage"? What use case do you have that requires branch coverage but not condition coverage?

visu-suganya commented 1 year ago

@rillig Thanks for the immediate reply. I need branch coverage result so that developers can easily fix when compared to condition coverage.

In branch coverage, only 2 outcomes totally but in condition coverage, need to cover all the 4 outcomes(it will be difficult to cover all in development period). So Firstly I need to achieve branch coverage as first step and then go for condition.

visu-suganya commented 12 months ago

Hi @rillig Is there any possibility to get C1(branch coverage) output?

rillig commented 12 months ago

To get C1 output, you can change the method instrumenter.markConds by removing the branches for *ast.UnaryExpr and *ast.BinaryExpr. If that generates the output that you expect, I'll include it in the next release.

visu-suganya commented 11 months ago

@rillig Thanks for the implementation and please release the implemented feature so that I can use it. Thanks a lot.

rillig commented 11 months ago

I don't have plans to add this feature anymore. In the past few years I didn't have a need for it.

The comments on this issue are generally off-topic, they are not about finding out which tests cover which code, but about implementing branch coverage in addition to condition coverage.