3

I am planning to run my Cucumber test in go (using Godog) & I came up with the following possibility of commands to run my tests.

Can someone point out the differences here? What is the recommended way & what's the use-case of each cover mode etc?

go test -test.v -test.run ^TestFeatures$ -coverpkg=../... -coverprofile=coverage.out -race

go test -test.v -test.run ^TestFeatures$ -coverpkg=../... -coverprofile=coverage1.out -covermode=set

go test -test.v -test.run ^TestFeatures$ -coverpkg=../... -coverprofile=coverage2.out -covermode=atomic

go test -test.v -test.run ^TestFeatures$ -coverpkg=../... -coverprofile=coverage3.out

go test -test.v -test.run ^TestFeatures$ -coverpkg=../... -coverprofile=coverage4.out

PS: Apologies for being a noob in GO :)

Pulkit Gupta
  • 53
  • 1
  • 6

1 Answers1

3

This is answered on the GO blog: https://go.dev/blog/cover#heat-maps:

  • set: did each statement run?
  • count: how many times did each statement run?
  • atomic: like count, but counts precisely in parallel programs
h0ch5tr4355
  • 2,092
  • 4
  • 28
  • 51