Fadelis / grpcmock

A gRPC Java testing tool to easily mock endpoints of gRPC services for IT or Unit testing
http://grpcmock.org
Apache License 2.0
144 stars 13 forks source link

Access to gRPC Mock server from outer client #26

Closed FedorSabeshkin closed 1 year ago

FedorSabeshkin commented 1 year ago

Do I understand correctly that with this library, i can raise a real gRPC service, on the host and port that I specified, which will be available from the outside?

For example, can the gRPC client launched by me separately (for example, in a separate JVM), call a method defined in this server, and then inside the test, I can call verify() to check that the method that the client accessed was called on the server and with what kind of arguments.

Fadelis commented 1 year ago

Hi @FedorSabeshkin , yes potentially you could run it in a separate JVM and call it via the defined port on that machine. But the main use case for gRPC Mock is to run it in the same process as your application and use it in you Junit5 or IT tests. You read more info in the integrations section.

FedorSabeshkin commented 1 year ago

@Fadelis, hello!

Yes, i want use it for Integration Test, where i will be start gRPC client, which will be connect to gRPC server by host and port.

FedorSabeshkin commented 1 year ago

In this case Mockito.verify() will't work for my service? Now my Client create channel by host and port.
If i will create server InProcessServerBuilder.forName(serverName), i must change method for open channel in gRPC client, аnd pass serverName to my client, in another JVM.