You can run main in a goroutine, sleep for some time (or stress test the 
server) and then exit.

On Tuesday, April 23, 2019 at 11:25:49 AM UTC+3, hui zhang wrote:
>
> I have daemon process,  I try to test its coverage
>
>
> func Test_main(m *testing.T) {
>    main()
> }
>
> go test -coverprofile coverage.out -args xxx.conf
>
> since it is a daemon,  I have to kill it to stop it
> kill <processid>  or   ctrl  +  c
>
>
> I got the coverage report  coverage.out  only 10B
>
>
> and of course ,  no  coverage report when run 
>
> go tool cover -html=coverage.out -o coverage.html
>
>
>
> how to solve this problem?
>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to