gRPC Requests

Applies to ReadyAPI 3.54, last modified on September 23, 2024

A request in gRPC is similar to a function call. ReadyAPI sends a request with a number of parameters in the payload, and a server responds with the function result.

In gRPC, there are four operation types. Currently, ReadyAPI supports only one of them - Unary operations. The Unary operations work as simple requests: ReadyAPI sends a single request and waits for a single response. The Unary operations are configured through the API Connection test step:

Test step editor overview: gRPC request

Click the image to enlarge it.

Using Linked Schemas

When importing Proto3 Files, we support all linked gRPC schemas while testing the gRPC service in that proto3 file and test gRPC services with external links.

ReadyAPI also supports importing .proto files that contain Google protocol buffers. When importing .proto files that are using Google protocol buffers, the import lines in the source .proto file are looking for the .proto files from the Google protocol buffers.

gRPC import statement

Click the image to enlarge it.

When importing Google protocol buffers, it is recommended to use the latest version of these protocol buffers, which can be downloaded from here. After downloading and extracting the archive, navigate to the include folder and copy the entire google subfolder to the location of the source .proto file that you want to use. Note that the import statement has to be at the top of the file and it is using the relative path to look for the .proto files that are imported.

Note: If the Google protocol buffers are not added to the correct folder structure, ReadyAPI will throw an error.
gRPC protobuf

Click the image to enlarge it.

Import file

Click the image to enlarge it.

Generate Interface

Click the image to enlarge it.

Another way to import the Google protocol buffers is to edit the import statements in the source .proto file so that it looks in the same folder for the Google protocol buffers. This can be done in the following way:

Import Statements

Click the image to enlarge it.

Then, with both test_with_GoogleWrappers.proto and the protocol buffer files in the same folder, the import works as well. Note that not all the protocol buffer files are used all the time and they can be chosen according to the needs.

Proto Files

Click the image to enlarge it.

Import Proto Files

Click the image to enlarge it.

Generate Service

Click the image to enlarge it.

See Also

API Connection Test Step
gRPC Testing

Highlight search results