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.xmlfile
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:
endpoint - endpoint for your query
response
- code - expected response code
- file - file with the expected result for a particular query
- header
- name - name of header
- data - data which header has to contain
- header
header
- name - name of header
- data - data which header has to contain
body (for those methods, which require body)
from
- 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
param
- name - name of parameter
- data - data which parameter has to contain
multipart
- file
- name - key
- fileName - value
- contentType
- file
raw - you can put your request body just as raw in scenario without file
queryParam
- key
- value
SendGrid example:
x
<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>