How to measure Golang integration test coverage?

后端 未结 3 1491
暗喜
暗喜 2021-02-12 19:35

I am trying to use go test -cover to measure the test coverage of a service I am building. It is a REST API and I am testing it by spinning it up, making test HTTP

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-12 20:14

    you can run go test in a way that creates coverage html pages. like this:

    go test -v -coverprofile cover.out ./...
    go tool cover -html=cover.out -o cover.html
    open cover.html
    

提交回复
热议问题