Parallel flows
You can execute and compare responses from multiple API calls in parallel in YAML tests
This instruction is required when you want to fire multiple API calls in parallel and compare their responses. A simple use case for this would be to test for race conditions in an API by sending multiple requests in parallel.
To configure Akto test YAML for multiple parallel requests, set type: parallel. All the requests defined under this block are fired at the same time.
execute:
type: parallel # this means multiple requests are configured to run in parallel
requests:
- req:
...
- req:
... Instructions available -
For each request in a parallel flow, you can now use
A global
validateblock to test for a certain response across all parallel requests.A local
validateblock for each individual request.A local
validateblock and globalvalidateblock.
If multiple validate blocks are used, all the validate blocks will be evaluated using the Logical AND operation.
Example 1 - Try adding body parameters to each request with a global validate block applying to all of them.
execute:
type: parallel
requests:
- req:
- add_body_param:
test1: one
- req:
- add_body_param:
test2: two
- req:
- add_body_param:
test3: three
validate:
response_code:
gte: 200
lt: 300Example 2 - Use local validate blocks on each parallel request, and a global validate block for a common condition.
Note: A maximum of 10 requests can be made in parallel.
Last updated
Was this helpful?