Maybe similar to this? 
https://github.com/thediveo/lxkns/blob/cef5a31d7517cb126378f81628f51672cb793527/scripts/cov.sh#L28

On Wednesday, August 16, 2023 at 1:54:48 PM UTC+2 Jan wrote:

> hi all, 
>
> After reading the documentation 
> <https://go.dev/blog/integration-test-coverage>, I managed to set up a 
> process in which I compile and run my integration tests, and get coverage 
> from them in the `$GOCOVERDIR` subdirectory.
>
> Now I would like to have a combined unit tests + integration tests report, 
> all in one go, and I'm not sure how to get that.
>
> I was expecting that, if I go to my modules root directory, and I do:
>
> ```
> go test --cover --coverpkg=./... --coverprofile=/tmp/cover_profile.out 
> ./...
> go tool cover -func /tmp/cover_profile.out > /tmp/cover_func.out
> ```
>
> I  would get all the results, including integration tests (since they are 
> called with GOCOVERDIR set). But instead I only see the coverage of the 
> unit tests, and the information from the integration tests seems to be 
> ignored, even though it is generated.
>
> I'm sure it is generated because if I run the command above with `--work` 
> (preserve the temporary files), and log the value of $GOCOVERDIR I can see 
> where the test stores the coverage data files. And if I manually do:
>
> ```
> go tool covdata func -i /tmp/go-build287472875/b001/gocoverdir
> ```
> (where /tmp/go-build..../gocoverdir is the temporary directory reported 
> for GOCOVERDIR)
>
> I see the results I expected (some of my functions that I want to make 
> sure are covered) are there. But they are not reported in 
> `/tmp/cover_func.out` above.
>
> Any ideas why ? 
>
> Or any other suggestions on how to merge the report from unit tests 
> (`/tmp/cover_profile.out` in my example) and integration tests ? 
>
> thanks!
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/ceb7dc45-cedc-4453-b35a-e81f067412d7n%40googlegroups.com.

Reply via email to