curl https://www.myblog.com/posts --data "Hello World!"
curl -X PUT https://www.myblog.com/posts/123/like
123
part is the identifier of the blog post created by the user - it cannot be known in advance because it is generated by the server at runtime. This is a very common use case for parameters and is handled by two simple steps:https://www.myblog.com/posts/${postId}/like
${}
syntax in the request URL as well as the request body, request headers, extractions, assertions and more.posts/${postId}
will remain as-is if no such parameter is defined or extracted before the expression is evaluated.https://testUser:[email protected]/posts
https://testUser:[email protected]/posts/${postId}/like
https://${user}:${pass}@www.myblog.com/posts
https://${user}:${pass}@www.myblog.com/posts/${postId}/like
$.post.id
will extract the value 123
from this JSON response:id
field from the same JSON response we've seen above using a regular expression: .*"id":\s*([0-9]*)
.https://${host}/path/to/glory
or The time is ${__now}
. $[":user"][":id"]
will extract the value 56
from this EDN response:__status
The status code of the last HTTP response.__statusText
The status text of the last HTTP response.__responseTime
The total response time (in milliseconds) of the last HTTP response.__testRunId
- The test run id: (Suite / Flow / Load)__testStartTime
- The test run start time (UTC in milliseconds)__launchedBy
- The name of the user running the test.Hello ${name}
. However, it is also possible to inject a computed value using Parameter Operators or Parameter Functions, e.g. The total price is ${price + __mult(price,tax)}
. You may use operators or functions anywhere parameters may be used.${budget <= price}
.${__if_then_else(is_good,'Success!',':_(')}
- but be aware there are some syntactic limitations.__random_uuid
can be used instead of __random_uuid()
.${x + y}
is fine but ${x+y}
will not be computed.${__add(x, y)}
and ${fullName == 'John Doe'}
will not be computed.,
) or single quotes ('
). These cannot be escaped - simply define a previous parameter with the desired value when the need arises. Note that numeric literal values need to be quoted the same as any other value, e.g. ${x > '0'}
is OK but ${x > 0}
will not be computed.${x * y + z}
but you may not use parentheses to set precedence, e.g. ${(x * y) + z}
will not be computed. This can usually be worked around using functions though, e.g. ${__mult(x,y) + z}
${x * y + z - j + k}
will be computed as x * (y + (z - (j + k)))
.${__mult(x,y) + z}
is OK but neither ${__mult(x + y,z)}
nor ${__mult(__add(x,y),z)}
will be computed.=
Strict equals operator. Aliases: ==
and ===
.!=
Strict not-equals operator. Alias: !==
.|
Logical OR operator. Alias: ||
.&
Logical AND operator. Alias: &&
.true
if and only iffalse
, FALSE
, FaLsE
or any other combination of upper-case and lower-case letters that forms the word false
.true
or exactly false
.+
Addition operator.-
Subtraction operator.*
Multiplication operator./
Division operator.<
Less-then operator.<=
Less-then-or-equals operator.>
Greater-then operator.>=
Greater-then-or-equals operator.