Customizing gRPC mock responses

Before you can customize the mock response, you will first of course need to mock a gRPC service

Steps to customize the response

  1. Create a mock gRPC service
  2. Double click on a method to open it in a tab
  3. Note the commented out parts of the script. It shows examples on how to customize the response by using C# snippets


    Note : anything in between $<< and >> should be valid C# code
  4. Copy the sample snippets to the json (as below)
  5. If the mock server is not yet started, click on the Play button

Testing the mocked method

  1. Open FintX (or your own gRPC client application) and create a gRPC client. Configure the client to point to the port used by the above mock service
  2. Invoke the mocked method. The code snippets will be executed and the response will contain the output of the code snippets

    You should get the response something like below

Leave a Reply

Your email address will not be published. Required fields are marked *