Forum Discussion

aneurysm's avatar
Occasional Contributor
2 years ago

How to use result of test step in next step

Hi, how can I get result of gRPC request from one test step and use it in next test step in the same test case (compare result of two test steps following)? GUI or groovy script.

1 Reply

  • nmrao's avatar
    Champion Level 3

    How does the response look like? Sample would help to understand.


    Of course, one can read the response of any test step(s) in groovy step


    import com.eviware.soapui.impl.wsdl.teststeps.*
    // Get the gRPC request test step - change if the step name is different
    def grpcStep = testRunner.testCase.getTestStepByName("gRPC Request")
    // Get the gRPC response message
    def grpcResponse = grpcStep.testRequest.responseContent
    // Parse the response message as a byte array
    def responseBytes = grpcResponse.getBytes()
    // Deserialize the response message using Protocol Buffers
    def responseMessage = MyProtoMessage.parseFrom(responseBytes)
    // Print the response message "Response message: $responseMessage"