I would advise against mocking internal interfaces. That may make the tests increasingly brittle when you update gRPC version. Also, it may reduce the test coverage.
On Tue, Nov 7, 2023 at 12:48 PM smita deshpande <[email protected]> wrote: > I am thinking of mocking the interface grpc::internal:: > ServerAsyncStreamingInterface > in case of testing async server. So it would become possible to even use > google Unit tests. I am having simple hello world unary call. However, I do > not want to run server and test the SayHello RPC service with real client > and server. > > Do you think its good idea? > > Thanks, > Smita > On Tuesday, November 7, 2023 at 1:18:01 PM UTC-5 Eugene Ostroukhov wrote: > >> This is an open-ended question and depends a lot on the granularity of >> the tests you want. We have unit tests that test the service class >> directly. Sometimes we start a service on a background thread and then >> connect to it from the test. >> >> There is no premade test harness that I know of. This is an example of >> running the server in-process: reflection test >> <https://github.com/grpc/grpc/blob/master/test/cpp/end2end/proto_server_reflection_test.cc> >> . >> >> On Friday, November 3, 2023 at 11:16:35 AM UTC-7 smita deshpande wrote: >> >>> Hi, >>> >>> I am new to grpc, is there any documentation or examples explaining unit >>> testing of server side RPC calls/services? >>> >>> Thanks, >>> Smita >>> >> -- > You received this message because you are subscribed to a topic in the > Google Groups "grpc.io" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/grpc-io/h0BYoxKv63M/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/grpc-io/6038c4a0-2d56-4459-ae9d-50862602cce9n%40googlegroups.com > <https://groups.google.com/d/msgid/grpc-io/6038c4a0-2d56-4459-ae9d-50862602cce9n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/CAD%2B8YVPD7DGNXdgZ%2B3jFxXDVAXiUxdjcM-%3DfssE5R6ua%3Df3Svg%40mail.gmail.com.
