Introduction
The Parasoft gRPC Transport Extension adds support for the Google Remote Procedure Call transport to applicable messaging client tools in SOAtest. This enables you to take full advantage of SOAtest's rich interface when configuring, sending, and validating messages sent over gRPC.
Requirements
- gRPC 1.0.0 or later
- Parasoft SOAtest 2022.1 or later
Installation
This artifact can be installed from the UI or the command line.
UI Installation
- Go to Parasoft > Preferences and select System Properties.
- Click Add JARs and select the com.parasoft.soavirt.transport.grpc-<version>.jar file.
- Click Apply.
- Restart SOAtest.
Command Line Installation
Add the com.parasoft.soavirt.transport.grpc-<version>.jar file to the system.properties.classpath
property in your settings properties file. For example:
system.properties.classpath=<PATH_TO_JAR>/com.parasoft.soavirt.transport.grpc-<VERSION>.jar
Usage
You can configure message client tools (for example, Messaging Client and ProtoBuf Client) to use the gRPC Transport by enabling it in the tool's Transport tab. Choose Custom Extension from the Transport menu, then gRPC from the Select implementation menu.
Configuration
The configuration settings are broken up into the following groups:
- Connection
- Transport Layer Security
- Call
- Metadata Custom Headers
- Streaming
- Logging
- Connection Management
Each group is described below.
Connection Settings
Host | Specify the host name for the gRPC server. |
---|---|
Port | Specify the port on the host specified above. Value must be between |
Transport Layer Security Settings
Auth Mechanism | Specify the authorization mechanism you want to use to connect to the gRPC server. Options are Default is |
---|---|
Trust Certificate File | Specify the path to a certificate file in PEM format that identifies the gRPC server. This is required for gRPC servers with self-signed certificates. Leave this field blank to use the system trust store for gRPC servers with a public certificate from a root authority. This field is ignored when the Auth Mechanism is set to |
Call Settings
Service Name | Specify the name of the gRPC service to call. |
---|---|
Method Name | Specify the name of the gRPC method to call. |
Access Token | Specify the access token to use with each call. If no access token is needed, leave this field blank. |
Expected Status Codes | Specify one or more status codes that are expected to be returned. You can enter either the number or text name for a code. For example, you can enter "3" or "INVALID_ARGUMENT" if the expected result is that the client will specify an invalid argument. Specify single codes and/or code ranges as a comma-separated list. For example, if you specify "0, 3-5", then codes 0, 3, 4, and 5 will be accepted. You cannot mix numbers and text names when specifying a range, but you can use both when using a name for a single code (in the previous example, "OK, 3-5" would work the same). See gRPC status codes for a full list of available codes. Default is |
Metadata Custom Headers Settings
Key 1 - 4 | Specify the key for the custom header to send in the metadata of each gRPC call. Up to four custom headers are allowed. The key you specify should have a corresponding value. Keys are case insensitive and cannot start with the prefix |
---|---|
Value 1 - 4 | Specify the value for the custom header to send in the metadata of each gRPC call. Up to four custom headers are allowed. The value you specify should have a corresponding key. Binary values must be base64 encoded. |
Streaming Settings
Call ID | Enter the call ID used to switch between multiple open gRPC calls. Default is |
---|---|
Mode | Specify the streaming mode. Options are:
Default is |
Notification | Specify a notification type. Options are:
Default is |
Logging Settings
Log Level | Specify how much information you want logged to the console. The default is 2 (warn). |
---|
Connection Management Settings
Keep connection alive | Enable this option to keep the gRPC channel alive and reused for subsequent calls. |
---|---|
Close connection after test execution | Enable this option to shut down the gRPC channel after all calls have completed. |
Testing Different gRPC Methods
A gRPC method may operate as one of four types:
- Unary
- Server streaming
- Client streaming
- Bidirectional streaming
SOAtest uses a single messaging client (or ProtoBuf client) to test a unary gRPC method. The client request is sent to the method on the gRPC server and then the test waits for a response message or an error. This is the default mode in the gRPC custom transport.
Multiple messaging clients (or ProtoBuf clients) are needed to test the other three gRPC method types for streaming. In each case the client requests and server responses are decoupled. Tools that are configured to send will not have any response payload and tools that are configured to receive will ignore the request payload. It is also necessary to send the completed notification from SOAtest after sending requests, even for server streaming method types that only take one request message. A tool configured to receive the completed notification will wait for that event or report an error if another response message is received. This allows SOAtest to consume a dynamic number of response messages from a gRPC stream by checking if the stream has completed inside of a looping test suite.
Change Log
1.1
- Reorganized configuration sections
- Token-based authentication in gRPC call credentials
- Send gRPC metadata custom headers and show in traffic viewer
- Verify expected status codes from gRPC calls
1.0
- Initial release
Third-Party Content
This extension includes items that have been sourced from third parties as outlined below.
- gRPC (Apache License 2.0)
- PerfMark (Apache License 2.0)
- SLF4J (MIT License)
Additional license details are available in this plugin's licenses folder.