如何测试gRPC API?

I have been assigned to test a gRPC API (written in Golang) but I don't know how to go about testing it and I couldn't find any tutorials online for this type of testing. The only method that I can think of is to write unit tests to test the methods themselves but I would like to also test it with a client. For example, I have tested REST APIs in the past using JMeter as a client to send requests and verify the response data. Is there a method for testing gRPC APIs with a client or is unit testing the only way?

There can be two type of testing.

  • Testing just the implementation of the gRPC method by ignoring the networking

    this question answers this aspect of the testing. By just writing the unit test for the RPC method

  • If you want to test both the implementation and the gRPC networking aspects as well then you need write the gRPC client for the service you want to test.

Here a code snippet about creating a gRPC client

// Set up a connection to the server.
conn, err := grpc.Dial(address, grpc.WithInsecure())
// Execute RPC you want to test
r, err := c.SayHello(context.Background(), &pb.HelloRequest{Name: name})

Check here for complete code example

Well, I was in search for a client like Postman, then i found bloomrpc, which helps in calling grpc services. But i am not sure if it serves your purpose, if you are looking for a tool like jmeter.