1

I have a project in go lang, I can run tests and sonar can identify the total percentage of test coverage. But I want to know if I can generate any metrics in this coverage.out file that can show how many tests were run so that sonar can display this information.

I'm running the command go test -cover -coverprofile=coverage.out ./... and it's generating the file for me with just the percentage of each test, but I need to know how to generate a metric of how many tests were run in total so that sonar is able to show this information.

  • 1
    `go test -cover` does not provide number of tests that are run. [gotestsum](https://github.com/gotestyourself/gotestsum) is a tool that provide this information as per https://stackoverflow.com/questions/66230962/when-running-go-test-is-there-a-way-to-get-a-count-of-how-many-tests-were-run – kaushik Jul 18 '23 at 01:51
  • @kaushik the gotestsum it shows the amount of tests run for me in terminal or file generated, but not for sonar, that's my problem. – Murilo Alves Batista Jul 18 '23 at 21:15

0 Answers0