Background:
SOAP and gRPC are messaging protocols between services. SOAP emerged in the era of SOA when large-scale automation of business processes was required. gRPC is a modern RPC framework from Google for high-performance services. Automating the testing of these protocols is traditionally more complex than REST due to their specifics: data formats, serialization schemas, and client code generation.
Problems:
Solutions:
For SOAP: use specialized tools like SoapUI, Postman (limited), automation at a basic level through the generation of SOAP clients in the test automation language (Python, Java). It's important to validate not only responses but also WSDL agreements.
For gRPC: generate client stubs using protoc, use gRPC-compatible libraries (grpcio for Python, grpc-java, etc.), test runners (for example, grpcurl, BloomRPC). A good practice is to mock gRPC servers using interceptors or in-memory services.
Key features:
Can gRPC services be tested as easily and with the same tools as REST?
No. gRPC uses a binary protocol and does not work with HTTP directly (only over HTTP/2), requiring the generation of protobuf clients and specific libraries.
Does SOAP provide automatic detection of all contract errors due to WSDL?
No. A strict data schema helps catch some errors at client compilation time, but does not protect against business logic issues and integration errors.
Is it sufficient to only have unit tests for SOAP/gRPC?
No. Integration and E2E tests are essential to ensure the verification of service interactions, network constraints, and serialization features.
The team attempted to test gRPC services using curl and similar tools, ignoring the need for protobuf generation. As a result, tests were unstable, and some scenarios were not covered at all.
Pros:
Cons:
A centralized pipeline was implemented: clients are generated for each gRPC/SOAP service, all tests are automatically compiled, mock services are brought up in memory, tests validate schemas and responses using contracts.
Pros:
Cons: