Test case
Description
test: case `(mandatory) Property key and constant value to define the test yaml type as test case`
name: string `(mandatory) Name label of test case`
description: string `Description of test case` [optional]
save: boolean `true by default, set to false if test case does not need to be saved in the cloud` [optional]
overwrite: boolean `true by default, set to false if test case does not need to be overwritten in the cloud` [optional]
casedetails: `Case details is a dictionary which holds all the test case data`
requestTimeout: int `overrides default value of 30 seconds, or the value assigned in Global Variables as $requestTimeout` [optional]
jsVars: `Dictionary of apimation variables as keys and executable JavaScript file paths as values, always started with '$'` [optional]
(varname:string): (varvalue:string)
nodeJsVars: `Dictionary of apimation variables as keys and executable Node.js file paths as values, always started with '$'` [optional]
(varname:string): (varvalue:string)
vars: `Dictionary of apimation variables where the key is varname starting with '$' and the value is variable value` [optional]
(varname:string): (varvalue:string|int)
preconditionCases: [string, string,...] `List of test case names which will be executed before test case` [optional]
closureCases: [string, string,...] `List of test case names which will be executed after test case` [optional]
...
loop: `List of loop conditions for a range or single unit of steps` [optional]
- range: string(/^(\d+-\d+)|(\d+)/)
count: (int|"$len($jsonArr)") `Values for loop count can be either static or dynamic, use $len() function call and provide an apimation variable
with json array value for the dynamic calculation. When loop count is less or equal 0 or provided to $len() function array is empty, looped step is ignored.`
threads: int `Thread count for step parallel run `
listInPositions: `Dictionary with apimation variables with list of values and each of them will be used for each loop iteration`
(varname:string): [(varvalue:string),...]
...
variableInPositions: `Dictionary with apimation variables with apimation variable as a value that represents a json list or a list variable from grep feature`
(varname:string): (variable:string)
inLoop: `List of loop conditions for a range or single unit of steps, see additional information below` [optional]
- range: string(/^(\d+-\d+)|(\d+)/)
count: (int|"$len($jsonArr)") `Values for loop count can be either static or dynamic, use $len() function call and provide an apimation
variable with json array value for the dynamic calculation`
threads: int `Thread count for step parallel run `
listInPositions: `Dictionary with apimation variables with list of values and each of them will be used for each loop iteration`
(varname:string): [(varvalue:string),...]
...
variableInPositions: `Dictionary with apimation variables with apimation variable as a value that represents a json list or a list variable
from grep feature, prioritized values from outer loop step
(varname:string): (variable:string)
inLoop: ...
- ...
defaultCollection: string `Name of default collection for all steps for loading`
steps: `List of test case steps defined. Use environment, case variables and/or function calls if needed. For example in url value $api/books/$id`
- name: string `Name label of test step`
append: boolean `specifies if you want to append or override the step details specified here (the case) for the specific step. You can change any
detail of the step after
- name: StepName, e.g. urlEncodedParams:`
loadFrom: string `Name of collection to load step from` [optional] unless `defaultCollection` is not defined for loading or overwrite of
defaultCollection is necessary
- ...
InLoop
In Loops are loops that are executed after every loop and previous in loop iteration and can be stacked as much as your machine can handle. Steps for in loops must be in ascending order, followed by the next step index, example loop ranging step 6, must be followed by a inLoop ranging step 7. We suggest limiting or not using loops and in loops in load test as it severely impacts performance.
Example
test: case
name: Retrieve user
setName: user
casedetails:
requestTimeout: 10
vars:
$assertEpochDate: $dateToEpoch(2006-01-02T15:04:05.000Z)
jsVars:
$assertUserDescription: "Tests/UserTests/js/getUserDescription.js"
loop:
- range: 1
count: 3
listInPositions:
$userRole: ["Administrator",
"Author",
"Subscriber"]
$assertAge: [37
27,
34]
variableInPositions:
$roleID: $roleIDList,
$roleRate: $roleRateList
steps:
- name: GET $userRole
append: false
urlEncodedParams:
param: [paramValue]
collection:
name: user
load: true
JavaScript
Apimation also offers possibilities to include JavaScript and Node.js in your test case. More information about usage available here.
Provided example test case includes JavaScript file getUserDescription.js
with following content:
getUserDescription();
function getUserDescription() {
return "User descripton"
}