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:
| Situation | Example |
|---|---|
| A setup flow is reused | Sign in before account settings tests. |
| One feature creates required data | Create a customer before editing customer details. |
| A path is too long to repeat | Complete onboarding before testing dashboard behavior. |
| A setup step should be reviewed separately | Create 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.
| Change | What to check |
|---|---|
| Rename fields or buttons | Dependent generated tests may need regeneration. |
| Change created data | Dependent tests may need updated expected values. |
| Move the setup flow | Dependent features may need clearer starting context. |
| Delete the prerequisite | Dependent 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
| Need | Better option |
|---|---|
| Shared setup for every scenario in one feature | Use Background. |
| One-time project or environment setup | Use project settings, secrets, or test data setup outside the scenario. |
| A short setup action used once | Keep it inside the scenario. |
| A repeated multi-step setup journey | Use a prerequisite or dependent test. |
Next
After defining dependencies, generate or regenerate the affected tests. See Generate Playwright code.