gRPC golang server and client testing

4,429 views
Skip to first unread message

Sankar

unread,
Apr 23, 2016, 3:31:19 PM4/23/16
to golang-nuts
Hi

I have a .proto file which I ran with protoc to generate the _pb.go file. I then wrote a server and a client program that uses the above _pb.go program. Now what is the best way to unit test the server and client pieces ? (complete with mocking, benchmarks for both client and server; end-to-end testing, etc.)


Thanks.

Sankar

P.Ka...@yonego.nl

unread,
Dec 12, 2016, 12:20:30 PM12/12/16
to golang-nuts
Would be interested to learn of if you found a good solution.

Sankar P

unread,
Dec 12, 2016, 12:22:12 PM12/12/16
to P.Ka...@yonego.nl, golang-nuts
I did not find any :( 

--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/LuNb71evp84/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Zeewell Yu

unread,
Nov 9, 2017, 11:45:12 PM11/9/17
to golang-nuts
Hi,any solution now?  I am looking for the best way too.

Simon Ritchie

unread,
Nov 11, 2017, 4:31:16 AM11/11/17
to golang-nuts
Not everybody in the Go community favours the use of mocking tools, so many published solutions don't have any tests of that kind.   Maybe you should write the tests yourself.

I use pegomock for mocking.  (I tried gomock but I found issues that were not fixed.  I also found a couple of issues with pegomock too, but the author fixed them.)

Pegomock tool is a fairly conventional mocking tool.  Given an interface, it produces a concrete class that implements the interface and can be told at runtime how to respond to a method call.  So anything you test has to be defined by an interface.  Of course, if you only have a concrete class, Go allows you to create your own interface that matches it, so that's not a big problem.

If you want some worked examples of pegomock, see my scaffolder https://github.com/goblimey/scaffolder.  It generates a web server with pegomock tests for some of the components.

Regards

Simon  

k...@borderxlab.com

unread,
Mar 27, 2018, 6:59:21 PM3/27/18
to golang-nuts

Yijun Liu

unread,
Apr 7, 2021, 6:48:02 PM4/7/21
to golang-nuts
Hi, did you know how to do the unit testing of grpc now?

Sankar P

unread,
Apr 10, 2021, 7:01:19 AM4/10/21
to Yijun Liu, golang-nuts
Hey, Sorry. Nope. We gave up on grpc.

வியா., 8 ஏப்., 2021, முற்பகல் 4:18 அன்று, Yijun Liu <yijun...@gmail.com> எழுதியது:
--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/LuNb71evp84/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/3b3d0712-f7ee-4368-8768-bcf649b0ba45n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages