gocoverutil icon indicating copy to clipboard operation
gocoverutil copied to clipboard

need duplicate count

Open Baileyswu opened this issue 6 years ago • 8 comments

Hi AlekSi! In E2E test, we merge different scenarios coverage files together. Different scenarios may depend on the same file with the same line, same column and the same count. So it is better to remove the duplicate check to avoid mistacks.

Baileyswu avatar Aug 15 '19 03:08 Baileyswu

Codecov Report

Merging #6 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master      #6   +/-   ##
======================================
  Coverage    87.5%   87.5%           
======================================
  Files           3       3           
  Lines          24      24           
======================================
  Hits           21      21           
  Misses          2       2           
  Partials        1       1

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a14b44d...07ee997. Read the comment docs.

codecov[bot] avatar Aug 15 '19 03:08 codecov[bot]

Hi. I use gocoverutil for E2E tests too and merge them without problems. Does current implementation cause any problems?

AlekSi avatar Aug 15 '19 05:08 AlekSi

Yes, there is a mistake happens. For example, here are two coverage files contains:

mode: count
local/Go-exercise/pkg-cc/package1/file1.go:3.20,5.2 1 33

and

mode: count
local/Go-exercise/pkg-cc/package1/file1.go:3.20,5.2 1 33

after merging, the result is still

mode: count
local/Go-exercise/pkg-cc/package1/file1.go:3.20,5.2 1 33

because of the duplicate check.

Baileyswu avatar Aug 15 '19 06:08 Baileyswu

BTW, may I ask another question? Our E2E test is built to generate some requests to pass to the REST API, not directly use the functions. Thus, the test file doesn't rely on this function, which causes the coverage of this function is not found. Do you meet such a scene in you E2E test?

Baileyswu avatar Aug 15 '19 06:08 Baileyswu

after merging, the result is still

So? Is it wrong? Does it cause any problems?


I build my services (not only tests) with code coverage information for testing:

  • https://www.elastic.co/blog/code-coverage-for-your-golang-system-tests
  • https://husobee.github.io/golang/test/coverage/2015/11/17/external-test-coverage.html
  • https://blog.cloudflare.com/go-coverage-with-external-tests/
  • See also #2

AlekSi avatar Aug 15 '19 06:08 AlekSi

In my thought, that's wrong. Because the block is tested 66 times totally...

Baileyswu avatar Aug 15 '19 06:08 Baileyswu

With this patch, do you see 66 times in any UI / renderer like go tool cover, Jenkins Cobertura plugin, etc? When I added this case, go tool cover wasn't able to handle duplicate lines at all.

AlekSi avatar Aug 15 '19 07:08 AlekSi

Yeah, after fixing it, go tool cover will recognize the updated count. That's will be 66.

Baileyswu avatar Aug 15 '19 07:08 Baileyswu