Fragments
Last updated
Fragments are reusable blocks of test steps that you can use across multiple test cases.
They help you avoid duplication and make your tests easier to maintain.
Use Fragments when:
The same steps are repeated across tests (e.g., login, navigation)
You want to standardize common flows
You want to update logic in one place instead of many
💡 Update a Fragment once → all dependent tests benefit automatically.
You can convert existing steps into a reusable Fragment directly from a test case.
Steps:
Select the steps you want to reuse
Click the more options
button next to the Preview button
Click Extract
Enter a name in the Extract as Fragment modal
Click Create
When enabled → the selected steps are replaced with a Fragment call
If disabled → the Fragment is created, but the original steps remain
💡 This is the fastest way to refactor duplicate logic into reusable components.
Open the TestFirst Editor
Open the library from the left toolbar, then switch to the Fragment tab (next to the Test Case tab)
Right-click → New Fragment, or click the more options icon
in the toolbar → New Fragment
Enter a fragment name and double-click to open it
Add steps using Gherkin or the Recorder
Save the Fragment
Once created, Fragments can be reused in test cases.
Fragments are not standalone test cases and usually cannot be executed independently.
To run a Fragment:
Open the Fragment in the editor
Use the Run with dropdown
Select a test case that uses this Fragment
Run the test
💡 The Fragment will execute within the context of the selected test case, including its setup and dependencies.
Fragments are ideal for:
Login / authentication flows
Repeated navigation steps
Setup or precondition steps
Complex reusable sequences
Keep Fragments small and focused
Use clear, descriptive names (e.g., Login Flow, Create User)
Avoid putting too many unrelated steps in one Fragment
Reuse instead of duplicating logic
Changes to a Fragment affect all test cases using it
Fragments should represent reusable behaviour, not full test cases
Keep them stable to avoid breaking multiple tests
Last updated
Scenario: Login and access dashboard
When I run fragment "TCF1"
Then "Welcome" is displayed
