Skip to main content
In Bruno, we provide two types of script flows: Sandwich and Sequential. These flows control the order in which pre-request scripts, post-response scripts, and test scripts at various levels of your API test collections are executed, allowing for flexibility and control over your automation.

Flow Types

  1. Sandwich Flow
  2. Sequential Flow

1. Sandwich Flow

In the Sandwich Flow, scripts are executed in the following order:
Execution order:
  1. Collection Pre Script
  2. Folder Pre Script
  3. Request Pre Script
  4. Request Post Script
  5. Folder Post Script
  6. Collection Post Script
  7. Request Test Script
  8. Folder Test Script
  9. Collection Test Script
This order nests pre-scripts inward and post-scripts / test scripts outward. It is useful when you need to set up state at broader scopes first, then tear down or assert from the request level back out to the collection.

2. Sequential (Natural) Flow

In the Sequential Flow, scripts are executed in this order:
Execution order:
  1. Collection Pre Script
  2. Folder Pre Script
  3. Request Pre Script
  4. Collection Post Script
  5. Folder Post Script
  6. Request Post Script
  7. Collection Test Script
  8. Folder Test Script
  9. Request Test Script
This flow runs each phase (pre, post, test) from collection → folder → request. It may be better suited when you want a clean top-to-bottom execution at every stage.

Setting the Flow Type

If the flow property is not specified, Sandwich is used by default.
You can set the flow type (either sandwich or sequential) in your collection configuration file:
opencollection.yml

Resources