Reusable Test Blocks

Reusable Test Blocks

Reusable Test Blocks allow you to group commonly repeated steps into a single functional unit that can be referenced across test cases. This feature improves maintainability, reduces duplication, and enables faster creation of consistent and reliable automation flows.

Reusable Test Blocks behave like modular building blocks inside QApilot’s automation engine. You can define them once and reuse them whenever needed within a test case.


Overview

Many mobile test cases share similar foundations such as login flows, onboarding steps, search sequences, or checkout starting points. Previously, these steps had to be recorded or maintained separately in every test case.

With Reusable Test Blocks you can:

  • Convert any collection of steps into a functional block

  • Reuse the same block multiple times in a test case

  • Reorder and manage steps inside a block

  • Execute blocks as part of a test and see each step individually in reports

  • Maintain logic in one place rather than editing multiple test cases

This ensures consistency, reduces maintenance overhead, and accelerates authoring of long or repetitive flows.


Key Features

1. Create Functional Blocks from Test Steps

You can select one or more steps from an existing test case and convert them into a Functional Block.

This is ideal for:

  • Login sequences

  • Navigational flows

  • Reusable validation steps

  • Form-filling routines

  • Repeated UI action groups

Once created, the block becomes available for reuse.


2. New Keyword: Functional Block

QApilot introduces a new keyword called Functional Block.

This keyword allows you to insert a predefined Functional Block anywhere inside a test case.

Example usage:

  • Add Login Block at the beginning of multiple test cases

  • Add Search Flow Block wherever needed

  • Loop or reuse the same block multiple times within the same test case


3. Step Ordering & Editing

Inside a Functional Block:

  • Steps can be rearranged

  • Steps can be edited as needed

  • The block maintains its internal order when reused

Changes to the block automatically reflect across all test cases that reference it.


4. Execution & Reporting

During execution:

  • When the block is triggered, each step inside it runs sequentially

  • Execution reports expand and display every individual step

  • This ensures complete traceability and easier debugging

Functional Blocks behave exactly like normal test steps during execution.

5. Bulk Activate and Deactivate


UI & Workflow

Functional Blocks Tab

A new tab called Functional Blocks appears in the sidebar next to the Test Cases tab.

Inside this tab, users can:

  • View all created blocks

  • Create a new block

  • Edit existing blocks

  • Delete or duplicate blocks

  • Inspect steps inside a block

  • Activate or Deactivate existing blocks individually or in bulk

The UI mirrors the Test Cases layout for familiarity and ease of use.


Creating a Functional Block

There are two ways to create a Functional Block:

Method 1: Convert Steps inside a Test Case

  1. Open an existing test case

  2. Select one or more steps

  3. Click Create Functional Block

  4. Name the block

  5. Save

The selected steps are moved or copied into the new block.

Method 2: Create from Functional Blocks Tab

  1. Go to Functional Blocks

  2. Click New Functional Block

  3. Add steps manually

  4. Save


Using Functional Blocks in Test Cases

To use a block:

  1. Open a test case

  2. Click Add Step

  3. Select the Functional Block keyword

  4. Choose the block from the dropdown

The block will appear as a single step, but during execution expands into its full sequence.


Maintenance

Functional Blocks help reduce maintenance by centralizing repeated logic.

For example:

  • Updating the login flow updates it across all test cases that use the Login Block

  • The system significantly reduces the risk of stale or inconsistent automation steps


Best Practices

  • Use blocks for repeated flows like Login, Navigate to Home, Search, Add to Cart

  • Avoid creating overly large blocks; keep them focused

  • Name blocks clearly (e.g., Login with Valid Credentials, Perform Search, Open Orders Screen)

  • Review execution reports to ensure block behavior matches expectations

Last updated