Tosca Reusable TestStepBlocks and TestStepLibraries
Introduction
Many tests start the same way, for example by signing in. Copying those steps into every TestCase makes maintenance painful. Tosca solves this with TestStepLibraries and Reusable TestStepBlocks, which let you define steps once and reference them everywhere. This lesson shows how to use them.
Prerequisites
- TestCases and TestSteps
- A repeated sequence of steps in your tests
Step-by-Step Guide
Step 1: Identify steps worth reusing
Look for sequences that appear in many TestCases, such as login, navigation to a screen, or creating a standard record. These are the best candidates for a reusable block.
Step 2: Use a TestStepLibrary
TestStepLibraries let you manage TestSteps, XTestSteps, and sequences of TestSteps centrally. You can have one TestStepLibrary per TestCase folder. Reusable blocks you create there can be referenced from many TestCases.
Step 3: Reference blocks in TestCases
Add the reusable block to a TestCase instead of copying the steps. Every change you make in the TestStepLibrary affects all references, so a single fix updates every TestCase that uses the block.
Step 4: Make blocks flexible with parameters
Use business parameters, written like {PL[Username]}, so each TestCase can pass its own data into the same block. A Login block can then run with different users without any duplication.
Step 5: Keep the library tidy
Name blocks clearly, keep each one focused on a single purpose, and document what parameters it expects. Because changes ripple through every reference, review changes carefully before saving.
FAQs
- What happens when I change a reusable block?
- All TestCases that reference it are affected, which is the main benefit and also the main risk. Make changes deliberately and re-run key tests afterwards.
- How is this different from copying steps?
- A copy is independent and must be updated in every place. A reference stays linked to the library, so one update applies everywhere.
Summary
Move repeated sequences into a TestStepLibrary as reusable blocks, reference them from TestCases, and pass data through business parameters. One change then updates every test that uses the block.
Comments
Log in or create a free account to join the discussion.