SendGrid

How to send the query

Description

<sendgrid> - command which is responsible for sending the SendGrid queries in testing scenarios

Required parameters for SendGrid command:

  • comment

  • alias - unique name of the API you configured in your integration.xml file

Optional parameters:

  • condition - the condition according to which this test step will or won't be executed

  • threshold - parameter, that sets the maximum allowed test step execution time

Available SendGrid methods:

  • GET - this method retrieves email statistics from SendGrid’s API.

  • POST - this method sends an email using SendGrid’s API.

  • PUT - this method updates an existing contact on SendGrid’s contact list.

  • DELETE - this method deletes an email template from SendGrid.

  • PATCH - this method updates an existing email template on SendGrid.

Required parameters for HTTP methods:

  1. endpoint - endpoint for your query

  2. response

    1. code - expected response code

    2. file - file with the expected result for a particular query

      1. header

        1. name - name of header

        2. data - data which header has to contain

  3. header

    1. name - name of header

    2. data - data which header has to contain

  4. body (for those methods, which require body)

    1. from

      1. file - json file that contains body of your request. This file must be named "request_N.json", where N is number of your test step

    2. param

      1. name - name of parameter

      2. data - data which parameter has to contain

    3. multipart

      1. file

        1. name - key

        2. fileName - value

        3. contentType

    4. raw - you can put your request body just as raw in scenario without file

  5. queryParam

    1. key

    2. value

SendGrid example:

<sendgrid comment="Testing post method" alias="ALIAS"> <post endpoint="/templates"> <response code="201" file="expected_1.json"/> <body> <raw> { "name": "example_name", "generation": "legacy" } </raw> </body> </post> </sendgrid> <var comment="Create variable for templates id token" name="template_id"> <path value="$.id"/> </var> <sendgrid comment="Testing get method" alias="ALIAS"> <get endpoint="/templates/{{template_id}}"> <response code="200" file="expected_3.json"/> <header name="Content-Type" data="application/json"/> </get> </sendgrid>