hey Vasiliy, I'm not sure I understood your requirements, but let me take a 
stab at it.

By handlers of the protobuf I imagine you refer to those stubs generated by 
`protoc`, for the gRPCs. Is it correct ? 

They have well defined names/packages that can easily be filtered (grep?) 
from the the usual function coverage report you get from `go tool covdata 
func ...`. 
After this filtering, you could take an average, in whichever way you feel 
appropriate. Would this work for your need ?

Btw, I don't know of a golang package to output cover files ... would the 
command line tools work ? (`go tool covdata` or for instance `go tool cover 
--to=HTML`)

cheers!

ps.: Just in case it helps:

* To write the coverage information in text format, I suppose the original 
blog post <https://go.dev/blog/cover> still works (it's from 2013) *for 
unit tests*.
* *For integration tests* (e.g: when the test executes the program for 
which you want coverage) + unit tests together, here is one example: 
https://github.com/janpfeifer/gonb/blob/main/run_coverage.sh 







On Thursday, August 24, 2023 at 11:13:32 AM UTC+2 Vasiliy Tolstov wrote:

> Anybody knows golang package that can write cover files in desired format?
>
> вс, 20 авг. 2023 г. в 17:28, Vasiliy Tolstov <v.to...@selfip.ru>:
> >
> > Hi. I have service centric tests - so i want to test not each function
> > inside application, but only it handlers (defined via protobuf)
> > Also i have custom framework that runs each test like - start grpc
> > server, and call it via predefined json based files, and compare
> > results.
> > I want to measure coverage , but don't understand how to do that?
> > Is that possible to have another way to measure handlers coverage in
> > case of service defined via protobuf?
> >
> > --
> > Vasiliy Tolstov,
> > e-mail: v.to...@selfip.ru
>
>
>
> -- 
> Vasiliy Tolstov,
> e-mail: v.to...@selfip.ru
>

-- 
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/4349a17b-1993-4491-a642-7d156a774d9fn%40googlegroups.com.

Reply via email to