The template step allows to call out/execute other DSL files.
template_step:
template: template-to-call
requestType: post
result: resultVariableNameMandatory fields:
template- determines the step type, as well as referencing the DSL file to call outrequestType- since DSL files are categorized by HTTP method types, this indicates which method type DSL to call out (Request types)result- name of the variable to store the response of the template in, for use in other steps
Templates and guards
If there are guards that apply to specific DSL folder (for example to the whole POST hierarchy), the guard will also apply to the template. If that template is called from guard, it causes an endless loop that crashes handling of that DSL.
To eliminate this problem, it is recommended to put
templates under a different pseudo-method layer, usually
called TEMPLATES and use it as requestType in template
call:
template_step:
template: template-to-call
requestType: templates
result: resultVariableNameOptional fields:
argsbody- ..desired body values - emulating HTTP request body params. Scripts can be used.
query- ..desired param values - emulating HTTP request query params. Scripts can be used.
Template results are stored "as-is" into the application context.
call_template:
template: steps/return/return-with-script
requestType: get
result: templateResult
return_result:
return: {templateResult}call_template:
template: scripting/passing-post-parameters
requestType: post
body:
project: "byk"
website: "krat.ee"
query:
var1: "var"
result: templateResult
return_result:
return: ${templateResult}