Skip to main content

Setup/Teardown

The Setup / Teardown tab in Collection Details lets you add steps that run before the first case and after the last case of a collection.

To open it, select the collection you want from the API Test listing, then select the Setup / Teardown tab.

Setup / Teardown Tab

View the Setup / Teardown Tab​

The tab contains the following sections:

  • About collection setup and teardown — an expandable information panel about collection setup and teardown
  • BEFORE THE FIRST CASE — the setup steps that run before the first case. If there are none, it shows No setup steps yet.
  • AFTER THE LAST CASE — the teardown steps that run after the last case. If there are none, it shows No teardown steps yet.
  • Step behavior — an expandable information panel about how steps behave
  • Save button — saves your changes. It is disabled and shows No unsaved changes when there is nothing to save, and shows Unsaved changes once you make a change

Add a Setup Step​

To add a step that runs before the first case:

  1. In the BEFORE THE FIRST CASE section, select Add Setup Step.
Add Setup Step
  1. A new step card appears. Select a Step Type and fill in the step's fields.
Setup Step Card
  1. Select Save to save your changes.

Each setup step card displays:

  • Order number — the step's position in the list
  • Step type badge — the type of the step, such as Run Collection
  • Step name — the name of the step, such as Run collection
  • Failure behavior badge — what happens if the step fails, such as Block all cases
  • Collapse button — collapse or expand the step's fields
  • Delete button — remove the step
  • Drag handle — drag the step to change its order

The fields in the card depend on the step type you select. See Step Types for the available types.

Add a Teardown Step​

To add a step that runs after the last case:

  1. In the AFTER THE LAST CASE section, select Add Teardown Step.
Add Teardown Step
  1. A new step card appears. Select a Step Type and fill in the step's fields.
Teardown Step Card
  1. Select Save to save your changes.

A teardown step card is similar to a setup step card, with the following differences:

  • The behavior badge shows Always runs instead of the failure behavior
  • There is no On Failure field

The fields in the card depend on the step type you select. See Step Types for the available types.

Step Types​

Each step has a Step Type. The step types available depend on whether you are adding a setup step or a teardown step.

Setup Step Types​

Step typeDescription
Run CollectionRuns a published collection
Generate ValueGenerates a value and stores it in a run variable
HTTP RequestSends an HTTP request, and can extract values from the response into variables
Import VariablesImports values from the caller into this collection

Teardown Step Types​

Step typeDescription
Run CollectionRuns a published collection
HTTP RequestSends an HTTP request, and can extract values from the response into variables
Export VariablesExports values from this collection to its caller