Mocking Stub for C++ callback APIs

26 views
Skip to first unread message

Anil Kumar

unread,
Sep 12, 2025, 11:41:32 AMSep 12
to grpc.io
I have a server streaming service. Want to write UTs for the C++ client that uses aync callback APIs using gmocks. I have mocked the 
Service::StubInterface::async_interface and
GrpcEndpointInfoService::StubInterface so that when I call
the stub->async->method I call the mocked function. However,
how do I prevent the StartCall from being called. Witouth the
actual reactor being ever passed to gRPC stack, calling StartCall
Crashes my UT.

Any example of how to write UT for the client side for
c++ callback APIS witout writing th server would be super useful

Reply all
Reply to author
Forward
0 new messages