Skip to main content

Use Prerequisites and Dependencies

Some tests need another flow to happen first. TestVibe can model that relationship with prerequisites or dependent tests.

Use dependencies when one test creates or prepares the state another test needs.

When To Use A Prerequisite

Use a prerequisite when:

SituationExample
A setup flow is reusedSign in before account settings tests.
One feature creates required dataCreate a customer before editing customer details.
A path is too long to repeatComplete onboarding before testing dashboard behavior.
A setup step should be reviewed separatelyCreate invoice before testing invoice download.

Do not use dependencies for every small step. If setup is short and only belongs to one scenario, keep it in the scenario or Background.

Example

Prerequisite feature:

Feature: Customer creation

Scenario: Admin creates an active customer
Given the admin is on the customers page
When the admin creates a customer named "Acme QA"
Then the customer record should be visible

Dependent feature:

Feature: Customer billing

Scenario: Admin updates billing contact
Given the "Acme QA" customer exists
When the admin updates the billing contact email
Then the new billing contact should be saved

The dependent feature can refer to the setup expectation without repeating every creation step.

How Dependencies Affect Maintenance

When you change a prerequisite, review the tests that depend on it.

ChangeWhat to check
Rename fields or buttonsDependent generated tests may need regeneration.
Change created dataDependent tests may need updated expected values.
Move the setup flowDependent features may need clearer starting context.
Delete the prerequisiteDependent tests may no longer be runnable.

Keep Dependencies Understandable

Good dependency chains are short and intentional.

Do:

  • use one setup feature for a clear purpose
  • describe the state the dependent test expects
  • keep prerequisite names specific
  • regenerate dependent tests after meaningful setup changes

Avoid:

  • long chains of dependencies
  • hidden setup that is not mentioned in the dependent scenario
  • relying on fragile data created by another team's manual process

Alternatives

NeedBetter option
Shared setup for every scenario in one featureUse Background.
One-time project or environment setupUse project settings, secrets, or test data setup outside the scenario.
A short setup action used onceKeep it inside the scenario.
A repeated multi-step setup journeyUse a prerequisite or dependent test.

Next

After defining dependencies, generate or regenerate the affected tests. See Generate Playwright code.