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/94710cf6-fa5a-4178-82fb-5cbbf8e6207dn%40googlegroups.com.

Reply via email to