gRPC is a remote procedure call (RPC) framework developed by Google.

There’s an interesting side note behind why it’s named like this. A remote procedure call is a way to execute a function or a method on a remote machine as if it were a local function. It’s an abstraction that removes the pain of dealing with HTTP calls and other network terminologies.

gRPC makes communication and data transfer between microservices much easier and faster. It relies on the HTTP/2 protocol under the hood but makes it easier for developers to connect everything together.

Microservices can be present in multiple languages, so you need to write a program in order for them to talk to each other.

gRPC makes it easy because it supports multiple languages. It uses protocol buffers as the Interface Definition Language for defining the structure of the message.

Testing gRPC Applications

Not just gRPC applications, testing is essential for any complex software that is developed. Testing gRPC applications ensures that the microservices and other services can talk to each other reliably and efficiently.

It ensures that all the services, though written in different languages, can communicate without a language barrier. It’s possible because gRPC uses protocol buffers that are language-neutral.

Error handling and exception handling also become clear when you test your application. Apart from that, one can also perform performance testing to see how services behave under varying loads of network traffic.

Now that you know about gRPC, let’s look at some gRPC testing tools.

Kreya

Kreya is an API client with a graphical user interface for gRPC as well as REST APIs. Its gRPC client supports request streaming, unary calls, validation, and more. To test the API, you can also generate fake data within Kreya itself.

kreya dashboard

Also, the requests and their config are stored in a file system, so you can use git or any other version control system to sync your projects. Kreya lets you define tests by writing scripts in order for you to test the API on every call.

Kreya offers a free tier for individual users, which includes a fully featured gRPC client, reusable authentication configurations, environments and templating, and more.

ghz

ghz, an open source gRPC benchmarking and load testing command line utility written in Go, to test the API and get the results. ghz supports a proto file, a prebuilt protoset bundle, or a server reflection. With the help of template variables in Go, it allows you to add custom data to requests.

ghz

Besides a command line utility, ghz also gives access to a complementary web application interface, which you can use to view, track, and save the test results. You can view the test results in various file formats such as CSV, JSON, and HTML. At the time of writing, the web interface it provides is still in beta stage.

Postman

Postman is an API development platform that supports building and testing for almost all types of APIs, including gRPC. In Postman, you can write tests for individual requests or collections or folders in a collection.

postman

When you make a gRPC request in Postman, head over to the Scripts tab in the request view and then select when you want to perform the test — before the request or after you get a response. You can also use code snippets to write tests faster.

Insomnia

Insomnia is a tool to design, test, and debug APIs. It supports REST, GraphQL, WebSockets, and gRPC requests. When you create a new request in Insomnia, you can select gRPC and then enter the URL endpoint of the API.

Insomnia

You also need to add a .proto file to define your messages. From unary requests to bidirectional streaming, Insomnia supports almost all request types, including client and server streaming.

In order to test APIs in Insomnia, you need to add a design document for your API, and then, in the Test Tab, you can create a test suite. Note that Insomnia uses the Mocha framework for unit testing and Chai for assertions.

Stackhawk

Stackhawk is an API security testing tool that also provides a solution for gRPC services. With the help of this tool, you can ensure the security of your API endpoints. To scan a gRPC application using Stackhawk, you need to define a stackhawk.yml file with required configurations.

stackhawk

Stackhawk offers a free tier with modern DAST-integrated automated testing in the CI/CD pipeline for a single application. However, features such as authentication, automation, insights, notifications, and support for all API types are included in all of the pricing plans.

gRPCurl

gRPCurl is an open-source command-line utility for connecting to gRPC-enabled servers. As the name suggests, it’s termed as “curl for gRPC servers”. The reason you can’t use cURL to make a request to gRPC servers is that it doesn’t support protocol buffers, which are binary messages. cURL only deals with JSON strings.

You can check out the schema for gRPC services either by querying a server that supports server reflection, by reading proto source files, or by loading in compiled “protoset” files (files that contain encoded file descriptor protos).

gRPCurl is not a full-blown testing tool, but still, you can do basic querying and testing using the command-line utility.

Smartbear’s ReadyAPI

ReadyAPI by Smartbear supports gRPC API testing but only unary operations. In order to test a gRPC service, you first need to set up the API connection test step. By doing so, you can then send requests and receive responses from your gRPC service.

ReadyAPI

ReadyAPI only supports unary operations for now, which means that ReadyAPI will only wait for a single response from the server.

NosyMouse

Nosymouse is a tool that includes a gRPC tester for running functional, performance, and security tests either manually or automatically. It offers features like concurrent virtual users, ramp-up, pass criteria, think-times, test data, and support for test scenarios along with multiple weighted use cases.

nosymouse data driven test

It follows the data-driven testing methodology, ensuring you always have support for separate test data, variables, automated verifications, and real-world use cases. You can run your tests with different inputs and verify outputs in the interface.

It offers a 14-day free trial for testing two concurrent service users.

Final Words

With the rise of gRPC services and tools, it can be difficult for you to choose the right gRPC testing tool. Choosing the right tool is important because it impacts your API functionality directly. One important thing to consider is the support for various gRPC functionalities such as server reflection, streaming, etc. Look out for gRPC-specific features when choosing a testing tool.

Next, check out the best API load testing platforms to improve performance.