ACCELQ supports automating gRPC requests and response validation in its Action logic with the codeless interface. Here is an article describing this capability.
Before starting with gRPC automation, it is required to convert all proto definition files to suitable Java sources to be consumed by the ACCELQ gRPC commands library.
Proto-file configuration requirements
Here are the configuration requirements on the proto files definition that must be satisfied:
Check and Update the following in the gRPC proto-definition files:
1. Set java_multiple_file
to true
option java_multiple_files = true;
2. Set java_package
to suitable package names as required
option java_package = "<package name>";
3. Remove all explicit declarations of optional
keyword in the message fields. All fields are optional by default.
Run ProtoC to convert to Java
-
Download the following gRPC executables with the given version as per your OS and Architecture:
- protoc: 3.6.1 (https://repo1.maven.org/maven2/com/google/protobuf/protoc/3.6.1/)
- protoc-gen-grpc-java: 1.19.0 (https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/1.19.0/)
-
Open a terminal on the folder containing the downloaded executables, and run the following command for EVERY proto file.
./protoc.exe --plugin=protoc-gen-grpc=./protoc-gen-grpc-java.exe --java_out=<output dir> --grpc_out=<output dir> --proto_path=<proto file directory> <proto file name>
where
- "proto file directory" denotes the path to the directory containing the proto file which needs to be converted
- “proto file name” denotes the proto file’s name along with the extension
- "output dir" points to the folder under which the Java files will be generated by the utility
Comments
0 comments
Article is closed for comments.