-
Notifications
You must be signed in to change notification settings - Fork 18
Testing
Tooling support for testing services implemented on gRPC continues to evolve. This pages provides recommendations for testing tools.
Locust is a great tool for generating load for testing individual services and composite flows - for e.g. simulating user login and accessing a bunch of features on a Product page that results in calls to a number of services. gRPC IDLs can be compiled to Python client code ( See Python support in gRPC ) that can be seamlessly integrated with Locust scripts.
Integration testing is primarily for validating contracts between services. Tools like Postman and Swagger substantially reduce testing time of REST based JSON/Http1.x services.
The choice of integration testing tools is driven by these philosophies, consistent with GJEX goals:
- Support for testing services using JSON/Http1.x
- Zero or minimal effort in on-boarding a new service for testing
- Zero modifications to gRPC IDL or code and no additional compilation steps to support testing
- Preferably disconnect the testing interface(Text based protocol) from production (Binary protocol)
Exposing gRPC services as JSON over Http explains how a gRPC service can be exposed as a JSON/Http API using the Envoy reverse proxy. Following this setup, a gRPC service can be tested using standard tools like Postman.
The steps below explain how gRPC services can be tested using Postman:
- Fork & compile or install the Polyman binary
- Polyman uses Polyglot under the hood. Polygot requires access to the gRPC service definition IDL .proto files. This can be configured via Http headers as explained in following steps.
- Run the Polyman binary with no arguments. This brings up the proxy on localhost and port 8000
- Configure the Polyman proxy in Postman under Settings -> Proxy -> Enable "Global Proxy Configuration" -> Add localhost:8000
- Configure the Http Header "x-polyman-root" and point it to the local location of the gRPC .proto IDL files like below: