You are right. Currently there is no support for mocking server side sync reader/writer objects.. and it can only be tested with a real client and grpc library.
On Friday, July 6, 2018 at 5:23:36 AM UTC-7, Alex Shaver wrote: > > When I have a service that has a simple unary interaction, writing a unit > test for the ServiceImpl is straightforward enough, does the impl put the > right protobuf into the response parameter of the function. When I have a > service that has a streaming interaction, a streaming object (ServerWriter, > eg) is injected as a parameter giving you the capacity to write out to that > stream. It seems to me, somewhat naively, that this should be a > 'ServerWriterInterface' pointer, rather than a ServerWriter itself (which > is marked as final), so that you could inject a MockServerWriter object and > count how many times "Write" got called and with what protos. > > Which possibly says to me that I'm missing something on how one goes about > testing Services. The online tutorial/documentation goes into detail about > how one can mock out a stub for C++ client code so that can be unit tested > easily. But it's not clear to me how to go about mocking the Service side. > -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/grpc-io. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/0d8d4a87-5fc3-4f20-9262-787919b0b20f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
